diff --git a/Makefile b/Makefile index 3f59c345..c4a9c20e 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,10 @@ else endif endif +ifdef NOSLEEP + DEFINES += -DMOVEMENT_LOW_ENERGY_MODE_FORBIDDEN +endif + ifdef EMSCRIPTEN all: $(BUILD)/$(BIN).elf $(BUILD)/$(BIN).html $(BUILD)/$(BIN).html: $(OBJS) diff --git a/movement.c b/movement.c index a767fa35..cafa09fc 100644 --- a/movement.c +++ b/movement.c @@ -636,7 +636,11 @@ void app_init(void) { movement_state.settings.bit.button_should_sound = MOVEMENT_DEFAULT_BUTTON_SOUND; movement_state.settings.bit.button_volume = MOVEMENT_DEFAULT_BUTTON_VOLUME; movement_state.settings.bit.to_interval = MOVEMENT_DEFAULT_TIMEOUT_INTERVAL; +#ifdef MOVEMENT_LOW_ENERGY_MODE_FORBIDDEN + movement_state.settings.bit.le_interval = 0; +#else movement_state.settings.bit.le_interval = MOVEMENT_DEFAULT_LOW_ENERGY_INTERVAL; +#endif movement_state.settings.bit.led_duration = MOVEMENT_DEFAULT_LED_DURATION; movement_store_settings(); @@ -774,6 +778,8 @@ void app_setup(void) { } } +#ifndef MOVEMENT_LOW_ENERGY_MODE_FORBIDDEN + static void _sleep_mode_app_loop(void) { movement_state.needs_wake = false; // as long as le_mode_ticks is -1 (i.e. we are in low energy mode), we wake up here, update the screen, and go right back to sleep. @@ -791,6 +797,8 @@ static void _sleep_mode_app_loop(void) { } } +#endif + bool app_loop(void) { const watch_face_t *wf = &watch_faces[movement_state.current_face_idx]; bool woke_up_for_buzzer = false; @@ -828,6 +836,7 @@ bool app_loop(void) { // if we have a scheduled background task, handle that here: if (event.event_type == EVENT_TICK && movement_state.has_scheduled_background_task) _movement_handle_scheduled_tasks(); +#ifndef MOVEMENT_LOW_ENERGY_MODE_FORBIDDEN // if we have timed out of our low energy mode countdown, enter low energy mode. if (movement_state.le_mode_ticks == 0) { movement_state.le_mode_ticks = -1; @@ -848,6 +857,7 @@ bool app_loop(void) { // need to figure out if there's a better heuristic for determining how we woke up. app_setup(); } +#endif // default to being allowed to sleep by the face. bool can_sleep = true; diff --git a/watch-faces/settings/settings_face.c b/watch-faces/settings/settings_face.c index 7d1b392c..0a17985a 100644 --- a/watch-faces/settings/settings_face.c +++ b/watch-faces/settings/settings_face.c @@ -243,12 +243,15 @@ void settings_face_setup(uint8_t watch_face_index, void ** context_ptr) { state->settings_screens[current_setting].display = timeout_setting_display; state->settings_screens[current_setting].advance = timeout_setting_advance; current_setting++; +#ifndef MOVEMENT_LOW_ENERGY_MODE_FORBIDDEN state->settings_screens[current_setting].display = low_energy_setting_display; state->settings_screens[current_setting].advance = low_energy_setting_advance; current_setting++; +#endif state->settings_screens[current_setting].display = led_duration_setting_display; state->settings_screens[current_setting].advance = led_duration_setting_advance; current_setting++; + state->led_color_start = current_setting; #ifdef WATCH_RED_TCC_CHANNEL state->settings_screens[current_setting].display = red_led_setting_display; state->settings_screens[current_setting].advance = red_led_setting_advance; @@ -308,7 +311,7 @@ bool settings_face_loop(movement_event_t event, void *context) { return movement_default_loop_handler(event); } - if (state->current_page > 4) { + if (state->current_page >= state->led_color_start) { movement_color_t color = movement_backlight_color(); // this bitwise math turns #000 into #000000, #111 into #111111, etc. movement_force_led_on(color.red | color.red << 4, diff --git a/watch-faces/settings/settings_face.h b/watch-faces/settings/settings_face.h index 7f47ff7c..26a31d5d 100644 --- a/watch-faces/settings/settings_face.h +++ b/watch-faces/settings/settings_face.h @@ -80,6 +80,7 @@ typedef struct { typedef struct { int8_t current_page; int8_t num_settings; + int8_t led_color_start; settings_screen_t *settings_screens; } settings_state_t;