From 93562d1954b07c1a24a06347152d691d9c1ea35a Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Wed, 24 Feb 2021 13:00:16 +0100 Subject: :lipstick: Make bluetooth symbol flash when not connected --- inc/Screen.h | 6 ++++++ source/main.cpp | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3