From 9546dcb722af67ea3cfd3a4c2357d6cb85e9d0c6 Mon Sep 17 00:00:00 2001 From: "Andrew J. Kroll" Date: Sat, 13 Jan 2018 22:36:01 -0500 Subject: [PATCH] Fix ESP RTOS WDT corner case --- Usb.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Usb.cpp b/Usb.cpp index c46ea5b3..d43d63b6 100644 --- a/Usb.cpp +++ b/Usb.cpp @@ -382,11 +382,17 @@ uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) { uint16_t nak_count = 0; while((int32_t)((uint32_t)millis() - timeout) < 0L) { +#ifdef ESP8266 + yield(); // needed in order to reset the watchdog timer on the ESP8266 +#endif regWr(rHXFR, (token | ep)); //launch the transfer rcode = USB_ERROR_TRANSFER_TIMEOUT; while((int32_t)((uint32_t)millis() - timeout) < 0L) //wait for transfer completion { +#ifdef ESP8266 + yield(); // needed in order to reset the watchdog timer on the ESP8266 +#endif tmpdata = regRd(rHIRQ); if(tmpdata & bmHXFRDNIRQ) {