Holding light button on a non-element screen will turn on the light (#2)

* Holding light button on a non-element screen will turn on the light.

* The alarm and led button press moves back to the currently-selected element symbol page rather than the next and previous one

* Usage update
This commit is contained in:
voloved 2024-07-25 09:18:56 -04:00 committed by GitHub
parent cb90a1980f
commit 6e26c01de0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 31 deletions

View file

@ -35,7 +35,6 @@ static uint8_t _ts_ticks = 0;
static int16_t _text_pos;
static const char* _text_looping;
static const char title_text[] = "Periodic Table";
static bool _led_on = false;
void periodic_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr)
{
@ -412,38 +411,39 @@ bool periodic_face_loop(movement_event_t event, movement_settings_t *settings, v
_handle_mode_still_pressed(state, settings->bit.button_should_sound);
break;
case EVENT_LIGHT_BUTTON_UP:
if (!_led_on) _handle_backward(state, settings->bit.button_should_sound);
if (!watch_get_pin_level(BTN_ALARM)) _led_on = false;
if (state->mode <= SCREEN_ELEMENT) {
_handle_backward(state, settings->bit.button_should_sound);
}
else {
state->mode = SCREEN_ELEMENT;
_display_screen(state, settings->bit.button_should_sound);
}
break;
case EVENT_LIGHT_BUTTON_DOWN:
break;
case EVENT_ALARM_BUTTON_UP:
if (!_led_on) _handle_forward(state, settings->bit.button_should_sound);
if (!watch_get_pin_level(BTN_LIGHT)) _led_on = false;
if (state->mode <= SCREEN_ELEMENT) {
_handle_forward(state, settings->bit.button_should_sound);
}
else {
state->mode = SCREEN_ELEMENT;
_display_screen(state, settings->bit.button_should_sound);
}
break;
case EVENT_ALARM_LONG_PRESS:
if (!_led_on) {
if (state->mode <= SCREEN_ELEMENT) {
start_quick_cyc();
_handle_forward(state, settings->bit.button_should_sound);
}
break;
case EVENT_LIGHT_LONG_PRESS:
if (!_led_on) {
if (state->mode <= SCREEN_ELEMENT) {
start_quick_cyc();
_handle_backward(state, settings->bit.button_should_sound);
}
break;
case EVENT_LIGHT_BUTTON_DOWN:
if (watch_get_pin_level(BTN_ALARM)) _led_on = true;
stop_quick_cyc();
break;
case EVENT_ALARM_BUTTON_DOWN:
if (watch_get_pin_level(BTN_LIGHT)) _led_on = true;
stop_quick_cyc();
break;
case EVENT_LIGHT_LONG_UP:
_led_on = false;
break;
case EVENT_ALARM_LONG_UP:
_led_on = false;
else {
movement_illuminate_led();
}
break;
case EVENT_MODE_BUTTON_UP:
if (state->mode == SCREEN_TITLE) movement_move_to_next_face();
@ -488,8 +488,6 @@ bool periodic_face_loop(movement_event_t event, movement_settings_t *settings, v
return movement_default_loop_handler(event, settings);
}
if (_led_on) movement_illuminate_led();
return true;
}

View file

@ -50,18 +50,17 @@
* If you are in a subscreen and just keep holding MODE, you will go through all of these menus without needing to depress.
*
* Light Press
* Previous Element
* On Title or Element Symbol Screen: Previous Element
* Else: Display currenlt-selected element symbol page
* Light Hold
* Fast Cycle through Previous Elements
* On Title Screen or Element Symbol: Fast Cycle through Previous Elements
* Else: Activate LED backlight
*
* Alarm Press
* Next Element
* On Title or Element Symbol Screen: Next Element
* Else: Display currenlt-selected element symbol page
* Alarm Hold
* Fast Cycle through Next Elements
*
* Light & Alarm Hold
* Activate LED backlight
*
* On Title Screen or Element Symbol: Fast Cycle through Next Elements
*/
#define MODE_VIEW 0