diff options
author | Jakob Stendahl <jakob.stendahl@outlook.com> | 2021-02-28 14:30:49 +0100 |
---|---|---|
committer | Jakob Stendahl <jakob.stendahl@outlook.com> | 2021-02-28 14:30:49 +0100 |
commit | e9a5544db7be5e461b92743b37adcc77162483b7 (patch) | |
tree | 86477909d1be28d322dde879032631f09b7b986d | |
parent | 596f06c5a2bccb2d96128c6866b0c8d9cad7130b (diff) | |
download | hoverbit-ble-e9a5544db7be5e461b92743b37adcc77162483b7.tar.gz hoverbit-ble-e9a5544db7be5e461b92743b37adcc77162483b7.zip |
:sparkles: Make it possible for app to controll display mode
-rw-r--r-- | source/main.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/main.cpp b/source/main.cpp index 3c3f626..6f3332b 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -70,7 +70,12 @@ void onDelim(MicroBitEvent) { if (i >= length - 1) { bEOC = true; valLength = i - startI + 1; - } else if (cChar == 'R' || cChar == 'T' || cChar == 'A' || cChar == 'S') { + } else if (cChar == 'R' || // Roll + cChar == 'T' || // Throttle + cChar == 'A' || // Arm + cChar == 'S' || // (Servo1) Keeping this for compatability + cChar == 'D' // DisplayMainScreenMode + ) { bEOC = true; valLength = i - startI; } @@ -88,6 +93,18 @@ void onDelim(MicroBitEvent) { } else if (cCommand == 'A') { controller.Arm(value == 1); accString = accString + ManagedString("A") + ManagedString(controller.Arm()); + } else if (cCommand == 'D') { + switch (value) { + case 0: + hoverBitDisplay.mode(GRAPHS); + break; + case 1: + hoverBitDisplay.mode(BATTERY); + break; + case 2: + hoverBitDisplay.mode(OFF); + break; + } } else { // We ignore it :) } |