summaryrefslogtreecommitdiff
path: root/src/DisplayApp/DisplayApp.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2019-12-27 16:05:49 (GMT)
committerJF <jf@codingfield.com>2019-12-27 16:05:49 (GMT)
commit46eeefb53a1843908c3e7dbae56dbaa0a6d83bdd (patch)
tree2ce3c2e9c819cd84b42b3c6035890b1cdb7dd45e /src/DisplayApp/DisplayApp.cpp
parent11aa5e3d880af978dc5c337357c3802355c799eb (diff)
Add BleController to manage the BLE connection status
Diffstat (limited to 'src/DisplayApp/DisplayApp.cpp')
-rw-r--r--src/DisplayApp/DisplayApp.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/DisplayApp/DisplayApp.cpp b/src/DisplayApp/DisplayApp.cpp
index 1015393..f72f057 100644
--- a/src/DisplayApp/DisplayApp.cpp
+++ b/src/DisplayApp/DisplayApp.cpp
@@ -10,7 +10,9 @@
using namespace Pinetime::Applications;
-DisplayApp::DisplayApp(Pinetime::Controllers::Battery &batteryController) : batteryController{batteryController} {
+DisplayApp::DisplayApp(Pinetime::Controllers::Battery &batteryController, Pinetime::Controllers::Ble &bleController) :
+ batteryController{batteryController},
+ bleController{bleController} {
msgQueue = xQueueCreate(queueSize, itemSize);
}
@@ -66,8 +68,8 @@ void DisplayApp::InitHw() {
x = 181;
gfx->DrawChar(&largeFont, '0', &x, 78, 0xffff);
- gfx->DrawString(10, 0, 0xffff, "BLE", &smallFont, false);
- gfx->DrawString(20, 160, 0xffff, "FRIDAY 27 DEC 2019", &smallFont, false);
+ gfx->DrawString(10, 0, 0x0000, "BLE", &smallFont, false);
+ gfx->DrawString(20, 180, 0xffff, "FRIDAY 27 DEC 2019", &smallFont, false);
}
void DisplayApp::Refresh() {
@@ -133,6 +135,13 @@ void DisplayApp::RunningState() {
gfx->DrawString((240-108), 0, 0xffff, batteryChar, &smallFont, false);
}
+ bool newIsBleConnected = bleController.IsConnected();
+ if(newIsBleConnected != bleConnected) {
+ bleConnected = newIsBleConnected;
+ uint16_t color = (bleConnected) ? 0xffff : 0x0000;
+ gfx->DrawString(10, 0, color, "BLE", &smallFont, false);
+ }
+
auto raw = systick_counter / 1000;
auto currentDeltaSeconds = raw - deltaSeconds;