From 3e6f7eca53fcc19ededadd09d566065e0b2619df Mon Sep 17 00:00:00 2001 From: BigTire Date: Fri, 16 Dec 2022 21:20:04 +0100 Subject: [PATCH] Added draw bluetooth failed function. --- projectEEG/projectEEG/projectEEG.ino | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/projectEEG/projectEEG/projectEEG.ino b/projectEEG/projectEEG/projectEEG.ino index 7e5ef3d..7a71de9 100644 --- a/projectEEG/projectEEG/projectEEG.ino +++ b/projectEEG/projectEEG/projectEEG.ino @@ -233,6 +233,7 @@ void loop() { } // end if else for checksum } } else { + drawBluetoothFailed(); delay(5000); if (wasConnected) { M5.shutdown(1); @@ -349,13 +350,26 @@ void drawBluetoothLoading() { M5.Lcd.drawLine(0, 60, 320, 60, COLORS[COLOR_MODE]); - M5.Lcd.drawString("Connecting bluetooth", 35, 110, 4); + M5.lcd.fillRect(0, 65, 320, 110, (COLORS[COLOR_MODE] - 1) % 2); + M5.Lcd.drawString("connecting Bluetooth", 35, 110, 4); M5.Lcd.drawLine(0, 180, 320, 180, COLORS[COLOR_MODE]); drawBattery(); } +void drawBluetoothFailed() { + M5.lcd.fillRect(0, 65, 320, 110, (COLORS[COLOR_MODE] - 1) % 2); + if (wasConnected) { + // TODO SMAZAT SIGNAL + M5.lcd.fillRect(0, 185, 320, 240, (COLORS[COLOR_MODE] - 1) % 2); + M5.Lcd.drawString("Bluetooth: disconnected", 20, 110, 4); + M5.lcd.fillRect(0, 185, 320, 240, (COLORS[COLOR_MODE] - 1) % 2); + } else { + M5.Lcd.drawString("connecting failed", 50, 110, 4); + } +} + void task1(void *pvParameters) { while (1) { delay(500); @@ -381,6 +395,12 @@ void bluetoothLoading() { delay(500); } } + + if (!isConnected) { + for (int i = 0; i < 4; i++) { + M5.lcd.drawLine(240 + i, 55, 270 + i, 5, RED); + } + } }