Added draw bluetooth failed function.

This commit is contained in:
Vojtěch Pour 2022-12-16 21:20:04 +01:00
parent c82a235a82
commit 3e6f7eca53

View file

@ -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);
}
}
}