mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-19 16:29:31 +00:00
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:
parent
e9d30a243c
commit
43d61a550c
@ -33,7 +33,6 @@ void EInk::beginPolling(uint32_t interval, uint32_t expectedDuration)
|
|||||||
updateRunning = true;
|
updateRunning = true;
|
||||||
pollingInterval = interval;
|
pollingInterval = interval;
|
||||||
pollingBegunAt = millis();
|
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
|
// 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
|
// 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()
|
int32_t EInk::runOnce()
|
||||||
{
|
{
|
||||||
// Check for polling timeout
|
// 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;
|
failed = true;
|
||||||
|
|
||||||
// Handle failure
|
// Handle failure
|
||||||
|
@ -50,7 +50,6 @@ class EInk : private concurrency::OSThread
|
|||||||
bool updateRunning = false; // see EInk::busy()
|
bool updateRunning = false; // see EInk::busy()
|
||||||
uint32_t pollingInterval = 0; // How often to check if update complete (ms)
|
uint32_t pollingInterval = 0; // How often to check if update complete (ms)
|
||||||
uint32_t pollingBegunAt = 0; // To timeout during polling
|
uint32_t pollingBegunAt = 0; // To timeout during polling
|
||||||
uint32_t pollingExpectedDuration = 0; // To timeout during polling
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NicheGraphics::Drivers
|
} // namespace NicheGraphics::Drivers
|
||||||
|
Loading…
Reference in New Issue
Block a user