mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-19 09:42:11 +03:00
changed auto-reset logic for Leonardo. only do WDT manipulation if the port is opened at 1200 bps. (Dave Mellis)
This commit is contained in:
@ -106,10 +106,10 @@ bool WEAK CDC_Setup(Setup& setup)
|
|||||||
// open at 1200 bps, is closed. this is the signal to start the watchdog
|
// open at 1200 bps, is closed. this is the signal to start the watchdog
|
||||||
// with a relatively long period so it can finish housekeeping tasks
|
// with a relatively long period so it can finish housekeeping tasks
|
||||||
// like servicing endpoints before the sketch ends
|
// like servicing endpoints before the sketch ends
|
||||||
|
if (1200 == _usbLineInfo.dwDTERate) {
|
||||||
// We check DTR state to determine if host port is open (bit 0 of lineState).
|
// We check DTR state to determine if host port is open (bit 0 of lineState).
|
||||||
// Serial1.print(">"); Serial1.println(_usbLineInfo.lineState, HEX);
|
// Serial1.print(">"); Serial1.println(_usbLineInfo.lineState, HEX);
|
||||||
if ((_usbLineInfo.lineState & 0x01) == 0 && _usbLineInfo.dwDTERate == 1200) {
|
if ((_usbLineInfo.lineState & 0x01) == 0) {
|
||||||
*(uint16_t *)0x0A00 = 0x7777;
|
*(uint16_t *)0x0A00 = 0x7777;
|
||||||
wdt_enable(WDTO_250MS);
|
wdt_enable(WDTO_250MS);
|
||||||
} else {
|
} else {
|
||||||
@ -122,6 +122,7 @@ bool WEAK CDC_Setup(Setup& setup)
|
|||||||
wdt_reset();
|
wdt_reset();
|
||||||
*(uint16_t *)0x0A00 = 0x0;
|
*(uint16_t *)0x0A00 = 0x0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user