瀏覽代碼

run state machine for testing periodically.

Thomas Buck 1 年之前
父節點
當前提交
17c4cf73ba
共有 2 個檔案被更改,包括 9 行新增0 行删除
  1. 1
    0
      src/main.c
  2. 8
    0
      src/state.c

+ 1
- 0
src/main.c 查看文件

93
         cnsl_run();
93
         cnsl_run();
94
 
94
 
95
         battery_run();
95
         battery_run();
96
+        state_run();
96
     }
97
     }
97
 
98
 
98
     return 0;
99
     return 0;

+ 8
- 0
src/state.c 查看文件

59
 }
59
 }
60
 
60
 
61
 void state_run(void) {
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
     static struct text_font font = {
70
     static struct text_font font = {
63
         .fontname = "fixed_10x20",
71
         .fontname = "fixed_10x20",
64
         .font = NULL,
72
         .font = NULL,

Loading…
取消
儲存