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 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 batteryPercentRemaining {0}; - DirtyValue bleState {false}; - DirtyValue> currentDateTime; - DirtyValue stepCount {0}; - DirtyValue heartbeat {0}; - DirtyValue heartbeatRunning {false}; - DirtyValue notificationState {false}; + DirtyValue batteryPercentRemaining {}; + DirtyValue bleState {}; + DirtyValue> currentDateTime{}; + DirtyValue stepCount {}; + DirtyValue heartbeat {}; + DirtyValue heartbeatRunning {}; + DirtyValue notificationState {}; lv_obj_t* label_time; lv_obj_t* label_date;