|
@@ -10,7 +10,8 @@
|
|
|
#include <sstream>
|
|
#include <sstream>
|
|
|
#include <string>
|
|
#include <string>
|
|
|
|
|
|
|
|
-#include "esphome/core/application.h"
|
|
|
|
|
|
|
+#include <esp_task_wdt.h>
|
|
|
|
|
+
|
|
|
#include "esphome/core/hal.h"
|
|
#include "esphome/core/hal.h"
|
|
|
#include "esphome/core/log.h"
|
|
#include "esphome/core/log.h"
|
|
|
#include "esphome/components/gxepd2/pin_registry.h"
|
|
#include "esphome/components/gxepd2/pin_registry.h"
|
|
@@ -42,17 +43,26 @@ inline int digitalRead(int16_t pin) {
|
|
|
// deliberately up to tens of seconds (_busy_timeout), since a real 3/4-color
|
|
// deliberately up to tens of seconds (_busy_timeout), since a real 3/4-color
|
|
|
// refresh can legitimately take that long. Neither esphome::delay() nor
|
|
// refresh can legitimately take that long. Neither esphome::delay() nor
|
|
|
// esphome::yield() resets the ESP-IDF task watchdog on their own, so
|
|
// esphome::yield() resets the ESP-IDF task watchdog on their own, so
|
|
|
-// without an explicit feed here, a real (or a misconfigured-polarity, thus
|
|
|
|
|
|
|
+// without an explicit reset here, a real (or a misconfigured-polarity, thus
|
|
|
// permanently "busy") wait outlasts the watchdog and the whole device
|
|
// permanently "busy") wait outlasts the watchdog and the whole device
|
|
|
// reboots mid-refresh instead of the loop's own timeout ever getting a
|
|
// reboots mid-refresh instead of the loop's own timeout ever getting a
|
|
|
// chance to fire.
|
|
// chance to fire.
|
|
|
|
|
+//
|
|
|
|
|
+// This calls esp_task_wdt_reset() directly, not esphome::App.feed_wdt():
|
|
|
|
|
+// feed_wdt()'s rate-limiting state is global, shared by every caller, on
|
|
|
|
|
+// the assumption only the main loop task ever calls it. This code runs on
|
|
|
|
|
+// gxepd2's own task (see gxepd2_display.h), so the main loop's frequent
|
|
|
|
|
+// feed_wdt() calls kept satisfying that shared rate limit and silently
|
|
|
|
|
+// swallowing this task's - esp_task_wdt_reset() always resets whichever
|
|
|
|
|
+// task is actually calling it, isn't rate-limited, and is cheap enough to
|
|
|
|
|
+// call unconditionally here.
|
|
|
inline void delay(uint32_t ms) {
|
|
inline void delay(uint32_t ms) {
|
|
|
- esphome::App.feed_wdt();
|
|
|
|
|
|
|
+ esp_task_wdt_reset();
|
|
|
esphome::delay(ms);
|
|
esphome::delay(ms);
|
|
|
}
|
|
}
|
|
|
inline uint32_t micros() { return esphome::micros(); }
|
|
inline uint32_t micros() { return esphome::micros(); }
|
|
|
inline void yield() {
|
|
inline void yield() {
|
|
|
- esphome::App.feed_wdt();
|
|
|
|
|
|
|
+ esp_task_wdt_reset();
|
|
|
esphome::yield();
|
|
esphome::yield();
|
|
|
}
|
|
}
|
|
|
|
|
|