Allow nRF52 CPU idle while USB watchdog timers run

This commit is contained in:
mikecarper committed 2026-10-21 00:56:23 -07:00
1 parent 631c670ba7
commit 585393e36c
5 files changed
+254 -5

No files matched your search

+8
View File
@@ -262,6 +262,13 @@ UsbLoggingStatus usbLoggingStatus() {
bool isUsbLoggingWatchdogArmed() {
if (isUsbLoggingTransportRecoveryPending()) return true;
#if defined(NRF52_PLATFORM)
// nRF52 only waits for the next interrupt; its RTC/USB/radio wake sources
// keep the loop and elapsed-millis watchdog deadlines running. A saved On
// policy or confirmed Auto reader is not continuous CPU work. Keep actual
// detach/reattach work awake above without spinning between policy ticks.
return false;
#else
// This is only an awake/service hint, never reset authorization. Keep a
// previously durable policy awake if publication is busy; falling back to
// an unavailable snapshot here could allow sleep to restart its deadline.
@@ -272,6 +279,7 @@ bool isUsbLoggingWatchdogArmed() {
const bool ready = (flags & (1U | 2U | 256U)) == (1U | 2U | 256U);
return ready && ((flags & 4U)
|| ((flags & 512U) && (flags & 1024U) && (busy || stage < 2)));
#endif
}
void loadUsbLoggingWatchdog(FILESYSTEM* fs, bool durable, uint32_t (*epoch_seconds)()) {