update to display h and cpp
This commit is contained in:
parent
22203a7c24
commit
39276b0d32
|
|
@ -33,7 +33,7 @@
|
||||||
bool checkModemOn() {
|
bool checkModemOn() {
|
||||||
bool modemReady = false;
|
bool modemReady = false;
|
||||||
Serial.print("Starting Modem ... ");
|
Serial.print("Starting Modem ... ");
|
||||||
show_display(firstLine, "Starting Modem...", " ", " ", 0);
|
displayShow(firstLine, "Starting Modem...", " ", " ", 0);
|
||||||
|
|
||||||
pinMode(A7670_ResetPin, OUTPUT); //A7670 Reset
|
pinMode(A7670_ResetPin, OUTPUT); //A7670 Reset
|
||||||
digitalWrite(A7670_ResetPin, LOW);
|
digitalWrite(A7670_ResetPin, LOW);
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
modemReady = true;
|
modemReady = true;
|
||||||
i = 1;
|
i = 1;
|
||||||
Serial.println("Modem Ready!\n");
|
Serial.println("Modem Ready!\n");
|
||||||
show_display(firstLine, "Starting Modem...", "---> Modem Ready", " ", 0);
|
displayShow(firstLine, "Starting Modem...", "---> Modem Ready", " ", 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
delay(1000);
|
delay(1000);
|
||||||
//setup_gps(); // if gps active / won't be need for now
|
//setup_gps(); // if gps active / won't be need for now
|
||||||
} else {
|
} else {
|
||||||
show_display(firstLine, "Starting Modem...", "---> Failed !!!", " ", 0);
|
displayShow(firstLine, "Starting Modem...", "---> Failed !!!", " ", 0);
|
||||||
Serial.println(F("*********** Failed to connect to the modem! ***********"));
|
Serial.println(F("*********** Failed to connect to the modem! ***********"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,26 +98,26 @@
|
||||||
//Serial.println(response); // DEBUG of Modem AT message
|
//Serial.println(response); // DEBUG of Modem AT message
|
||||||
if(response.indexOf("verified") >= 0) {
|
if(response.indexOf("verified") >= 0) {
|
||||||
Serial.println("Logged! (User Validated)\n");
|
Serial.println("Logged! (User Validated)\n");
|
||||||
show_display(firstLine, "Connecting APRS-IS...", "---> Logged!", " ", 1000);
|
displayShow(firstLine, "Connecting APRS-IS...", "---> Logged!", " ", 1000);
|
||||||
Serial.println("#################### APRS-IS FEED ####################");
|
Serial.println("#################### APRS-IS FEED ####################");
|
||||||
validAT = true;
|
validAT = true;
|
||||||
i = 1;
|
i = 1;
|
||||||
delayATMessage = 0;
|
delayATMessage = 0;
|
||||||
} else if (ATMessage == "AT+NETOPEN" && response.indexOf("OK") >= 0) {
|
} else if (ATMessage == "AT+NETOPEN" && response.indexOf("OK") >= 0) {
|
||||||
Serial.println("Port Open!");
|
Serial.println("Port Open!");
|
||||||
show_display(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
displayShow(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
||||||
validAT = true;
|
validAT = true;
|
||||||
i = 1;
|
i = 1;
|
||||||
delayATMessage = 0;
|
delayATMessage = 0;
|
||||||
} else if (ATMessage == "AT+NETOPEN" && response.indexOf("Network is already opened") >= 0) {
|
} else if (ATMessage == "AT+NETOPEN" && response.indexOf("Network is already opened") >= 0) {
|
||||||
Serial.println("Port Open! (was already opened)");
|
Serial.println("Port Open! (was already opened)");
|
||||||
show_display(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
displayShow(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
||||||
validAT = true;
|
validAT = true;
|
||||||
i = 1;
|
i = 1;
|
||||||
delayATMessage = 0;
|
delayATMessage = 0;
|
||||||
} else if (ATMessage.indexOf("AT+CIPOPEN") == 0 && response.indexOf("PB DONE") >= 0) {
|
} else if (ATMessage.indexOf("AT+CIPOPEN") == 0 && response.indexOf("PB DONE") >= 0) {
|
||||||
Serial.println("Contacted!");
|
Serial.println("Contacted!");
|
||||||
show_display(firstLine, "Connecting APRS-IS...", "---> Contacted", " ", 0);
|
displayShow(firstLine, "Connecting APRS-IS...", "---> Contacted", " ", 0);
|
||||||
validAT = true;
|
validAT = true;
|
||||||
i = 1;
|
i = 1;
|
||||||
delayATMessage = 0;
|
delayATMessage = 0;
|
||||||
|
|
@ -155,17 +155,17 @@
|
||||||
Serial.println("-----> Connecting to APRS IS");
|
Serial.println("-----> Connecting to APRS IS");
|
||||||
while (!modemStartUp) {
|
while (!modemStartUp) {
|
||||||
Serial.print("Opening Port... ");
|
Serial.print("Opening Port... ");
|
||||||
show_display(firstLine, "Opening Port...", " ", " ", 0);
|
displayShow(firstLine, "Opening Port...", " ", " ", 0);
|
||||||
modemStartUp = checkATResponse("AT+NETOPEN");
|
modemStartUp = checkATResponse("AT+NETOPEN");
|
||||||
delay(2000);
|
delay(2000);
|
||||||
} while (!serverStartUp) {
|
} while (!serverStartUp) {
|
||||||
Serial.print("Connecting APRS-IS Server... ");
|
Serial.print("Connecting APRS-IS Server... ");
|
||||||
show_display(firstLine, "Connecting APRS-IS...", " ", " ", 0);
|
displayShow(firstLine, "Connecting APRS-IS...", " ", " ", 0);
|
||||||
serverStartUp = checkATResponse("AT+CIPOPEN=0,\"TCP\",\"" + String(Config.aprs_is.server) + "\"," + String(Config.aprs_is.port));
|
serverStartUp = checkATResponse("AT+CIPOPEN=0,\"TCP\",\"" + String(Config.aprs_is.server) + "\"," + String(Config.aprs_is.port));
|
||||||
delay(2000);
|
delay(2000);
|
||||||
} while (!userBytesSended) {
|
} while (!userBytesSended) {
|
||||||
Serial.print("Writing User Login Data ");
|
Serial.print("Writing User Login Data ");
|
||||||
show_display(firstLine, "Connecting APRS-IS...", "---> User Login Data", " ", 0);
|
displayShow(firstLine, "Connecting APRS-IS...", "---> User Login Data", " ", 0);
|
||||||
userBytesSended = checkATResponse("AT+CIPSEND=0," + String(loginInfo.length()+1));
|
userBytesSended = checkATResponse("AT+CIPSEND=0," + String(loginInfo.length()+1));
|
||||||
delay(2000);
|
delay(2000);
|
||||||
} while (!modemLoggedToAPRSIS) {
|
} while (!modemLoggedToAPRSIS) {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ void setup() {
|
||||||
GPS_Utils::generateBeacons();
|
GPS_Utils::generateBeacons();
|
||||||
|
|
||||||
#ifdef STARTUP_DELAY // (TEST) just to wait for WiFi init of Routers
|
#ifdef STARTUP_DELAY // (TEST) just to wait for WiFi init of Routers
|
||||||
show_display("", " STARTUP DELAY ...", "", "", 0);
|
displayShow("", " STARTUP DELAY ...", "", "", 0);
|
||||||
delay(STARTUP_DELAY * 60 * 1000);
|
delay(STARTUP_DELAY * 60 * 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -181,7 +181,7 @@ void loop() {
|
||||||
|
|
||||||
STATION_Utils::processOutputPacketBuffer();
|
STATION_Utils::processOutputPacketBuffer();
|
||||||
|
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||||
Utils::checkRebootTime();
|
Utils::checkRebootTime();
|
||||||
Utils::checkSleepByLowBatteryVoltage(1);
|
Utils::checkSleepByLowBatteryVoltage(1);
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +77,7 @@ namespace APRS_IS_Utils {
|
||||||
wifiState = "AP";
|
wifiState = "AP";
|
||||||
}
|
}
|
||||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
}
|
}
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +99,7 @@ namespace APRS_IS_Utils {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(aprsisState == "--" && !Config.display.alwaysOn && Config.display.timeout != 0) {
|
if(aprsisState == "--" && !Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -160,11 +160,11 @@ namespace APRS_IS_Utils {
|
||||||
}
|
}
|
||||||
if (receivedMessage.indexOf("?") == 0) {
|
if (receivedMessage.indexOf("?") == 0) {
|
||||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
}
|
}
|
||||||
STATION_Utils::addToOutputPacketBuffer(QUERY_Utils::process(receivedMessage, sender, false, thirdParty));
|
STATION_Utils::addToOutputPacketBuffer(QUERY_Utils::process(receivedMessage, sender, false, thirdParty));
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, "Callsign = " + sender, "TYPE --> QUERY", 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, "Callsign = " + sender, "TYPE --> QUERY", 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -192,7 +192,7 @@ namespace APRS_IS_Utils {
|
||||||
if (!queryMessage) {
|
if (!queryMessage) {
|
||||||
const String& aprsPacket = buildPacketToUpload(packet);
|
const String& aprsPacket = buildPacketToUpload(packet);
|
||||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
}
|
}
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
#ifdef HAS_A7670
|
#ifdef HAS_A7670
|
||||||
|
|
@ -203,7 +203,7 @@ namespace APRS_IS_Utils {
|
||||||
upload(aprsPacket);
|
upload(aprsPacket);
|
||||||
#endif
|
#endif
|
||||||
Utils::println("---> Uploaded to APRS-IS");
|
Utils::println("---> Uploaded to APRS-IS");
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -294,7 +294,7 @@ namespace APRS_IS_Utils {
|
||||||
String queryAnswer = QUERY_Utils::process(receivedMessage, Sender, true, false);
|
String queryAnswer = QUERY_Utils::process(receivedMessage, Sender, true, false);
|
||||||
//Serial.println("---> QUERY Answer : " + queryAnswer.substring(0,queryAnswer.indexOf("\n")));
|
//Serial.println("---> QUERY Answer : " + queryAnswer.substring(0,queryAnswer.indexOf("\n")));
|
||||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
}
|
}
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
@ -318,16 +318,16 @@ namespace APRS_IS_Utils {
|
||||||
Utils::print("Received Message from APRS-IS : " + packet);
|
Utils::print("Received Message from APRS-IS : " + packet);
|
||||||
if (STATION_Utils::wasHeard(Addressee)) {
|
if (STATION_Utils::wasHeard(Addressee)) {
|
||||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 1));
|
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 1));
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
Utils::typeOfPacket(packet, 1); // APRS-LoRa
|
Utils::typeOfPacket(packet, 1); // APRS-LoRa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||||
} else if (Config.aprs_is.objectsToRF && packet.indexOf(":;") > 0) {
|
} else if (Config.aprs_is.objectsToRF && packet.indexOf(":;") > 0) {
|
||||||
Utils::println("Received Object from APRS-IS : " + packet);
|
Utils::println("Received Object from APRS-IS : " + packet);
|
||||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 5));
|
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 5));
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
Utils::typeOfPacket(packet, 1); // APRS-LoRa
|
Utils::typeOfPacket(packet, 1); // APRS-LoRa
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ namespace BME_Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!wxModuleFound) {
|
if (!wxModuleFound) {
|
||||||
show_display("ERROR", "", "BME/BMP/Si7021 sensor active", "but no sensor found...", 2000);
|
displayShow("ERROR", "", "BME/BMP/Si7021 sensor active", "but no sensor found...", 2000);
|
||||||
Serial.println("BME/BMP/Si7021 sensor Active in config but not found! Check Wiring");
|
Serial.println("BME/BMP/Si7021 sensor Active in config but not found! Check Wiring");
|
||||||
} else {
|
} else {
|
||||||
switch (wxModuleType) {
|
switch (wxModuleType) {
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ namespace DIGI_Utils {
|
||||||
} else {
|
} else {
|
||||||
STATION_Utils::addToOutputPacketBuffer(loraPacket);
|
STATION_Utils::addToOutputPacketBuffer(loraPacket);
|
||||||
}
|
}
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ void cleanTFT() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_display() {
|
void displaySetup() {
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
delay(500);
|
delay(500);
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
|
|
@ -83,7 +83,7 @@ void setup_display() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_toggle(bool toggle) {
|
void displayToggle(bool toggle) {
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
if (toggle) {
|
if (toggle) {
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
|
|
@ -128,7 +128,7 @@ bool shouldCleanTFT(const String& header, const String& line1, const String& lin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_display(const String& header, const String& line1, const String& line2, const String& line3, int wait) {
|
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, int wait) {
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
const String* const lines[] = {&line1, &line2, &line3};
|
const String* const lines[] = {&line1, &line2, &line3};
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
|
|
@ -162,7 +162,7 @@ void show_display(const String& header, const String& line1, const String& line2
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_display(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6, int wait) {
|
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6, int wait) {
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
const String* const lines[] = {&line1, &line2, &line3, &line4, &line5, &line6};
|
const String* const lines[] = {&line1, &line2, &line3, &line4, &line5, &line6};
|
||||||
#ifdef HAS_TFT
|
#ifdef HAS_TFT
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@
|
||||||
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
||||||
|
|
||||||
void cleanTFT();
|
void cleanTFT();
|
||||||
void setup_display();
|
void displaySetup();
|
||||||
void display_toggle(bool toggle);
|
void displayToggle(bool toggle);
|
||||||
|
|
||||||
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3);
|
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3);
|
||||||
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6);
|
bool shouldCleanTFT(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6);
|
||||||
|
|
||||||
void show_display(const String& header, const String& line1, const String& line2, const String& line3, int wait = 0);
|
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, int wait = 0);
|
||||||
void show_display(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6, int wait = 0);
|
void displayShow(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, const String& line6, int wait = 0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -57,7 +57,7 @@ namespace GPS_Utils {
|
||||||
|
|
||||||
void generateBeacons() {
|
void generateBeacons() {
|
||||||
if (Config.callsign.indexOf("NOCALL-10") != 0 && !Utils::checkValidCallsign(Config.callsign)) {
|
if (Config.callsign.indexOf("NOCALL-10") != 0 && !Utils::checkValidCallsign(Config.callsign)) {
|
||||||
show_display("***** ERROR ******", "CALLSIGN = NOT VALID!", "", "Only Rx Mode Active", 3000);
|
displayShow("***** ERROR ******", "CALLSIGN = NOT VALID!", "", "Only Rx Mode Active", 3000);
|
||||||
Config.loramodule.txActive = false;
|
Config.loramodule.txActive = false;
|
||||||
Config.aprs_is.messagesToRF = false;
|
Config.aprs_is.messagesToRF = false;
|
||||||
Config.aprs_is.objectsToRF = false;
|
Config.aprs_is.objectsToRF = false;
|
||||||
|
|
|
||||||
|
|
@ -29,31 +29,31 @@ namespace OTA_Utils {
|
||||||
|
|
||||||
void onOTAStart() {
|
void onOTAStart() {
|
||||||
Serial.println("OTA update started!");
|
Serial.println("OTA update started!");
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
show_display("", "", "", " OTA update started!", "", "", "", 1000);
|
displayShow("", "", "", " OTA update started!", "", "", "", 1000);
|
||||||
isUpdatingOTA = true;
|
isUpdatingOTA = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onOTAProgress(size_t current, size_t final) {
|
void onOTAProgress(size_t current, size_t final) {
|
||||||
if (millis() - ota_progress_millis > 1000) {
|
if (millis() - ota_progress_millis > 1000) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
ota_progress_millis = millis();
|
ota_progress_millis = millis();
|
||||||
Serial.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
|
Serial.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
|
||||||
show_display("", "", " OTA Progress : " + String((current*100)/final) + "%", "", "", "", "", 100);
|
displayShow("", "", " OTA Progress : " + String((current*100)/final) + "%", "", "", "", "", 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onOTAEnd(bool success) {
|
void onOTAEnd(bool success) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
if (success) {
|
if (success) {
|
||||||
Serial.println("OTA update finished successfully!");
|
Serial.println("OTA update finished successfully!");
|
||||||
show_display("", "", " OTA update success!", "", " Rebooting ...", "", "", 4000);
|
displayShow("", "", " OTA update success!", "", " Rebooting ...", "", "", 4000);
|
||||||
} else {
|
} else {
|
||||||
Serial.println("There was an error during OTA update!");
|
Serial.println("There was an error during OTA update!");
|
||||||
show_display("", "", " OTA update fail!", "", "", "", "", 4000);
|
displayShow("", "", " OTA update fail!", "", "", "", "", 4000);
|
||||||
}
|
}
|
||||||
isUpdatingOTA = false;
|
isUpdatingOTA = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,12 +79,12 @@ namespace Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupDisplay() {
|
void setupDisplay() {
|
||||||
setup_display();
|
displaySetup();
|
||||||
#ifdef INTERNAL_LED_PIN
|
#ifdef INTERNAL_LED_PIN
|
||||||
digitalWrite(INTERNAL_LED_PIN,HIGH);
|
digitalWrite(INTERNAL_LED_PIN,HIGH);
|
||||||
#endif
|
#endif
|
||||||
Serial.println("\nStarting Station: " + Config.callsign + " Version: " + versionDate);
|
Serial.println("\nStarting Station: " + Config.callsign + " Version: " + versionDate);
|
||||||
show_display(" LoRa APRS", "", " ( iGATE & DIGI )", "", "", "Richonguzman / CA2RXU", " " + versionDate, 4000);
|
displayShow(" LoRa APRS", "", "", " ( iGATE & DIGI )", "", "" , " CA2RXU " + versionDate, 4000);
|
||||||
#ifdef INTERNAL_LED_PIN
|
#ifdef INTERNAL_LED_PIN
|
||||||
digitalWrite(INTERNAL_LED_PIN,LOW);
|
digitalWrite(INTERNAL_LED_PIN,LOW);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -110,7 +110,7 @@ namespace Utils {
|
||||||
|
|
||||||
if (beaconUpdate) {
|
if (beaconUpdate) {
|
||||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||||
display_toggle(true);
|
displayToggle(true);
|
||||||
}
|
}
|
||||||
Utils::println("-- Sending Beacon to APRSIS --");
|
Utils::println("-- Sending Beacon to APRSIS --");
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ namespace Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.aprs_is.active && Config.beacon.sendViaAPRSIS && !backUpDigiMode) {
|
if (Config.aprs_is.active && Config.beacon.sendViaAPRSIS && !backUpDigiMode) {
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING IGATE BEACON", 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING IGATE BEACON", 0);
|
||||||
seventhLine = " listening...";
|
seventhLine = " listening...";
|
||||||
#ifdef HAS_A7670
|
#ifdef HAS_A7670
|
||||||
A7670_Utils::uploadToAPRSIS(beaconPacket);
|
A7670_Utils::uploadToAPRSIS(beaconPacket);
|
||||||
|
|
@ -182,7 +182,7 @@ namespace Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.beacon.sendViaRF || backUpDigiMode) {
|
if (Config.beacon.sendViaRF || backUpDigiMode) {
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING DIGI BEACON", 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING DIGI BEACON", 0);
|
||||||
seventhLine = " listening...";
|
seventhLine = " listening...";
|
||||||
STATION_Utils::addToOutputPacketBuffer(secondaryBeaconPacket);
|
STATION_Utils::addToOutputPacketBuffer(secondaryBeaconPacket);
|
||||||
}
|
}
|
||||||
|
|
@ -200,14 +200,14 @@ namespace Utils {
|
||||||
void checkDisplayInterval() {
|
void checkDisplayInterval() {
|
||||||
uint32_t lastDisplayTime = millis() - lastScreenOn;
|
uint32_t lastDisplayTime = millis() - lastScreenOn;
|
||||||
if (!Config.display.alwaysOn && lastDisplayTime >= Config.display.timeout * 1000) {
|
if (!Config.display.alwaysOn && lastDisplayTime >= Config.display.timeout * 1000) {
|
||||||
display_toggle(false);
|
displayToggle(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateFreqs() {
|
void validateFreqs() {
|
||||||
if (Config.loramodule.txFreq != Config.loramodule.rxFreq && abs(Config.loramodule.txFreq - Config.loramodule.rxFreq) < 125000) {
|
if (Config.loramodule.txFreq != Config.loramodule.rxFreq && abs(Config.loramodule.txFreq - Config.loramodule.rxFreq) < 125000) {
|
||||||
Serial.println("Tx Freq less than 125kHz from Rx Freq ---> NOT VALID");
|
Serial.println("Tx Freq less than 125kHz from Rx Freq ---> NOT VALID");
|
||||||
show_display("Tx Freq is less than ", "125kHz from Rx Freq", "device will autofix", "and then reboot", 1000);
|
displayShow("Tx Freq is less than ", "125kHz from Rx Freq", "device will autofix", "and then reboot", 1000);
|
||||||
Config.loramodule.txFreq = Config.loramodule.rxFreq; // Inform about that but then change the TX QRG to RX QRG and reset the device
|
Config.loramodule.txFreq = Config.loramodule.rxFreq; // Inform about that but then change the TX QRG to RX QRG and reset the device
|
||||||
Config.writeFile();
|
Config.writeFile();
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
|
|
@ -313,7 +313,7 @@ namespace Utils {
|
||||||
Serial.println("\n\n*** Sleeping Low Battey Voltage ***\n\n");
|
Serial.println("\n\n*** Sleeping Low Battey Voltage ***\n\n");
|
||||||
esp_sleep_enable_timer_wakeup(30 * 60 * 1000000); // sleep 30 min
|
esp_sleep_enable_timer_wakeup(30 * 60 * 1000000); // sleep 30 min
|
||||||
if (mode == 1) {
|
if (mode == 1) {
|
||||||
display_toggle(false);
|
displayToggle(false);
|
||||||
}
|
}
|
||||||
#ifdef VEXT_CTRL
|
#ifdef VEXT_CTRL
|
||||||
#ifndef HELTEC_WSL_V3
|
#ifndef HELTEC_WSL_V3
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ namespace WEB_Utils {
|
||||||
AsyncWebServerResponse *response = request->beginResponse(302, "text/html", "");
|
AsyncWebServerResponse *response = request->beginResponse(302, "text/html", "");
|
||||||
response->addHeader("Location", "/");
|
response->addHeader("Location", "/");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
display_toggle(false);
|
displayToggle(false);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ namespace WEB_Utils {
|
||||||
|
|
||||||
request->send(200, "text/plain", "Beacon will be sent in a while");
|
request->send(200, "text/plain", "Beacon will be sent in a while");
|
||||||
} else if (type == "reboot") {
|
} else if (type == "reboot") {
|
||||||
display_toggle(false);
|
displayToggle(false);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
} else {
|
} else {
|
||||||
request->send(404, "text/plain", "Not Found");
|
request->send(404, "text/plain", "Not Found");
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ namespace WIFI_Utils {
|
||||||
WiFi.disconnect();
|
WiFi.disconnect();
|
||||||
delay(500);
|
delay(500);
|
||||||
unsigned long start = millis();
|
unsigned long start = millis();
|
||||||
show_display("", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
displayShow("", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
||||||
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
||||||
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||||
while (WiFi.status() != WL_CONNECTED && wifiCounter<myWiFiAPSize) {
|
while (WiFi.status() != WL_CONNECTED && wifiCounter<myWiFiAPSize) {
|
||||||
|
|
@ -99,7 +99,7 @@ namespace WIFI_Utils {
|
||||||
currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||||
start = millis();
|
start = millis();
|
||||||
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
||||||
show_display("", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
displayShow("", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
||||||
WiFi.disconnect();
|
WiFi.disconnect();
|
||||||
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -113,17 +113,17 @@ namespace WIFI_Utils {
|
||||||
Serial.print(WiFi.localIP());
|
Serial.print(WiFi.localIP());
|
||||||
Serial.print(" / MAC Address: ");
|
Serial.print(" / MAC Address: ");
|
||||||
Serial.println(WiFi.macAddress());
|
Serial.println(WiFi.macAddress());
|
||||||
show_display("", " Connected!!", "" , " loading ...", 1000);
|
displayShow("", " Connected!!", "" , " loading ...", 1000);
|
||||||
} else if (WiFi.status() != WL_CONNECTED) {
|
} else if (WiFi.status() != WL_CONNECTED) {
|
||||||
startAP = true;
|
startAP = true;
|
||||||
|
|
||||||
Serial.println("\nNot connected to WiFi! Starting Auto AP");
|
Serial.println("\nNot connected to WiFi! Starting Auto AP");
|
||||||
show_display("", " WiFi Not Connected!", "" , " loading ...", 1000);
|
displayShow("", " WiFi Not Connected!", "" , " loading ...", 1000);
|
||||||
}
|
}
|
||||||
WiFiConnected = !startAP;
|
WiFiConnected = !startAP;
|
||||||
if (startAP) {
|
if (startAP) {
|
||||||
Serial.println("\nNot connected to WiFi! Starting Auto AP");
|
Serial.println("\nNot connected to WiFi! Starting Auto AP");
|
||||||
show_display("", " Starting Auto AP", " Please connect to it " , " loading ...", 1000);
|
displayShow("", " Starting Auto AP", " Please connect to it " , " loading ...", 1000);
|
||||||
|
|
||||||
startAutoAP();
|
startAutoAP();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue