Improve symbols management

This commit is contained in:
Valentin Saugnier 2023-08-10 17:25:47 +02:00
parent 16f8c6cf3a
commit c8bda95289
1 changed files with 6 additions and 7 deletions

View File

@ -24,10 +24,9 @@ extern int menuDisplay;
extern bool symbolAvailable;
extern bool bluetoothConnected;
String symbolArray[13] = {"BT", "[", ">", "j", "b", "<", "s", "u", "R", "v", "(", ";"};
const char* symbolArray[] = { "[", ">", "j", "b", "<", "s", "u", "R", "v", "(", ";"};
int symbolArraySize = sizeof(symbolArray)/sizeof(symbolArray[0]);
const uint8_t *symbolsAPRS[] = {bluetoothSymbol, runnerSymbol, carSymbol, jeepSymbol, bikeSymbol, motorcycleSymbol, shipSymbol, truckSymbol, recreationalVehicleSymbol, vanSymbol, carsateliteSymbol, tentSymbol};
uint32_t symbolTime = millis();
const uint8_t *symbolsAPRS[] = {runnerSymbol, carSymbol, jeepSymbol, bikeSymbol, motorcycleSymbol, shipSymbol, truckSymbol, recreationalVehicleSymbol, vanSymbol, carsateliteSymbol, tentSymbol};
// T-Beams bought with soldered OLED Screen comes with only 4 pins (VCC, GND, SDA, SCL)
// If your board didn't come with 4 pins OLED Screen and comes with 5 and one of them is RST...
// Uncomment Next Line (Remember ONLY if your OLED Screen has a RST pin). This is to avoid memory issues.
@ -248,6 +247,8 @@ void show_display(String header, String line1, String line2, String line3, Strin
}
}
symbolAvailable = symbol != 100;
/*
* Symbol alternate every 5s
* If bluetooth is disconnected or if we are in the first part of the clock, then we show the APRS symbol
@ -255,13 +256,11 @@ void show_display(String header, String line1, String line2, String line3, Strin
*/
const auto time_now = now();
if (!bluetoothConnected || time_now % 10 < 5) {
if (symbol != 100) {
symbolAvailable = true;
if (symbolAvailable) {
display.drawBitmap((display.width() - SYM_WIDTH), 0, symbolsAPRS[symbol], SYM_WIDTH, SYM_HEIGHT, 1);
} else {
symbolAvailable = false;
}
} else if (bluetoothConnected) {
// TODO In this case, the text symbol stay displayed due to symbolAvailable false in menu_utils
display.drawBitmap((display.width() - SYM_WIDTH), 0, bluetoothSymbol, SYM_WIDTH, SYM_HEIGHT, 1);
}
}