Various fixes for DUE... (#10152)

- Watchdog reset during SD Card initialization.
- Move `DebugMonitor` to `DebugMonitor_Due.cpp`.
- Since the watchdog is enabled on boot do extra resets during init.
- Have `thermalManager` do watchdog reset before its ISR starts to prevent reset.
- Ensure that timers are stopped before reprogramming them to address tone issues.
- Improve SAM3XE reset when reflashed through the native port.
This commit is contained in:
Eduardo José Tagle
2018-03-21 21:04:45 -03:00
committed by Scott Lahteine
parent c3c264978f
commit 97e8a6ebd9
23 changed files with 441 additions and 60 deletions

View File

@ -117,6 +117,10 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
// private:
#if EARLY_WATCHDOG
bool Temperature::inited = false;
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
uint16_t Temperature::redundant_temperature_raw = 0;
float Temperature::redundant_temperature = 0.0;
@ -761,6 +765,14 @@ float Temperature::get_pid_output(const int8_t e) {
*/
void Temperature::manage_heater() {
#if EARLY_WATCHDOG
// If thermal manager is still not running, make sure to at least reset the watchdog!
if (!inited) {
watchdog_reset();
return;
}
#endif
#if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
static bool last_pause_state;
#endif
@ -1053,6 +1065,12 @@ void Temperature::updateTemperaturesFromRawValues() {
*/
void Temperature::init() {
#if EARLY_WATCHDOG
// Flag that the thermalManager should be running
if (inited) return;
inited = true;
#endif
#if MB(RUMBA) && (TEMP_SENSOR_0 == -1 || TEMP_SENSOR_1 == -1 || TEMP_SENSOR_2 == -1 || TEMP_SENSOR_BED == -1)
// Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR = _BV(JTD);

View File

@ -202,6 +202,11 @@ class Temperature {
private:
#if EARLY_WATCHDOG
// If temperature controller is running
static bool inited;
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static uint16_t redundant_temperature_raw;
static float redundant_temperature;