Browse Source

run state machine for testing periodically.

Thomas Buck 7 months ago
parent
commit
17c4cf73ba
2 changed files with 9 additions and 0 deletions
  1. 1
    0
      src/main.c
  2. 8
    0
      src/state.c

+ 1
- 0
src/main.c View File

@@ -93,6 +93,7 @@ int main(void) {
93 93
         cnsl_run();
94 94
 
95 95
         battery_run();
96
+        state_run();
96 97
     }
97 98
 
98 99
     return 0;

+ 8
- 0
src/state.c View File

@@ -59,6 +59,14 @@ void state_switch(enum system_state next) {
59 59
 }
60 60
 
61 61
 void state_run(void) {
62
+    // TODO only for testing
63
+    static uint32_t last_heartbeat = 0;
64
+    uint32_t now = to_ms_since_boot(get_absolute_time());
65
+    if (now < (last_heartbeat + 1000)) {
66
+        return;
67
+    }
68
+    last_heartbeat = now;
69
+
62 70
     static struct text_font font = {
63 71
         .fontname = "fixed_10x20",
64 72
         .font = NULL,

Loading…
Cancel
Save