Browse Source

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 9 months ago
parent
commit
04450ec775
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      src/main.c

+ 11
- 1
src/main.c View File

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

Loading…
Cancel
Save