fix: more generous timeout for display updates

Previously this was tied to the expected duration of the update, but this didn't account for any delay if our polling thread got held up by an unrelated firmware task.
This commit is contained in:
Todd Herbert 2025-03-25 01:26:25 +13:00
parent e9d30a243c
commit 43d61a550c
2 changed files with 2 additions and 3 deletions

View File

@ -33,7 +33,6 @@ void EInk::beginPolling(uint32_t interval, uint32_t expectedDuration)
updateRunning = true;
pollingInterval = interval;
pollingBegunAt = millis();
pollingExpectedDuration = expectedDuration;
// To minimize load, we can choose to delay polling for a few seconds, if we know roughly how long the update will take
// By default, expectedDuration is 0, and we'll start polling immediately
@ -47,7 +46,8 @@ void EInk::beginPolling(uint32_t interval, uint32_t expectedDuration)
int32_t EInk::runOnce()
{
// Check for polling timeout
if (millis() - pollingBegunAt > pollingExpectedDuration * 3)
// Manually set at 10 seconds, in case some big task holds up the firmware's cooperative multitasking
if (millis() - pollingBegunAt > 10000)
failed = true;
// Handle failure

View File

@ -50,7 +50,6 @@ class EInk : private concurrency::OSThread
bool updateRunning = false; // see EInk::busy()
uint32_t pollingInterval = 0; // How often to check if update complete (ms)
uint32_t pollingBegunAt = 0; // To timeout during polling
uint32_t pollingExpectedDuration = 0; // To timeout during polling
};
} // namespace NicheGraphics::Drivers