Watchdog cleanup (#15283)
This commit is contained in:
		
							parent
							
								
									24706aedbd
								
							
						
					
					
						commit
						139b7196a0
					
				| @ -24,3 +24,9 @@ | |||||||
| #include "platforms.h" | #include "platforms.h" | ||||||
| 
 | 
 | ||||||
| #include HAL_PATH(.,HAL.h) | #include HAL_PATH(.,HAL.h) | ||||||
|  | 
 | ||||||
|  | inline void watchdog_refresh() { | ||||||
|  |   #if ENABLED(USE_WATCHDOG) | ||||||
|  |     HAL_watchdog_refresh(); | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  | |||||||
| @ -28,4 +28,4 @@ void watchdog_init(); | |||||||
| 
 | 
 | ||||||
| // Reset watchdog. MUST be called at least every 4 seconds after the
 | // Reset watchdog. MUST be called at least every 4 seconds after the
 | ||||||
| // first watchdog_init or AVR will go into emergency procedures.
 | // first watchdog_init or AVR will go into emergency procedures.
 | ||||||
| inline void watchdog_reset() { wdt_reset(); } | inline void HAL_watchdog_refresh() { wdt_reset(); } | ||||||
|  | |||||||
| @ -30,4 +30,4 @@ void watchdog_init(); | |||||||
| 
 | 
 | ||||||
| // Reset watchdog. MUST be called at least every 4 seconds after the
 | // Reset watchdog. MUST be called at least every 4 seconds after the
 | ||||||
| // first watchdog_init or AVR will go into emergency procedures.
 | // first watchdog_init or AVR will go into emergency procedures.
 | ||||||
| inline void watchdog_reset() { watchdogReset(); } | inline void HAL_watchdog_refresh() { watchdogReset(); } | ||||||
|  | |||||||
| @ -25,4 +25,4 @@ | |||||||
| void watchdog_init(); | void watchdog_init(); | ||||||
| 
 | 
 | ||||||
| // Reset watchdog.
 | // Reset watchdog.
 | ||||||
| inline void watchdog_reset() { } | inline void HAL_watchdog_refresh() { } | ||||||
|  | |||||||
| @ -97,6 +97,10 @@ void HAL_adc_enable_channel(int pin); | |||||||
| void HAL_adc_start_conversion(const uint8_t adc_pin); | void HAL_adc_start_conversion(const uint8_t adc_pin); | ||||||
| uint16_t HAL_adc_get_result(); | uint16_t HAL_adc_get_result(); | ||||||
| 
 | 
 | ||||||
|  | // Reset source
 | ||||||
|  | inline void HAL_clear_reset_source(void) {} | ||||||
|  | inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } | ||||||
|  | 
 | ||||||
| /* ---------------- Delay in cycles */ | /* ---------------- Delay in cycles */ | ||||||
| FORCE_INLINE static void DELAY_CYCLES(uint64_t x) { | FORCE_INLINE static void DELAY_CYCLES(uint64_t x) { | ||||||
|   Clock::delayCycles(x); |   Clock::delayCycles(x); | ||||||
|  | |||||||
| @ -29,18 +29,8 @@ | |||||||
| #include "watchdog.h" | #include "watchdog.h" | ||||||
| 
 | 
 | ||||||
| void watchdog_init() {} | void watchdog_init() {} | ||||||
|  | void HAL_watchdog_refresh() {} | ||||||
| 
 | 
 | ||||||
| void HAL_clear_reset_source() {} | #endif | ||||||
| 
 |  | ||||||
| uint8_t HAL_get_reset_source() { |  | ||||||
|   return RST_POWER_ON; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void watchdog_reset() {} |  | ||||||
| 
 |  | ||||||
| #else |  | ||||||
|   void HAL_clear_reset_source() {} |  | ||||||
|   uint8_t HAL_get_reset_source() { return RST_POWER_ON; } |  | ||||||
| #endif // USE_WATCHDOG
 |  | ||||||
| 
 | 
 | ||||||
| #endif // __PLAT_LINUX__
 | #endif // __PLAT_LINUX__
 | ||||||
|  | |||||||
| @ -24,6 +24,4 @@ | |||||||
| #define WDT_TIMEOUT   4000000 // 4 second timeout
 | #define WDT_TIMEOUT   4000000 // 4 second timeout
 | ||||||
| 
 | 
 | ||||||
| void watchdog_init(); | void watchdog_init(); | ||||||
| void watchdog_reset(); | void HAL_watchdog_refresh(); | ||||||
| void HAL_clear_reset_source(); |  | ||||||
| uint8_t HAL_get_reset_source(); |  | ||||||
|  | |||||||
| @ -26,6 +26,10 @@ | |||||||
| #include "../shared/Delay.h" | #include "../shared/Delay.h" | ||||||
| #include "../../../gcode/parser.h" | #include "../../../gcode/parser.h" | ||||||
| 
 | 
 | ||||||
|  | #if ENABLED(USE_WATCHDOG) | ||||||
|  |   #include "watchdog.h" | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| // U8glib required functions
 | // U8glib required functions
 | ||||||
| extern "C" void u8g_xMicroDelay(uint16_t val) { | extern "C" void u8g_xMicroDelay(uint16_t val) { | ||||||
|   DELAY_US(val); |   DELAY_US(val); | ||||||
| @ -65,4 +69,17 @@ void flashFirmware(int16_t value) { | |||||||
|   NVIC_SystemReset(); |   NVIC_SystemReset(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void HAL_clear_reset_source(void) { | ||||||
|  |   #if ENABLED(USE_WATCHDOG) | ||||||
|  |     watchdog_clear_timeout_flag(); | ||||||
|  |   #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | uint8_t HAL_get_reset_source(void) { | ||||||
|  |   #if ENABLED(USE_WATCHDOG) | ||||||
|  |     if (watchdog_timed_out()) return RST_WATCHDOG; | ||||||
|  |   #endif | ||||||
|  |   return RST_POWER_ON; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| #endif // TARGET_LPC1768
 | #endif // TARGET_LPC1768
 | ||||||
|  | |||||||
| @ -164,3 +164,7 @@ void set_pwm_frequency(const pin_t pin, int f_desired); | |||||||
|  *  Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255] |  *  Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255] | ||||||
|  */ |  */ | ||||||
| void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false); | void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false); | ||||||
|  | 
 | ||||||
|  | // Reset source
 | ||||||
|  | void HAL_clear_reset_source(void); | ||||||
|  | uint8_t HAL_get_reset_source(void); | ||||||
|  | |||||||
| @ -56,28 +56,16 @@ void watchdog_init() { | |||||||
|   WDT_Start(WDT_TIMEOUT); |   WDT_Start(WDT_TIMEOUT); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HAL_clear_reset_source() { | void HAL_watchdog_refresh() { | ||||||
|   WDT_ClrTimeOutFlag(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| uint8_t HAL_get_reset_source() { |  | ||||||
|   if (TEST(WDT_ReadTimeOutFlag(), 0)) return RST_WATCHDOG; |  | ||||||
|   return RST_POWER_ON; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void watchdog_reset() { |  | ||||||
|   WDT_Feed(); |   WDT_Feed(); | ||||||
|   #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) |   #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) | ||||||
|     TOGGLE(LED_PIN);  // heartbeat indicator
 |     TOGGLE(LED_PIN);  // heartbeat indicator
 | ||||||
|   #endif |   #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #else | // Timeout state
 | ||||||
| 
 | bool watchdog_timed_out() { return TEST(WDT_ReadTimeOutFlag(), 0); } | ||||||
| void watchdog_init() {} | void watchdog_clear_timeout_flag() { WDT_ClrTimeOutFlag(); } | ||||||
| void watchdog_reset() {} |  | ||||||
| void HAL_clear_reset_source() {} |  | ||||||
| uint8_t HAL_get_reset_source() { return RST_POWER_ON; } |  | ||||||
| 
 | 
 | ||||||
| #endif // USE_WATCHDOG
 | #endif // USE_WATCHDOG
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ | |||||||
| #define WDT_TIMEOUT   4000000 // 4 second timeout
 | #define WDT_TIMEOUT   4000000 // 4 second timeout
 | ||||||
| 
 | 
 | ||||||
| void watchdog_init(); | void watchdog_init(); | ||||||
| void watchdog_reset(); | void HAL_watchdog_refresh(); | ||||||
| void HAL_clear_reset_source(); | 
 | ||||||
| uint8_t HAL_get_reset_source(); | bool watchdog_timed_out(); | ||||||
|  | void watchdog_clear_timeout_flag(); | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ | |||||||
|     WDT->INTENCLR.reg = WDT_INTENCLR_EW;        // Disable early warning interrupt
 |     WDT->INTENCLR.reg = WDT_INTENCLR_EW;        // Disable early warning interrupt
 | ||||||
|     WDT->CONFIG.reg = WDT_CONFIG_PER_CYC4096;   // Set at least 4s period for chip reset
 |     WDT->CONFIG.reg = WDT_CONFIG_PER_CYC4096;   // Set at least 4s period for chip reset
 | ||||||
| 
 | 
 | ||||||
|     watchdog_reset(); |     HAL_watchdog_refresh(); | ||||||
| 
 | 
 | ||||||
|     WDT->CTRLA.reg = WDT_CTRLA_ENABLE;          // Start watchdog now in normal mode
 |     WDT->CTRLA.reg = WDT_CTRLA_ENABLE;          // Start watchdog now in normal mode
 | ||||||
|     SYNC(WDT->SYNCBUSY.bit.ENABLE); |     SYNC(WDT->SYNCBUSY.bit.ENABLE); | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ void watchdog_init(); | |||||||
| 
 | 
 | ||||||
| // Reset watchdog. MUST be called at least every 4 seconds after the
 | // Reset watchdog. MUST be called at least every 4 seconds after the
 | ||||||
| // first watchdog_init or SAMD will go into emergency procedures.
 | // first watchdog_init or SAMD will go into emergency procedures.
 | ||||||
| inline void watchdog_reset() { | inline void HAL_watchdog_refresh() { | ||||||
|   SYNC(WDT->SYNCBUSY.bit.CLEAR);        // Test first if previous is 'ongoing' to save time waiting for command execution
 |   SYNC(WDT->SYNCBUSY.bit.CLEAR);        // Test first if previous is 'ongoing' to save time waiting for command execution
 | ||||||
|   WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY; |   WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY; | ||||||
| } | } | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ | |||||||
| 
 | 
 | ||||||
|   void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout
 |   void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout
 | ||||||
| 
 | 
 | ||||||
|   void watchdog_reset() { |   void HAL_watchdog_refresh() { | ||||||
|     IWatchdog.reload(); |     IWatchdog.reload(); | ||||||
|     #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) |     #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) | ||||||
|       TOGGLE(LED_PIN);  // heartbeat indicator
 |       TOGGLE(LED_PIN);  // heartbeat indicator
 | ||||||
|  | |||||||
| @ -22,4 +22,4 @@ | |||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| void watchdog_init(); | void watchdog_init(); | ||||||
| void watchdog_reset(); | void HAL_watchdog_refresh(); | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ | |||||||
| #include <libmaple/iwdg.h> | #include <libmaple/iwdg.h> | ||||||
| #include "watchdog.h" | #include "watchdog.h" | ||||||
| 
 | 
 | ||||||
| void watchdog_reset() { | void HAL_watchdog_refresh() { | ||||||
|   #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) |   #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) | ||||||
|     TOGGLE(LED_PIN);  // heartbeat indicator
 |     TOGGLE(LED_PIN);  // heartbeat indicator
 | ||||||
|   #endif |   #endif | ||||||
|  | |||||||
| @ -41,4 +41,4 @@ void watchdog_init(); | |||||||
| 
 | 
 | ||||||
| // Reset watchdog. MUST be called at least every 4 seconds after the
 | // Reset watchdog. MUST be called at least every 4 seconds after the
 | ||||||
| // first watchdog_init or STM32F1 will reset.
 | // first watchdog_init or STM32F1 will reset.
 | ||||||
| void watchdog_reset(); | void HAL_watchdog_refresh(); | ||||||
|  | |||||||
| @ -44,7 +44,7 @@ | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   void watchdog_reset() { |   void HAL_watchdog_refresh() { | ||||||
|     /* Refresh IWDG: reload counter */ |     /* Refresh IWDG: reload counter */ | ||||||
|     if (HAL_IWDG_Refresh(&hiwdg) != HAL_OK) { |     if (HAL_IWDG_Refresh(&hiwdg) != HAL_OK) { | ||||||
|       /* Refresh Error */ |       /* Refresh Error */ | ||||||
|  | |||||||
| @ -24,4 +24,4 @@ | |||||||
| extern IWDG_HandleTypeDef hiwdg; | extern IWDG_HandleTypeDef hiwdg; | ||||||
| 
 | 
 | ||||||
| void watchdog_init(); | void watchdog_init(); | ||||||
| void watchdog_reset(); | void HAL_watchdog_refresh(); | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ | |||||||
| 
 | 
 | ||||||
| void watchdog_init(); | void watchdog_init(); | ||||||
| 
 | 
 | ||||||
| inline void watchdog_reset() { | inline void HAL_watchdog_refresh() { | ||||||
|   // Watchdog refresh sequence
 |   // Watchdog refresh sequence
 | ||||||
|   WDOG_REFRESH = 0xA602; |   WDOG_REFRESH = 0xA602; | ||||||
|   WDOG_REFRESH = 0xB480; |   WDOG_REFRESH = 0xB480; | ||||||
|  | |||||||
| @ -23,7 +23,7 @@ | |||||||
| 
 | 
 | ||||||
| void watchdog_init(); | void watchdog_init(); | ||||||
| 
 | 
 | ||||||
| inline void watchdog_reset() { | inline void HAL_watchdog_refresh() { | ||||||
|   // Watchdog refresh sequence
 |   // Watchdog refresh sequence
 | ||||||
|   WDOG_REFRESH = 0xA602; |   WDOG_REFRESH = 0xA602; | ||||||
|   WDOG_REFRESH = 0xB480; |   WDOG_REFRESH = 0xB480; | ||||||
|  | |||||||
| @ -801,29 +801,17 @@ void minkill(const bool steppers_off/*=false*/) { | |||||||
|   #if HAS_KILL |   #if HAS_KILL | ||||||
| 
 | 
 | ||||||
|     // Wait for kill to be released
 |     // Wait for kill to be released
 | ||||||
|     while (!READ(KILL_PIN)) { |     while (!READ(KILL_PIN)) watchdog_refresh(); | ||||||
|       #if ENABLED(USE_WATCHDOG) |  | ||||||
|         watchdog_reset(); |  | ||||||
|       #endif |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     // Wait for kill to be pressed
 |     // Wait for kill to be pressed
 | ||||||
|     while (READ(KILL_PIN)) { |     while (READ(KILL_PIN)) watchdog_refresh(); | ||||||
|       #if ENABLED(USE_WATCHDOG) |  | ||||||
|         watchdog_reset(); |  | ||||||
|       #endif |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     void (*resetFunc)() = 0;  // Declare resetFunc() at address 0
 |     void (*resetFunc)() = 0;  // Declare resetFunc() at address 0
 | ||||||
|     resetFunc();                  // Jump to address 0
 |     resetFunc();                  // Jump to address 0
 | ||||||
| 
 | 
 | ||||||
|   #else // !HAS_KILL
 |   #else // !HAS_KILL
 | ||||||
| 
 | 
 | ||||||
|     for (;;) { |     for (;;) watchdog_refresh(); // Wait for reset
 | ||||||
|       #if ENABLED(USE_WATCHDOG) |  | ||||||
|         watchdog_reset(); |  | ||||||
|       #endif |  | ||||||
|     } // Wait for reset
 |  | ||||||
| 
 | 
 | ||||||
|   #endif // !HAS_KILL
 |   #endif // !HAS_KILL
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -50,12 +50,6 @@ | |||||||
|   #define GET_PIN_MAP_PIN_M43(Q) GET_PIN_MAP_PIN(Q) |   #define GET_PIN_MAP_PIN_M43(Q) GET_PIN_MAP_PIN(Q) | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| inline void _watchdog_reset() { |  | ||||||
|   #if ENABLED(USE_WATCHDOG) |  | ||||||
|     watchdog_reset(); |  | ||||||
|   #endif |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline void toggle_pins() { | inline void toggle_pins() { | ||||||
|   const bool ignore_protection = parser.boolval('I'); |   const bool ignore_protection = parser.boolval('I'); | ||||||
|   const int repeat = parser.intval('R', 1), |   const int repeat = parser.intval('R', 1), | ||||||
| @ -71,7 +65,7 @@ inline void toggle_pins() { | |||||||
|       SERIAL_EOL(); |       SERIAL_EOL(); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|       _watchdog_reset(); |       watchdog_refresh(); | ||||||
|       report_pin_state_extended(pin, ignore_protection, true, "Pulsing   "); |       report_pin_state_extended(pin, ignore_protection, true, "Pulsing   "); | ||||||
|       #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
 |       #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
 | ||||||
|         if (pin == TEENSY_E2) { |         if (pin == TEENSY_E2) { | ||||||
| @ -95,10 +89,10 @@ inline void toggle_pins() { | |||||||
|       { |       { | ||||||
|         pinMode(pin, OUTPUT); |         pinMode(pin, OUTPUT); | ||||||
|         for (int16_t j = 0; j < repeat; j++) { |         for (int16_t j = 0; j < repeat; j++) { | ||||||
|           _watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); |           watchdog_refresh(); extDigitalWrite(pin, 0); safe_delay(wait); | ||||||
|           _watchdog_reset(); extDigitalWrite(pin, 1); safe_delay(wait); |           watchdog_refresh(); extDigitalWrite(pin, 1); safe_delay(wait); | ||||||
|           _watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); |           watchdog_refresh(); extDigitalWrite(pin, 0); safe_delay(wait); | ||||||
|           _watchdog_reset(); |           watchdog_refresh(); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -258,7 +258,7 @@ void GcodeSuite::M917() { | |||||||
|         } |         } | ||||||
|         DEBUG_ECHOLNPGM("."); |         DEBUG_ECHOLNPGM("."); | ||||||
|         reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
 |         reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
 | ||||||
|         watchdog_reset();   // beat the dog
 |         watchdog_refresh(); | ||||||
|         safe_delay(5000); |         safe_delay(5000); | ||||||
|         status_composite_temp = 0; |         status_composite_temp = 0; | ||||||
|         for (j = 0; j < driver_count; j++) { |         for (j = 0; j < driver_count; j++) { | ||||||
|  | |||||||
| @ -1000,7 +1000,7 @@ void Temperature::manage_heater() { | |||||||
| 
 | 
 | ||||||
|   #if EARLY_WATCHDOG |   #if EARLY_WATCHDOG | ||||||
|     // If thermal manager is still not running, make sure to at least reset the watchdog!
 |     // If thermal manager is still not running, make sure to at least reset the watchdog!
 | ||||||
|     if (!inited) return watchdog_reset(); |     if (!inited) return watchdog_refresh(); | ||||||
|   #endif |   #endif | ||||||
| 
 | 
 | ||||||
|   #if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING) |   #if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING) | ||||||
| @ -1518,10 +1518,8 @@ void Temperature::updateTemperaturesFromRawValues() { | |||||||
|     filwidth.update_measured_mm(); |     filwidth.update_measured_mm(); | ||||||
|   #endif |   #endif | ||||||
| 
 | 
 | ||||||
|   #if ENABLED(USE_WATCHDOG) |   // Reset the watchdog on good temperature measurement
 | ||||||
|     // Reset the watchdog after we know we have a temperature measurement.
 |   watchdog_refresh(); | ||||||
|     watchdog_reset(); |  | ||||||
|   #endif |  | ||||||
| 
 | 
 | ||||||
|   temp_meas_ready = false; |   temp_meas_ready = false; | ||||||
| } | } | ||||||
|  | |||||||
| @ -234,11 +234,7 @@ bool Sd2Card::init(const uint8_t sckRateID, const pin_t chipSelectPin) { | |||||||
|   const millis_t init_timeout = millis() + SD_INIT_TIMEOUT; |   const millis_t init_timeout = millis() + SD_INIT_TIMEOUT; | ||||||
|   uint32_t arg; |   uint32_t arg; | ||||||
| 
 | 
 | ||||||
|   // If init takes more than 4s it could trigger
 |   watchdog_refresh(); // In case init takes too long
 | ||||||
|   // watchdog leading to a reboot loop.
 |  | ||||||
|   #if ENABLED(USE_WATCHDOG) |  | ||||||
|     watchdog_reset(); |  | ||||||
|   #endif |  | ||||||
| 
 | 
 | ||||||
|   // Set pin modes
 |   // Set pin modes
 | ||||||
|   extDigitalWrite(chipSelectPin_, HIGH);  // For some CPUs pinMode can write the wrong data so init desired data value first
 |   extDigitalWrite(chipSelectPin_, HIGH);  // For some CPUs pinMode can write the wrong data so init desired data value first
 | ||||||
| @ -252,10 +248,7 @@ bool Sd2Card::init(const uint8_t sckRateID, const pin_t chipSelectPin) { | |||||||
|   // Must supply min of 74 clock cycles with CS high.
 |   // Must supply min of 74 clock cycles with CS high.
 | ||||||
|   for (uint8_t i = 0; i < 10; i++) spiSend(0xFF); |   for (uint8_t i = 0; i < 10; i++) spiSend(0xFF); | ||||||
| 
 | 
 | ||||||
|   // Initialization can cause the watchdog to timeout, so reinit it here
 |   watchdog_refresh(); // In case init takes too long
 | ||||||
|   #if ENABLED(USE_WATCHDOG) |  | ||||||
|     watchdog_reset(); |  | ||||||
|   #endif |  | ||||||
| 
 | 
 | ||||||
|   // Command to go idle in SPI mode
 |   // Command to go idle in SPI mode
 | ||||||
|   while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) { |   while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) { | ||||||
| @ -269,10 +262,7 @@ bool Sd2Card::init(const uint8_t sckRateID, const pin_t chipSelectPin) { | |||||||
|     crcSupported = (cardCommand(CMD59, 1) == R1_IDLE_STATE); |     crcSupported = (cardCommand(CMD59, 1) == R1_IDLE_STATE); | ||||||
|   #endif |   #endif | ||||||
| 
 | 
 | ||||||
|   // Initialization can cause the watchdog to timeout, so reinit it here
 |   watchdog_refresh(); // In case init takes too long
 | ||||||
|   #if ENABLED(USE_WATCHDOG) |  | ||||||
|     watchdog_reset(); |  | ||||||
|   #endif |  | ||||||
| 
 | 
 | ||||||
|   // check SD version
 |   // check SD version
 | ||||||
|   for (;;) { |   for (;;) { | ||||||
| @ -294,10 +284,7 @@ bool Sd2Card::init(const uint8_t sckRateID, const pin_t chipSelectPin) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Initialization can cause the watchdog to timeout, so reinit it here
 |   watchdog_refresh(); // In case init takes too long
 | ||||||
|   #if ENABLED(USE_WATCHDOG) |  | ||||||
|     watchdog_reset(); |  | ||||||
|   #endif |  | ||||||
| 
 | 
 | ||||||
|   // Initialize card and send host supports SDHC if SD2
 |   // Initialize card and send host supports SDHC if SD2
 | ||||||
|   arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0; |   arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0; | ||||||
|  | |||||||
| @ -25,6 +25,7 @@ opt_set TEMP_SENSOR_1 1 | |||||||
| opt_set TEMP_SENSOR_BED 2 | opt_set TEMP_SENSOR_BED 2 | ||||||
| opt_set GRID_MAX_POINTS_X 16 | opt_set GRID_MAX_POINTS_X 16 | ||||||
| opt_set FANMUX0_PIN 53 | opt_set FANMUX0_PIN 53 | ||||||
|  | opt_disable USE_WATCHDOG | ||||||
| opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ | opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ | ||||||
|            PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING \ |            PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING \ | ||||||
|            EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ |            EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ | ||||||
|  | |||||||
| @ -591,7 +591,7 @@ monitor_speed     = 250000 | |||||||
| # | # | ||||||
| [env:linux_native] | [env:linux_native] | ||||||
| platform        = native | platform        = native | ||||||
| build_flags     = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ | build_flags     = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined | ||||||
| src_build_flags = -Wall -IMarlin/src/HAL/HAL_LINUX/include | src_build_flags = -Wall -IMarlin/src/HAL/HAL_LINUX/include | ||||||
| build_unflags   = -Wall | build_unflags   = -Wall | ||||||
| lib_ldf_mode    = off | lib_ldf_mode    = off | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user