diff options
| author | Jean-François Milants <jf@codingfield.com> | 2021-02-14 14:42:42 +0100 |
|---|---|---|
| committer | Jean-François Milants <jf@codingfield.com> | 2021-02-14 14:42:42 +0100 |
| commit | f81ff98c308e437139468301ed5198b322c2f4ec (patch) | |
| tree | 4e2334bc3a8f7f434890a4cb439703b569572c10 /src/displayapp/screens/Clock.h | |
| parent | 01e194426d51ffb1a6e9e3162567f29c2a84154d (diff) | |
| parent | e62f8734befca5e40496f354aa05ea20602a8bbe (diff) | |
Merge branch 'develop' of github.com:JF002/Pinetime into develop
Diffstat (limited to 'src/displayapp/screens/Clock.h')
| -rw-r--r-- | src/displayapp/screens/Clock.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 3a4c67a3..18d70532 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -21,11 +21,10 @@ namespace Pinetime { template <class T> class DirtyValue { public: - explicit DirtyValue(T v) { value = v; } - explicit DirtyValue(T& v) { value = v; } + DirtyValue() = default; // Use NSDMI + explicit DirtyValue(T const& v):value{v}{} // Use MIL and const-lvalue-ref bool IsUpdated() const { return isUpdated; } - T& Get() { this->isUpdated = false; return value; } - + T const& Get() { this->isUpdated = false; return value; } // never expose a non-const lvalue-ref DirtyValue& operator=(const T& other) { if (this->value != other) { this->value = other; @@ -34,9 +33,10 @@ namespace Pinetime { return *this; } private: - T value; - bool isUpdated = true; + T value{}; // NSDMI - default initialise type + bool isUpdated{true}; // NSDMI - use brace initilisation }; + class Clock : public Screen { public: Clock(DisplayApp* app, @@ -64,13 +64,13 @@ namespace Pinetime { Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; uint8_t currentDay = 0; - DirtyValue<int> batteryPercentRemaining {0}; - DirtyValue<bool> bleState {false}; - DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime; - DirtyValue<uint32_t> stepCount {0}; - DirtyValue<uint8_t> heartbeat {0}; - DirtyValue<bool> heartbeatRunning {false}; - DirtyValue<bool> notificationState {false}; + DirtyValue<int> batteryPercentRemaining {}; + DirtyValue<bool> bleState {}; + DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime{}; + DirtyValue<uint32_t> stepCount {}; + DirtyValue<uint8_t> heartbeat {}; + DirtyValue<bool> heartbeatRunning {}; + DirtyValue<bool> notificationState {}; lv_obj_t* label_time; lv_obj_t* label_date; |
