]> git.earman.xyz Git - sensor-watch.git/commitdiff
Holding light button on a non-element screen will turn on the light (#2)
authorvoloved <36523934+voloved@users.noreply.github.com>
Thu, 25 Jul 2024 13:18:56 +0000 (09:18 -0400)
committerGitHub <noreply@github.com>
Thu, 25 Jul 2024 13:18:56 +0000 (14:18 +0100)
* 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

movement/watch_faces/complication/periodic_face.c
movement/watch_faces/complication/periodic_face.h

index 162d3e42904ef43b1be60ff95ff48801e01ec648..85753ffbc54e55687d0d84942f1b5c75e6ec415c 100644 (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;
 }
 
index c310082452fbea13a1ece6eb4e436132896311dd..730b0fe0b89db5c25f2d9d4063073efe93bdb77d 100644 (file)
  *    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