diff --git a/src/aprs_is_utils.cpp b/src/aprs_is_utils.cpp index c43ab927..41e27656 100644 --- a/src/aprs_is_utils.cpp +++ b/src/aprs_is_utils.cpp @@ -160,7 +160,7 @@ namespace APRS_IS_Utils { Sender = packet.substring(3, packet.indexOf(">")); if (Sender != Config.callsign) { // avoid listening yourself by digirepeating STATION_Utils::updateLastHeard(Sender); - Utils::typeOfPacket(aprsPacket, "LoRa-APRS"); + Utils::typeOfPacket(packet, "LoRa-APRS"); AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2); Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":")); Addressee.trim(); diff --git a/src/digi_utils.cpp b/src/digi_utils.cpp index 8b23dd64..81557361 100644 --- a/src/digi_utils.cpp +++ b/src/digi_utils.cpp @@ -65,7 +65,7 @@ namespace DIGI_Utils { Sender = packet.substring(3, packet.indexOf(">")); if (Sender != Config.callsign) { STATION_Utils::updateLastHeard(Sender); - Utils::typeOfPacket(packet.substring(3), "Digi"); + Utils::typeOfPacket(packet, "Digi"); AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2); Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":")); Addressee.trim(); diff --git a/src/display.cpp b/src/display.cpp index 79bf4b56..0000d18e 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -35,33 +35,6 @@ void cleanTFT() { #endif } -bool shouldCleanTFT3(String header, String line1, String line2, String line3) { - if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3) { - oldHeader = header; - oldFirstLine = line1; - oldSecondLine = line2; - oldThirdLine = line3; - return true; - } else { - return false; - } -} - -bool shouldCleanTFT6(String header, String line1, String line2, String line3, String line4, String line5, String line6) { - if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3 || oldFourthLine != line4 || oldFifthLine != line5 || oldSixthLine != line6) { - oldHeader = header; - oldFirstLine = line1; - oldSecondLine = line2; - oldThirdLine = line3; - oldFourthLine = line4; - oldFifthLine = line5; - oldSixthLine = line6; - return true; - } else { - return false; - } -} - void setup_display() { #ifdef HAS_DISPLAY delay(500); @@ -117,90 +90,37 @@ void display_toggle(bool toggle) { #endif } -void show_display(String header, int wait) { - #ifdef HAS_DISPLAY - #ifdef HAS_TFT - cleanTFT(); - tft.setTextColor(TFT_WHITE,TFT_BLACK); - tft.setTextSize(bigSizeFont); - tft.setCursor(0, 0); - tft.print(header); - #else - display.clearDisplay(); - display.setTextColor(WHITE); - display.setTextSize(1); - display.setCursor(0, 0); - display.println(header); - display.ssd1306_command(SSD1306_SETCONTRAST); - display.ssd1306_command(1); - display.display(); - #endif - delay(wait); - #endif -} - -void show_display(String header, String line1, int wait) { - #ifdef HAS_DISPLAY - #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(header); - #else - display.clearDisplay(); - display.setTextColor(WHITE); - display.setTextSize(1); - display.setCursor(0, 0); - display.println(header); - display.setCursor(0, 8); - display.println(line1); - display.ssd1306_command(SSD1306_SETCONTRAST); - display.ssd1306_command(1); - display.display(); - #endif - delay(wait); - #endif +bool shouldCleanTFT(String header, String line1, String line2, String line3) { + if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3) { + oldHeader = header; + oldFirstLine = line1; + oldSecondLine = line2; + oldThirdLine = line3; + return true; + } else { + return false; + } } -void show_display(String header, String line1, String line2, int wait) { - #ifdef HAS_DISPLAY - #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); - #else - display.clearDisplay(); - display.setTextColor(WHITE); - display.setTextSize(1); - display.setCursor(0, 0); - display.println(header); - display.setCursor(0, 8); - display.println(line1); - display.setCursor(0, 16); - display.println(line2); - display.ssd1306_command(SSD1306_SETCONTRAST); - display.ssd1306_command(1); - display.display(); - #endif - delay(wait); - #endif +bool shouldCleanTFT(String header, String line1, String line2, String line3, String line4, String line5, String line6) { + if (oldHeader != header || oldFirstLine != line1 || oldSecondLine != line2 || oldThirdLine != line3 || oldFourthLine != line4 || oldFifthLine != line5 || oldSixthLine != line6) { + oldHeader = header; + oldFirstLine = line1; + oldSecondLine = line2; + oldThirdLine = line3; + oldFourthLine = line4; + oldFifthLine = line5; + oldSixthLine = line6; + return true; + } else { + return false; + } } void show_display(String header, String line1, String line2, String line3, int wait) { #ifdef HAS_DISPLAY #ifdef HAS_TFT - if (shouldCleanTFT3(header, line1, line2, line3)) { + if (shouldCleanTFT(header, line1, line2, line3)) { cleanTFT(); } tft.setTextColor(TFT_WHITE,TFT_BLACK); @@ -234,92 +154,10 @@ void show_display(String header, String line1, String line2, String line3, int w #endif } -void show_display(String header, String line1, String line2, String line3, String line4, int wait) { - #ifdef HAS_DISPLAY - #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(); - display.setTextColor(WHITE); - display.setTextSize(1); - display.setCursor(0, 0); - display.println(header); - display.setCursor(0, 8); - display.println(line1); - display.setCursor(0, 16); - display.println(line2); - display.setCursor(0, 24); - display.println(line3); - display.setCursor(0, 32); - display.println(line4); - display.ssd1306_command(SSD1306_SETCONTRAST); - display.ssd1306_command(1); - display.display(); - #endif - delay(wait); - #endif -} - -void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait) { - #ifdef HAS_DISPLAY - #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); - tft.setCursor(0, ((lineSpacing * 6) - 2)); - tft.print(line5); - #else - display.clearDisplay(); - display.setTextColor(WHITE); - display.setTextSize(1); - display.setCursor(0, 0); - display.println(header); - display.setCursor(0, 8); - display.println(line1); - display.setCursor(0, 16); - display.println(line2); - display.setCursor(0, 24); - display.println(line3); - display.setCursor(0, 32); - display.println(line4); - display.setCursor(0, 40); - display.println(line5); - display.ssd1306_command(SSD1306_SETCONTRAST); - display.ssd1306_command(1); - display.display(); - #endif - delay(wait); - #endif -} - void show_display(String header, String line1, String line2, String line3, String line4, String line5, String line6, int wait) { #ifdef HAS_DISPLAY #ifdef HAS_TFT - if (shouldCleanTFT6(header, line1, line2, line3, line4, line5, line6)) { + if (shouldCleanTFT(header, line1, line2, line3, line4, line5, line6)) { cleanTFT(); } tft.setTextColor(TFT_WHITE,TFT_BLACK); diff --git a/src/display.h b/src/display.h index 4f25f844..2f6286ff 100644 --- a/src/display.h +++ b/src/display.h @@ -6,17 +6,13 @@ #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 void cleanTFT(); -bool shouldCleanTFT3(String header, String line1, String line2, String line3); -bool shouldCleanTFT6(String header, String line1, String line2, String line3, String line4, String line5, String line6); void setup_display(); void display_toggle(bool toggle); -/*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);*/ +bool shouldCleanTFT(String header, String line1, String line2, String line3); +bool shouldCleanTFT(String header, String line1, String line2, String line3, String line4, String line5, String line6); + 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 show_display(String header, String line1, String line2, String line3, String line4, String line5, String line6, int wait = 0); #endif \ No newline at end of file