refactor LED dwell time to function call
This commit is contained in:
parent
379a795ad3
commit
1c2f1bad5d
@ -383,6 +383,14 @@ void movement_set_backlight_color(movement_color_t color) {
|
||||
movement_state.settings.bit.led_blue_color = color.blue;
|
||||
}
|
||||
|
||||
uint8_t movement_get_backlight_dwell(void) {
|
||||
return movement_state.settings.bit.led_duration;
|
||||
}
|
||||
|
||||
void movement_set_backlight_dwell(uint8_t value) {
|
||||
movement_state.settings.bit.led_duration = value;
|
||||
}
|
||||
|
||||
bool movement_alarm_enabled(void) {
|
||||
return movement_state.settings.bit.alarm_enabled;
|
||||
}
|
||||
|
||||
@ -349,6 +349,9 @@ void movement_set_low_energy_timeout(uint8_t value);
|
||||
movement_color_t movement_backlight_color(void);
|
||||
void movement_set_backlight_color(movement_color_t color);
|
||||
|
||||
uint8_t movement_get_backlight_dwell(void);
|
||||
void movement_set_backlight_dwell(uint8_t value);
|
||||
|
||||
/// TODO: For #SecondMovement: Should we have a counter that watch faces increment when they enable an alarm, and decrement when they disable it?
|
||||
/// Or should there be a watch face function where watch faces can tell us if they have an alarm enabled?
|
||||
/// Worth considering a better way to handle this.
|
||||
|
||||
@ -58,7 +58,7 @@ void demo_face_activate(movement_settings_t *settings, void *context) {
|
||||
movement_request_tick_frequency(0);
|
||||
// ensure the watch never enters low energy mode
|
||||
movement_set_low_energy_timeout(0);
|
||||
settings->bit.led_duration = 3;
|
||||
movement_set_backlight_dwell(3);
|
||||
}
|
||||
|
||||
bool demo_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
|
||||
@ -140,12 +140,12 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||
}
|
||||
break;
|
||||
case PREFERENCES_PAGE_LED_DURATION:
|
||||
if (settings->bit.led_duration == 0) {
|
||||
if (movement_get_backlight_dwell() == 0) {
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, "instnt");
|
||||
} else if (settings->bit.led_duration == 0b111) {
|
||||
} else if (movement_get_backlight_dwell() == 0b111) {
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, "no LEd");
|
||||
} else {
|
||||
sprintf(buf, " %1d SeC", settings->bit.led_duration * 2 - 1);
|
||||
sprintf(buf, " %1d SeC", (movement_get_backlight_dwell() * 2 - 1) % 10);
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, buf);
|
||||
}
|
||||
break;
|
||||
@ -195,10 +195,10 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||
movement_set_low_energy_timeout((movement_get_low_energy_timeout() + 1));
|
||||
break;
|
||||
case PREFERENCES_PAGE_LED_DURATION:
|
||||
settings->bit.led_duration = settings->bit.led_duration + 1;
|
||||
if (settings->bit.led_duration > 3) {
|
||||
movement_set_backlight_dwell(movement_get_backlight_dwell() + 1);
|
||||
if (movement_get_backlight_dwell() > 3) {
|
||||
// set all bits to disable the LED
|
||||
settings->bit.led_duration = 0b111;
|
||||
movement_set_backlight_dwell(0b111);
|
||||
}
|
||||
break;
|
||||
case PREFERENCES_PAGE_LED_RED:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user