浏览代码

Merge pull request #5681 from thinkyhead/rc_prevent_boot_loop

Reset watchdog in SD init to prevent reboot
Scott Lahteine 8 年前
父节点
当前提交
7a9c1a279b
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10
    0
      Marlin/Sd2Card.cpp

+ 10
- 0
Marlin/Sd2Card.cpp 查看文件

@@ -31,6 +31,10 @@
31 31
 #if ENABLED(SDSUPPORT)
32 32
 #include "Sd2Card.h"
33 33
 
34
+#if ENABLED(USE_WATCHDOG)
35
+  #include "watchdog.h"
36
+#endif
37
+
34 38
 //------------------------------------------------------------------------------
35 39
 #if DISABLED(SOFTWARE_SPI)
36 40
   // functions for hardware SPI
@@ -299,6 +303,12 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
299 303
   uint16_t t0 = (uint16_t)millis();
300 304
   uint32_t arg;
301 305
 
306
+  // If init takes more than 4s it could trigger
307
+  // watchdog leading to a reboot loop.
308
+  #if ENABLED(USE_WATCHDOG)
309
+    watchdog_reset();
310
+  #endif
311
+
302 312
   // set pin modes
303 313
   pinMode(chipSelectPin_, OUTPUT);
304 314
   chipSelectHigh();

正在加载...
取消
保存