mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-02 10:50:40 +00:00
move storeAndReset() to end of update()
This commit is contained in:
parent
576f582cd9
commit
efd818fe90
@ -104,6 +104,7 @@ bool EInkDynamicDisplay::update()
|
||||
endOrDetach(); // Either endUpdate() right now (fast refresh), or set the async flag (full refresh)
|
||||
#endif
|
||||
|
||||
storeAndReset(); // Store the result of this loop for next time
|
||||
return refreshApproved; // (Unutilized) Base class promises to return true if update ran
|
||||
}
|
||||
|
||||
@ -117,10 +118,8 @@ bool EInkDynamicDisplay::determineMode()
|
||||
checkRateLimiting();
|
||||
|
||||
// If too soon for a new frame, or display busy, abort early
|
||||
if (refresh == SKIPPED) {
|
||||
storeAndReset();
|
||||
if (refresh == SKIPPED)
|
||||
return false; // No refresh
|
||||
}
|
||||
|
||||
// -- New frame is due --
|
||||
|
||||
@ -152,12 +151,12 @@ bool EInkDynamicDisplay::determineMode()
|
||||
#endif
|
||||
|
||||
// Return - call a refresh or not?
|
||||
if (refresh == SKIPPED) {
|
||||
storeAndReset();
|
||||
if (refresh == SKIPPED)
|
||||
return false; // Don't trigger a refresh
|
||||
} else {
|
||||
storeAndReset();
|
||||
else
|
||||
return true; // Do trigger a refresh
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,6 +334,7 @@ void EInkDynamicDisplay::hashImage()
|
||||
// Store the results of determineMode() for future use, and reset for next call
|
||||
void EInkDynamicDisplay::storeAndReset()
|
||||
{
|
||||
previousFrameFlags = frameFlags;
|
||||
previousRefresh = refresh;
|
||||
previousReason = reason;
|
||||
|
||||
|
@ -82,13 +82,14 @@ class EInkDynamicDisplay : public EInkDisplay
|
||||
void storeAndReset(); // Keep results of determineMode() for later, tidy-up for next call
|
||||
|
||||
// What we are determining for this frame
|
||||
frameFlagTypes frameFlags = BACKGROUND; // Frame type(s) - determineMode() input
|
||||
frameFlagTypes frameFlags = BACKGROUND; // Frame characteristics - determineMode() input
|
||||
refreshTypes refresh = UNSPECIFIED; // Refresh type - determineMode() output
|
||||
reasonTypes reason = NO_OBJECTIONS; // Reason - why was refresh type used
|
||||
|
||||
// What happened last time determineMode() ran
|
||||
refreshTypes previousRefresh = UNSPECIFIED; // (Previous) Outcome
|
||||
reasonTypes previousReason = NO_OBJECTIONS; // (Previous) Reason
|
||||
frameFlagTypes previousFrameFlags = BACKGROUND; // (Previous) Frame flags
|
||||
refreshTypes previousRefresh = UNSPECIFIED; // (Previous) Outcome
|
||||
reasonTypes previousReason = NO_OBJECTIONS; // (Previous) Reason
|
||||
|
||||
uint32_t previousRunMs = -1; // When did determineMode() last run (rather than rejecting for rate-limiting)
|
||||
uint32_t imageHash = 0; // Hash of the current frame. Don't bother updating if nothing has changed!
|
||||
|
Loading…
Reference in New Issue
Block a user