Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #45 from geeksville/master
Browse files Browse the repository at this point in the history
Minor fixes for public beta-4 release
  • Loading branch information
geeksville authored Nov 10, 2019
2 parents 2283b16 + 863fc91 commit da197cf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
6 changes: 4 additions & 2 deletions firmware/common/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@


# The integer build number for this release, MUST BE INCREMENTED FOR EACH RELEASE SO BOOTLOADER WILL INSTALL
VERSION_NUM := 19
# it is not user visible, but we must ensure it is monotonically increasing
VERSION_NUM := 20

VERSION_STRING := 0.5.0-beta.3
# This is the user visible string for the version
VERSION_STRING := 0.5.0-beta.4

CFLAGS += -DVERSION_STRING=\"$(VERSION_STRING)\"
18 changes: 9 additions & 9 deletions firmware/common/src/configscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static Field batterySOCMenus[] =

static Field assistMenus[] =
{
FIELD_EDITABLE_UINT("Num assist levels", &l3_vars.ui8_number_of_assist_levels, "", 1, 9),
FIELD_EDITABLE_UINT(_S("Num assist levels", "Num Levels"), &l3_vars.ui8_number_of_assist_levels, "", 1, 9),
FIELD_EDITABLE_UINT("Level 1", &l3_vars.ui8_assist_level_factor[0], "", 0, 255, .div_digits = 1),
FIELD_EDITABLE_UINT("Level 2", &l3_vars.ui8_assist_level_factor[1], "", 0, 255, .div_digits = 1),
FIELD_EDITABLE_UINT("Level 3", &l3_vars.ui8_assist_level_factor[2], "", 0, 255, .div_digits = 1),
Expand All @@ -46,7 +46,7 @@ static Field assistMenus[] =
static Field walkAssistMenus[] =
{
FIELD_EDITABLE_ENUM("Feature", &l3_vars.ui8_walk_assist_feature_enabled, "disable", "enable"), // FIXME, share one array of disable/enable strings
FIELD_EDITABLE_UINT("Leveui8_g_reset_to_defaults_counterl 1", &l3_vars.ui8_walk_assist_level_factor[0], "", 0, 100),
FIELD_EDITABLE_UINT("Level 1", &l3_vars.ui8_walk_assist_level_factor[0], "", 0, 100),
FIELD_EDITABLE_UINT("Level 2", &l3_vars.ui8_walk_assist_level_factor[1], "", 0, 100),
FIELD_EDITABLE_UINT("Level 3", &l3_vars.ui8_walk_assist_level_factor[2], "", 0, 100),
FIELD_EDITABLE_UINT("Level 4", &l3_vars.ui8_walk_assist_level_factor[3], "", 0, 100),
Expand All @@ -61,7 +61,8 @@ static Field startupPowerMenus[] =
{
FIELD_EDITABLE_ENUM("Feature", &l3_vars.ui8_startup_motor_power_boost_feature_enabled, "disable", "enable"), // FIXME, share one array of disable/enable strings
FIELD_EDITABLE_ENUM("Active on", &l3_vars.ui8_startup_motor_power_boost_always, "startup", "always"),
FIELD_EDITABLE_ENUM("Limit to max-power", &l3_vars.ui8_startup_motor_power_boost_limit_power, "no", "yes"),
FIELD_EDITABLE_ENUM(_S("Need rotation", "Need pedal"), &l3_vars.ui8_motor_assistance_startup_without_pedal_rotation, "/w pedal", "always"), // FIXME, share one array of disable/enable strings
FIELD_EDITABLE_ENUM(_S("Limit to max-power", "Power limit"), &l3_vars.ui8_startup_motor_power_boost_limit_power, "no", "yes"),
FIELD_EDITABLE_UINT("Duration", &l3_vars.ui8_startup_motor_power_boost_time, "secs", 0, 255, .div_digits = 1),
FIELD_EDITABLE_UINT("Fade", &l3_vars.ui8_startup_motor_power_boost_fade_time, "secs", 0, 255, .div_digits = 1),
FIELD_EDITABLE_UINT("Level 1", &l3_vars.ui8_startup_motor_power_boost_factor[0], "", 0, 255, .div_digits = 1),
Expand Down Expand Up @@ -103,7 +104,6 @@ static Field offroadMenus[] = {
static Field variousMenus[] =
{
FIELD_EDITABLE_ENUM("Motor voltage", &l3_vars.ui8_motor_type, "48V", "36V", "expert"),
FIELD_EDITABLE_ENUM("Motor assist", &l3_vars.ui8_motor_assistance_startup_without_pedal_rotation, "disable", "enable"), // FIXME, share one array of disable/enable strings
FIELD_END };

static Field technicalMenus[] =
Expand All @@ -122,10 +122,10 @@ static Field technicalMenus[] =
static Field topMenus[] = {
FIELD_SCROLLABLE("Wheel", wheelMenus),
FIELD_SCROLLABLE("Battery", batteryMenus),
FIELD_SCROLLABLE("Battery SOC", batterySOCMenus),
FIELD_SCROLLABLE("Assist level", assistMenus),
FIELD_SCROLLABLE(_S("Battery SOC", "Bat SOC"), batterySOCMenus),
FIELD_SCROLLABLE(_S("Assist level", "Assist"), assistMenus),
FIELD_SCROLLABLE("Walk", walkAssistMenus),
FIELD_SCROLLABLE("Startup power", startupPowerMenus),
FIELD_SCROLLABLE(_S("Startup power", "Start Pwr"), startupPowerMenus),
FIELD_SCROLLABLE("Motor temp", motorTempMenus),
FIELD_SCROLLABLE("Display", displayMenus),
// FIELD_SCROLLABLE("Offroad", offroadMenus),
Expand Down Expand Up @@ -187,6 +187,7 @@ static Field startupPowerMenus[] = {
FIELD_EDITABLE_ENUM("Feature", &l3_vars.ui8_startup_motor_power_boost_feature_enabled, "disable", "enable"), // FIXME, share one array of disable/enable strings
FIELD_EDITABLE_ENUM("Active on", &l3_vars.ui8_startup_motor_power_boost_always, "startup", "always"),
FIELD_EDITABLE_ENUM("Limit to max-power", &l3_vars.ui8_startup_motor_power_boost_limit_power, "no", "yes"),
FIELD_EDITABLE_ENUM("Needs rotation", &l3_vars.ui8_motor_assistance_startup_without_pedal_rotation, "disable", "enable"), // FIXME, share one array of disable/enable strings
FIELD_EDITABLE_UINT("Duration", &l3_vars.ui8_startup_motor_power_boost_time, "secs", 0, 255, .div_digits = 1),
FIELD_EDITABLE_UINT("Fade", &l3_vars.ui8_startup_motor_power_boost_fade_time, "secs", 0, 255, .div_digits = 1),
FIELD_EDITABLE_UINT("Level 1", &l3_vars.ui8_startup_motor_power_boost_factor[0], "", 0, 255, .div_digits = 1),
Expand Down Expand Up @@ -230,7 +231,6 @@ static Field offroadMenus[] = {

static Field variousMenus[] = {
FIELD_EDITABLE_ENUM("Motor voltage", &l3_vars.ui8_motor_type, "48V", "36V", "expert"),
FIELD_EDITABLE_ENUM("Motor assist", &l3_vars.ui8_motor_assistance_startup_without_pedal_rotation, "disable", "enable"), // FIXME, share one array of disable/enable strings
FIELD_END };

static Field technicalMenus[] = {
Expand Down Expand Up @@ -260,7 +260,7 @@ static Field topMenus[] = {
FIELD_END };
#endif

static Field configRoot = FIELD_SCROLLABLE("Configurations", topMenus);
static Field configRoot = FIELD_SCROLLABLE(_S("Configurations", "Config"), topMenus);

uint8_t ui8_g_configuration_display_reset_to_defaults = 0;
uint32_t ui32_g_configuration_wh_100_percent = 0;
Expand Down
30 changes: 22 additions & 8 deletions firmware/common/src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,23 +190,37 @@ static bool renderMesh(FieldLayout *layout) {
return true;
}

static void drawSelectionMarkerForced(FieldLayout *layout) {
// Only consider doing this on items that might be animated
// we size the cursor to be slightly shorter than the box it is in

UG_FontSelect(&FONT_CURSORS);
UG_PutChar('0', layout->x + layout->width - FONT_CURSORS.char_width, // draw on ride side of line
layout->y + (layout->height - FONT_CURSORS.char_height) / 2, // draw centered vertially within the box
layout->field->is_selected && blinkOn ? EDITABLE_CURSOR_COLOR : getBackColor(ColorNormal),
C_TRANSPARENT);
}

/**
* If we are selected, highlight this item with a bar to the left (on color screens possibly draw a small
* color pointer or at least color the line something nice.
*/
static void drawSelectionMarker(FieldLayout *layout) {
// Only consider doing this on items that might be animated
// we size the cursor to be slightly shorter than the box it is in
Field *field = layout->field;
if(!field)
return; // Couldn't have cursor

// && !curActiveEditable - old code when editing don't blink the selection cursor
if (layout->field && layout->field->is_selected) {
UG_FontSelect(&FONT_CURSORS);
UG_PutChar('0', layout->x + layout->width - FONT_CURSORS.char_width, // draw on ride side of line
layout->y + (layout->height - FONT_CURSORS.char_height) / 2, // draw centered vertially within the box
blinkOn ? EDITABLE_CURSOR_COLOR : getBackColor(ColorNormal),
C_TRANSPARENT);
}
// if the field is currently selected we need to blink the cursor

// also if the field is marked as dirty, we render just in case the reason it is dirty is that is was previously selected
// FIXME - is_selected was probably a mistake, refactor to remove all these nasty field type checks
bool couldHaveCursor = field->dirty && ((field->variant == FieldEditable && !field->editable.read_only) || field->variant == FieldScrollable);

if (field->is_selected || couldHaveCursor) {
drawSelectionMarkerForced(layout);
}
}

/**
Expand Down

0 comments on commit da197cf

Please sign in to comment.