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

Commit ea792df

Browse files
committed
make headlights/walk mode controllable on info screens. bump version to .14
1 parent 18d253d commit ea792df

4 files changed

Lines changed: 22 additions & 12 deletions

File tree

firmware/SW102/src/sw102/mainscreen-sw102.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Screen infoScreen = {
117117
// .onPress = mainscreen_onpress,
118118
.onEnter = mainScreenOnEnter,
119119
.onCustomized = eeprom_write_variables,
120+
.onPress = anyscreen_onpress,
120121

121122
.fields = {
122123
BATTERY_BAR,

firmware/common/Makefile.common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
# The integer build number for this release, MUST BE INCREMENTED FOR EACH RELEASE SO BOOTLOADER WILL INSTALL
7-
VERSION_NUM := 13
7+
VERSION_NUM := 14
88

99
VERSION_STRING := 0.19.$(VERSION_NUM)
1010

firmware/common/include/mainscreen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ extern Field socField,
3333
extern Field batteryField; // These fields are custom for board type
3434
void battery_display(); // 850C and sw102 provide alternative versions due to different implementations
3535
void set_conversions();
36+
bool anyscreen_onpress(buttons_events_t events);

firmware/common/src/mainscreen.c

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,19 +156,27 @@ Screen bootScreen = {
156156
}
157157
};
158158

159-
bool mainscreen_onpress(buttons_events_t events) {
160-
if ((events & DOWN_LONG_CLICK) && l3_vars.ui8_walk_assist_feature_enabled) {
161-
ui8_walk_assist_state = 1;
162-
return true;
163-
}
159+
// Allow common operations (like walk assist and headlights) button presses to work on any page
160+
bool anyscreen_onpress(buttons_events_t events) {
161+
if ((events & DOWN_LONG_CLICK) && l3_vars.ui8_walk_assist_feature_enabled) {
162+
ui8_walk_assist_state = 1;
163+
return true;
164+
}
164165

165-
// long up to turn on headlights
166-
if (events & UP_LONG_CLICK) {
167-
l3_vars.ui8_lights = !l3_vars.ui8_lights;
168-
set_lcd_backlight();
166+
// long up to turn on headlights
167+
if (events & UP_LONG_CLICK) {
168+
l3_vars.ui8_lights = !l3_vars.ui8_lights;
169+
set_lcd_backlight();
169170

170-
return true;
171-
}
171+
return true;
172+
}
173+
174+
return false;
175+
}
176+
177+
bool mainscreen_onpress(buttons_events_t events) {
178+
if(anyscreen_onpress(events))
179+
return true;
172180

173181
if (events & UP_CLICK /* &&
174182
m_lcd_vars.ui8_lcd_menu_max_power == 0 */) {

0 commit comments

Comments
 (0)