瀏覽代碼

enable watchdog as early as possible.

sometimes ble init seems to fail somehow.
this caused hangs at different points in time.
with this change the device at least resets relatively quickly.
Thomas Buck 1 年之前
父節點
當前提交
04450ec775
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11
    1
      src/main.c

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

@@ -47,6 +47,8 @@ void main_loop_hw(void) {
47 47
 }
48 48
 
49 49
 int main(void) {
50
+    watchdog_enable(WATCHDOG_PERIOD_MS, 1);
51
+
50 52
     // required for debug console
51 53
     cnsl_init();
52 54
     serial_init();
@@ -57,6 +59,10 @@ int main(void) {
57 59
 
58 60
     debug("lcd_init");
59 61
     lcd_init();
62
+
63
+    watchdog_update();
64
+
65
+    debug("draw_splash");
60 66
     draw_splash();
61 67
     lcd_set_backlight(mem_data()->backlight);
62 68
 
@@ -75,8 +81,12 @@ int main(void) {
75 81
     debug("cyw43_arch_init");
76 82
     if (cyw43_arch_init()) {
77 83
         debug("cyw43_arch_init failed");
84
+        lcd_set_backlight(0x00FF);
85
+        while (1) {}
78 86
     }
79 87
 
88
+    watchdog_update();
89
+
80 90
     debug("heartbeat_init");
81 91
     heartbeat_init();
82 92
 
@@ -93,7 +103,7 @@ int main(void) {
93 103
     msc_set_medium_available(true);
94 104
 #endif // AUTO_MOUNT_MASS_STORAGE
95 105
 
96
-    watchdog_enable(WATCHDOG_PERIOD_MS, 1);
106
+    watchdog_update();
97 107
 
98 108
     debug("init done");
99 109
     battery_run();

Loading…
取消
儲存