Prevent unnecessary refresh in Clock screen.

This commit is contained in:
JF 2020-02-16 18:37:18 +01:00
parent f30573a9b0
commit 79b4f006be
2 changed files with 5 additions and 4 deletions

View file

@ -91,9 +91,10 @@ void Clock::Refresh(bool fullRefresh) {
} }
if(fullRefresh || version.IsUpdated()) { if(fullRefresh || version.IsUpdated()) {
char version[20]; auto dummy = version.Get();
sprintf(version, "VERSION: %d.%d.%d", Version::Major(), Version::Minor(), Version::Patch()); char versionStr[20];
gfx.DrawString(20, 220, 0xffff, version, &smallFont, false); sprintf(versionStr, "VERSION: %d.%d.%d", Version::Major(), Version::Minor(), Version::Patch());
gfx.DrawString(20, 220, 0xffff, versionStr, &smallFont, false);
} }
} }

View file

@ -19,7 +19,7 @@ namespace Pinetime {
explicit DirtyValue(T v) { value = v; } explicit DirtyValue(T v) { value = v; }
explicit DirtyValue(T& v) { value = v; } explicit DirtyValue(T& v) { value = v; }
bool IsUpdated() const { return isUpdated; } bool IsUpdated() const { return isUpdated; }
T& Get() { return value; this->isUpdated = false;} T& Get() { this->isUpdated = false; return value;}
DirtyValue& operator=(const T& other) { DirtyValue& operator=(const T& other) {
this->value = other; this->value = other;