summaryrefslogtreecommitdiff
path: root/src/DisplayApp/Screens/Clock.h
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-02-23 16:14:03 +0100
committerJF <jf@codingfield.com>2020-02-23 16:14:03 +0100
commitf07ffab4c1fa876e8da9a1bcc895ecf0dfa75acf (patch)
treead7fc589d76988e1977d54926a8f776c4340b846 /src/DisplayApp/Screens/Clock.h
parent02772b996fb26146cf38fc6deccff7f43a49dfd6 (diff)
Re-enable BLE, BLE status on display and battery level on display.
Diffstat (limited to 'src/DisplayApp/Screens/Clock.h')
-rw-r--r--src/DisplayApp/Screens/Clock.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/DisplayApp/Screens/Clock.h b/src/DisplayApp/Screens/Clock.h
index a358e41b..d6e44fda 100644
--- a/src/DisplayApp/Screens/Clock.h
+++ b/src/DisplayApp/Screens/Clock.h
@@ -7,6 +7,8 @@
#include <bits/unique_ptr.h>
#include <libs/lvgl/src/lv_core/lv_style.h>
#include <libs/lvgl/src/lv_core/lv_obj.h>
+#include <Components/Battery/BatteryController.h>
+#include <Components/Ble/BleController.h>
#include "../Fonts/lcdfont14.h"
#include "../Fonts/lcdfont70.h"
#include "../../Version.h"
@@ -24,8 +26,10 @@ namespace Pinetime {
T& Get() { this->isUpdated = false; return value; }
DirtyValue& operator=(const T& other) {
- this->value = other;
- this->isUpdated = true;
+ if (this->value != other) {
+ this->value = other;
+ this->isUpdated = true;
+ }
return *this;
}
private:
@@ -34,17 +38,15 @@ namespace Pinetime {
};
class Clock : public Screen{
public:
- enum class BleConnectionStates{ NotConnected, Connected};
- Clock(DisplayApp* app, Controllers::DateTime& dateTimeController);
+ Clock(DisplayApp* app,
+ Controllers::DateTime& dateTimeController,
+ Controllers::Battery& batteryController,
+ Controllers::Ble& bleController);
~Clock() override;
- bool Refresh(bool fullRefresh) override;
+ bool Refresh() override;
bool OnButtonPushed() override;
- void SetBatteryPercentRemaining(uint8_t percent) { batteryPercentRemaining = percent; }
- void SetBleConnectionState(BleConnectionStates state) { bleState = state; }
- void SetCurrentDateTime(const std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>& tp) { currentDateTime = tp;}
-
void OnObjectEvent(lv_obj_t *pObj, lv_event_t i);
private:
static const char* MonthToString(Pinetime::Controllers::DateTime::Months month);
@@ -60,7 +62,7 @@ namespace Pinetime {
uint8_t currentDay = 0;
DirtyValue<uint8_t> batteryPercentRemaining {0};
- DirtyValue<BleConnectionStates> bleState {BleConnectionStates::NotConnected};
+ DirtyValue<bool> bleState {false};
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>> currentDateTime;
DirtyValue<Pinetime::Version> version;
@@ -75,6 +77,8 @@ namespace Pinetime {
lv_obj_t* backgroundLabel;
Controllers::DateTime& dateTimeController;
+ Controllers::Battery& batteryController;
+ Controllers::Ble& bleController;
bool running = true;