aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stendahl <jakob.stendahl@outlook.com>2021-02-24 13:00:16 +0100
committerJakob Stendahl <jakob.stendahl@outlook.com>2021-02-24 13:00:16 +0100
commit93562d1954b07c1a24a06347152d691d9c1ea35a (patch)
treee3e33e0d5f1ae04f8c6d42de07b73a6d4ad53b8d
parent31c0ec6191af1a9d8f491876942a404d4f85468a (diff)
downloadhoverbit-ble-93562d1954b07c1a24a06347152d691d9c1ea35a.tar.gz
hoverbit-ble-93562d1954b07c1a24a06347152d691d9c1ea35a.zip
:lipstick: Make bluetooth symbol flash when not connected
-rw-r--r--inc/Screen.h6
-rw-r--r--source/main.cpp20
2 files changed, 25 insertions, 1 deletions
diff --git a/inc/Screen.h b/inc/Screen.h
index b60ba2b..e141a86 100644
--- a/inc/Screen.h
+++ b/inc/Screen.h
@@ -67,6 +67,12 @@ static const char* const strBattLevel[] = {
000,255,255,255,000\n\
000,255,255,255,000\n"
};
+const char* const bluetoothSymbol = "\
+ 000,000,255,255,000\n\
+ 255,000,255,000,255\n\
+ 000,255,255,255,000\n\
+ 255,000,255,000,255\n\
+ 000,000,255,255,000\n";
void plotYLine(MicroBit *uBit, int y1, int y2, int x);
diff --git a/source/main.cpp b/source/main.cpp
index 815d560..27481a9 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -193,7 +193,25 @@ void mainScreen() {
bool bDelayElapsed = (uBit.systemTime() - tmpTimer) > 1000;
if (bDelayElapsed) { tmpTimer = uBit.systemTime(); }
- if (bDelayElapsed && bConnected) { uart->send(ManagedString("B:") + ManagedString(batteryMilliVolt)); }
+ if (bConnected) {
+ if (bDelayElapsed) {
+ uart->send(ManagedString("B:") + ManagedString(batteryMilliVolt));
+ }
+ } else {
+ if (bDelayElapsed) {
+ bBLEIndicator = !bBLEIndicator;
+ uBit.display.clear();
+ if (bBLEIndicator) {
+ MicroBitImage img(bluetoothSymbol);
+ uBit.display.print(img);
+ } else {
+ // Need to actually see this to know if I want to flash only
+ // blank screen or with battery.
+ //batteryLevelFullScreen();
+ }
+ }
+ return;
+ }
switch (displayMainScreenMode) {
case OFF: