display less code

This commit is contained in:
richonguzman 2024-05-15 13:03:09 -04:00
parent 4841abef92
commit c42a094377
10 changed files with 24 additions and 170 deletions

View File

@ -40,7 +40,7 @@ namespace BLUETOOTH_Utils {
if (!SerialBT.begin(String("LoRa Tracker " + String(ourId)))) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Bluetooth", "Starting Bluetooth failed!");
show_display("ERROR", "Starting Bluetooth failed!");
show_display("ERROR", "Starting Bluetooth failed!", "");
while(true) {
delay(1000);
}

View File

@ -88,7 +88,7 @@ namespace BME_Utils {
}
}
if (!wxModuleFound) {
show_display("ERROR", "", "BME/BMP sensor active", "but no sensor found...", "", 2000);
show_display("ERROR", "BME/BMP sensor active", "but no sensor found...", 2000);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "BME", " BME/BMP sensor Active in config but not found! Check Wiring");
} else {
switch (wxModuleType) {

View File

@ -111,7 +111,7 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
bool Configuration::validateConfigFile(String currentBeaconCallsign) {
if (currentBeaconCallsign.indexOf("NOCALL") != -1) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Config", "Change all your callsigns in 'data/tracker_config.json' and upload it via 'Upload File System image'");
show_display("ERROR", "Change callsigns!", "'tracker_config.json'", "upload it via --> ", "'Upload File System image'");
show_display("ERROR", "Callsigns = NOCALL!", "---> change it !!!");
return true;
} else {
return false;

View File

@ -145,64 +145,6 @@ void display_toggle(bool toggle) {
}
}
void show_display(String header, int wait) {
#ifdef HAS_TFT
cleanTFT();
tft.setTextColor(TFT_WHITE,TFT_BLACK);
tft.setTextSize(bigSizeFont);
tft.setCursor(0, 0);
tft.print(header);
#else
display.clearDisplay();
#ifdef ssd1306
display.setTextColor(WHITE);
#else
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2);
display.setCursor(0, 0);
display.println(header);
#ifdef ssd1306
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(screenBrightness);
#endif
display.display();
#endif
delay(wait);
}
void show_display(String header, String line1, int wait) {
#ifdef HAS_TFT
cleanTFT();
tft.setTextColor(TFT_WHITE,TFT_BLACK);
tft.setTextSize(bigSizeFont);
tft.setCursor(0, 0);
tft.print(header);
tft.setTextSize(smallSizeFont);
tft.setCursor(0, ((lineSpacing * 2) - 2));
tft.print(line1);
#else
display.clearDisplay();
#ifdef ssd1306
display.setTextColor(WHITE);
#else
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2);
display.setCursor(0, 0);
display.println(header);
display.setTextSize(1);
display.setCursor(0, 16);
display.println(line1);
#ifdef ssd1306
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(screenBrightness);
#endif
display.display();
#endif
delay(wait);
}
void show_display(String header, String line1, String line2, int wait) {
#ifdef HAS_TFT
cleanTFT();
@ -239,90 +181,6 @@ void show_display(String header, String line1, String line2, int wait) {
delay(wait);
}
void show_display(String header, String line1, String line2, String line3, int wait) {
#ifdef HAS_TFT
cleanTFT();
tft.setTextColor(TFT_WHITE,TFT_BLACK);
tft.setTextSize(bigSizeFont);
tft.setCursor(0, 0);
tft.print(header);
tft.setTextSize(smallSizeFont);
tft.setCursor(0, ((lineSpacing * 2) - 2));
tft.print(line1);
tft.setCursor(0, ((lineSpacing * 3) - 2));
tft.print(line2);
tft.setCursor(0, ((lineSpacing * 4) - 2));
tft.print(line3);
#else
display.clearDisplay();
#ifdef ssd1306
display.setTextColor(WHITE);
#else
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2);
display.setCursor(0, 0);
display.println(header);
display.setTextSize(1);
display.setCursor(0, 16);
display.println(line1);
display.setCursor(0, 26);
display.println(line2);
display.setCursor(0, 36);
display.println(line3);
#ifdef ssd1306
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(screenBrightness);
#endif
display.display();
#endif
delay(wait);
}
void show_display(String header, String line1, String line2, String line3, String line4, int wait) {
#ifdef HAS_TFT
cleanTFT();
tft.setTextColor(TFT_WHITE,TFT_BLACK);
tft.setTextSize(bigSizeFont);
tft.setCursor(0, 0);
tft.print(header);
tft.setTextSize(smallSizeFont);
tft.setCursor(0, ((lineSpacing * 2) - 2));
tft.print(line1);
tft.setCursor(0, ((lineSpacing * 3) - 2));
tft.print(line2);
tft.setCursor(0, ((lineSpacing * 4) - 2));
tft.print(line3);
tft.setCursor(0, ((lineSpacing * 5) - 2));
tft.print(line4);
#else
display.clearDisplay();
#ifdef ssd1306
display.setTextColor(WHITE);
#else
display.setTextColor(SH110X_WHITE);
#endif
display.setTextSize(2);
display.setCursor(0, 0);
display.println(header);
display.setTextSize(1);
display.setCursor(0, 16);
display.println(line1);
display.setCursor(0, 26);
display.println(line2);
display.setCursor(0, 36);
display.println(line3);
display.setCursor(0, 46);
display.println(line4);
#ifdef ssd1306
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(screenBrightness);
#endif
display.display();
#endif
delay(wait);
}
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait) {
#ifdef HAS_TFT
if (menuDisplay != lastMenuDisplay) {

View File

@ -5,11 +5,7 @@ void setup_display();
void display_toggle(bool toggle);
void cleanTFT();
void show_display(String header, int wait = 0);
void show_display(String header, String line1, int wait = 0);
void show_display(String header, String line1, String line2, int wait = 0);
void show_display(String header, String line1, String line2, String line3, int wait = 0);
void show_display(String header, String line1, String line2, String line3, String line4, int wait = 0);
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait = 0);
void startupScreen(uint8_t index, String version);

View File

@ -101,7 +101,7 @@ namespace GPS_Utils {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "GPS",
"No GPS frames detected! Try to reset the GPS Chip with this "
"firmware: https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset");
show_display("ERROR", "No GPS frames!", "Reset the GPS Chip", "https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset", 2000);
show_display("ERROR", "No GPS frames!", "Reset the GPS Chip", 2000);
}
}

View File

@ -331,7 +331,7 @@ namespace KEYBOARD_Utils {
statusState = true;
statusTime = millis();
winlinkCommentState = false;
show_display("__ INFO __", "", " CHANGING CALLSIGN!", "", "-----> " + Config.beacons[myBeaconsIndex].callsign, 2000);
show_display("__ INFO __", "", " CHANGING CALLSIGN!", "", "-----> " + Config.beacons[myBeaconsIndex].callsign, "", 2000);
STATION_Utils::saveIndex(0, myBeaconsIndex);
if (menuDisplay == 200) {
menuDisplay = 20;
@ -354,21 +354,21 @@ namespace KEYBOARD_Utils {
if (keyDetected) {
menuDisplay = 1300;
} else {
show_display(" APRS Thu.", "Sending:", "Happy #APRSThursday", "from LoRa Tracker 73!", 2000);
show_display(" APRS Thu.", "Sending:", "Happy #APRSThursday", "from LoRa Tracker 73!", "", "", 2000);
MSG_Utils::addToOutputBuffer(0, "ANSRVR", "CQ HOTG Happy #APRSThursday from LoRa Tracker 73!");
}
} else if (menuDisplay == 131) {
if (keyDetected) {
menuDisplay = 1310;
} else {
show_display(" APRS Thu.", "Sending:", "Happy #APRSThursday", "from LoRa Tracker 73!", 2000);
show_display(" APRS Thu.", "Sending:", "Happy #APRSThursday", "from LoRa Tracker 73!", "", "", 2000);
MSG_Utils::addToOutputBuffer(0, "APRSPH" , "HOTG Happy #APRSThursday from LoRa Tracker 73!");
}
} else if (menuDisplay == 132) {
show_display(" APRS Thu.", "", " Unsubscribe", " from APRS Thursday", 2000);
show_display(" APRS Thu.", "", " Unsubscribe", " from APRS Thursday", "", "", 2000);
MSG_Utils::addToOutputBuffer(0, "ANSRVR", "U HOTG");
} else if (menuDisplay == 133) {
show_display(" APRS Thu.", "", " Keep Subscribed" ," for 12hours more", 2000);
show_display(" APRS Thu.", "", " Keep Subscribed" ," for 12hours more", "", "", 2000);
MSG_Utils::addToOutputBuffer(0, "ANSRVR", "K HOTG");
}
@ -393,11 +393,11 @@ namespace KEYBOARD_Utils {
screenBrightness = 1;
}
} else if (menuDisplay == 240) {
show_display("_STATUS___", "", "WRITE STATUS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
show_display("_STATUS___", "", "WRITE STATUS","STILL IN DEVELOPMENT!", "", "", 2000); /////////////////////////
} else if (menuDisplay == 241) {
show_display("_STATUS___", "", "SELECT STATUS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
show_display("_STATUS___", "", "SELECT STATUS","STILL IN DEVELOPMENT!", "", "", 2000); /////////////////////////
} else if (menuDisplay == 250) {
show_display("_NOTIFIC__", "", "NOTIFICATIONS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
show_display("_NOTIFIC__", "", "NOTIFICATIONS","STILL IN DEVELOPMENT!", "", "", 2000); /////////////////////////
}
else if (menuDisplay == 4) {
@ -489,32 +489,32 @@ namespace KEYBOARD_Utils {
} else if (menuDisplay == 60) {
if (Config.notification.ledFlashlight) {
if (flashlight) {
show_display("__EXTRAS__", ""," Flashlight"," Status --> OFF","", 2000);
show_display("__EXTRAS__", ""," Flashlight"," Status --> OFF", "", "", 2000);
flashlight = false;
} else {
show_display("__EXTRAS__", ""," Flashlight"," Status --> ON","", 2000);
show_display("__EXTRAS__", ""," Flashlight"," Status --> ON", "", "", 2000);
flashlight = true;
}
} else {
show_display("__EXTRAS__", ""," Flashlight","NOT ACTIVE IN CONFIG!","", 2000);
show_display("__EXTRAS__", ""," Flashlight","NOT ACTIVE IN CONFIG!", "", "", 2000);
}
} else if (menuDisplay == 61) {
if (digirepeaterActive) {
show_display("__EXTRAS__", ""," DigiRepeater"," Status --> OFF","", 2000);
show_display("__EXTRAS__", ""," DigiRepeater"," Status --> OFF", "", "", 2000);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "DigiRepeater OFF");
digirepeaterActive = false;
} else {
show_display("__EXTRAS__", ""," DigiRepeater"," Status --> ON","", 2000);
show_display("__EXTRAS__", ""," DigiRepeater"," Status --> ON","", "", 2000);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "DigiRepeater ON");
digirepeaterActive = true;
}
} else if (menuDisplay == 62) {
if (sosActive) {
show_display("__EXTRAS__", ""," S.O.S."," Status --> OFF","", 2000);
show_display("__EXTRAS__", ""," S.O.S."," Status --> OFF", "", "", 2000);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode OFF");
sosActive = false;
} else {
show_display("__EXTRAS__", ""," S.O.S."," Status --> ON","", 2000);
show_display("__EXTRAS__", ""," S.O.S."," Status --> ON", "", "", 2000);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode ON");
sosActive = true;
}

View File

@ -129,7 +129,7 @@ namespace LoRa_Utils {
long freq = currentLoRaType->frequency;
if (!LoRa.begin(freq)) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "LoRa", "Starting LoRa failed!");
show_display("ERROR", "Starting LoRa failed!");
show_display("ERROR", "Starting LoRa failed!", "");
while (true) {
delay(1000);
}

View File

@ -410,7 +410,7 @@ namespace MENU_Utils {
show_display("WLNK__MENU", " Forward Mail (F#)", "> Delete Mail (K#)", " Alias Menu", " Log Out", lastLine);
break;
case 5051: // WINLINK: Delete Mail //
show_display("WLNK___DEL", "", " DELETE MAIL N." + winlinkMailNumber, "", "<Back Enter>");
show_display("WLNK___DEL", "", " DELETE MAIL N." + winlinkMailNumber, "", "", "<Back Enter>");
break;
case 5060: // WINLINK: Alias Menu //

View File

@ -240,7 +240,7 @@ namespace MSG_Utils {
cleanTFT();
#endif
if (textMessage.indexOf("ack") == 0 && station != "WLNK-1") { // don't show Winlink ACK
show_display("<<ACK Tx>>", 500);
show_display("<<ACK Tx>>", "", "", 500);
} else if (station.indexOf("CA2RXU-15") == 0 && textMessage.indexOf("wrl") == 0) {
show_display("<WEATHER>","", "--- Sending Query ---", 1000);
wxRequestTime = millis();
@ -502,13 +502,13 @@ namespace MSG_Utils {
winlinkStatus = 0;
} else if ((winlinkStatus == 5) && (lastReceivedPacket.message.indexOf("Log off successful") == -1) && (lastReceivedPacket.message.indexOf("Login valid") == -1) && (lastReceivedPacket.message.indexOf("Login [") == -1) && (lastReceivedPacket.message.indexOf("ack") == -1)) {
lastMsgRxTime = millis();
show_display("<WLNK Rx >", "", lastReceivedPacket.message , "", 3000);
show_display("<WLNK Rx >", "", lastReceivedPacket.message, 3000);
saveNewMessage("WLNK", lastReceivedPacket.sender, lastReceivedPacket.message);
}
} else {
if (!Config.simplifiedTrackerMode) {
lastMsgRxTime = millis();
show_display("< MSG Rx >", "From --> " + lastReceivedPacket.sender, "", lastReceivedPacket.message , 3000);
show_display("< MSG Rx >", "From --> " + lastReceivedPacket.sender, "", lastReceivedPacket.message , "", "", 3000);
if (lastReceivedPacket.message.indexOf("ack") != 0) {
saveNewMessage("APRS", lastReceivedPacket.sender, lastReceivedPacket.message);
}