move storeAndReset() to end of update()

This commit is contained in:
Todd Herbert 2024-03-10 03:07:13 +13:00
parent 576f582cd9
commit efd818fe90
2 changed files with 11 additions and 10 deletions

View File

@ -104,6 +104,7 @@ bool EInkDynamicDisplay::update()
endOrDetach(); // Either endUpdate() right now (fast refresh), or set the async flag (full refresh) endOrDetach(); // Either endUpdate() right now (fast refresh), or set the async flag (full refresh)
#endif #endif
storeAndReset(); // Store the result of this loop for next time
return refreshApproved; // (Unutilized) Base class promises to return true if update ran return refreshApproved; // (Unutilized) Base class promises to return true if update ran
} }
@ -117,10 +118,8 @@ bool EInkDynamicDisplay::determineMode()
checkRateLimiting(); checkRateLimiting();
// If too soon for a new frame, or display busy, abort early // If too soon for a new frame, or display busy, abort early
if (refresh == SKIPPED) { if (refresh == SKIPPED)
storeAndReset();
return false; // No refresh return false; // No refresh
}
// -- New frame is due -- // -- New frame is due --
@ -152,12 +151,12 @@ bool EInkDynamicDisplay::determineMode()
#endif #endif
// Return - call a refresh or not? // Return - call a refresh or not?
if (refresh == SKIPPED) { if (refresh == SKIPPED)
storeAndReset();
return false; // Don't trigger a refresh return false; // Don't trigger a refresh
} else { else
storeAndReset();
return true; // Do trigger a refresh 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 // Store the results of determineMode() for future use, and reset for next call
void EInkDynamicDisplay::storeAndReset() void EInkDynamicDisplay::storeAndReset()
{ {
previousFrameFlags = frameFlags;
previousRefresh = refresh; previousRefresh = refresh;
previousReason = reason; previousReason = reason;

View File

@ -82,11 +82,12 @@ class EInkDynamicDisplay : public EInkDisplay
void storeAndReset(); // Keep results of determineMode() for later, tidy-up for next call void storeAndReset(); // Keep results of determineMode() for later, tidy-up for next call
// What we are determining for this frame // 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 refreshTypes refresh = UNSPECIFIED; // Refresh type - determineMode() output
reasonTypes reason = NO_OBJECTIONS; // Reason - why was refresh type used reasonTypes reason = NO_OBJECTIONS; // Reason - why was refresh type used
// What happened last time determineMode() ran // What happened last time determineMode() ran
frameFlagTypes previousFrameFlags = BACKGROUND; // (Previous) Frame flags
refreshTypes previousRefresh = UNSPECIFIED; // (Previous) Outcome refreshTypes previousRefresh = UNSPECIFIED; // (Previous) Outcome
reasonTypes previousReason = NO_OBJECTIONS; // (Previous) Reason reasonTypes previousReason = NO_OBJECTIONS; // (Previous) Reason