mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-28 16:52:33 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fb4712a33 | ||
|
|
39276b0d32 | ||
|
|
22203a7c24 | ||
|
|
d8d832fde9 |
@@ -33,7 +33,7 @@
|
||||
bool checkModemOn() {
|
||||
bool modemReady = false;
|
||||
Serial.print("Starting Modem ... ");
|
||||
show_display(firstLine, "Starting Modem...", " ", " ", 0);
|
||||
displayShow(firstLine, "Starting Modem...", " ", " ", 0);
|
||||
|
||||
pinMode(A7670_ResetPin, OUTPUT); //A7670 Reset
|
||||
digitalWrite(A7670_ResetPin, LOW);
|
||||
@@ -60,7 +60,7 @@
|
||||
modemReady = true;
|
||||
i = 1;
|
||||
Serial.println("Modem Ready!\n");
|
||||
show_display(firstLine, "Starting Modem...", "---> Modem Ready", " ", 0);
|
||||
displayShow(firstLine, "Starting Modem...", "---> Modem Ready", " ", 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@
|
||||
delay(1000);
|
||||
//setup_gps(); // if gps active / won't be need for now
|
||||
} else {
|
||||
show_display(firstLine, "Starting Modem...", "---> Failed !!!", " ", 0);
|
||||
displayShow(firstLine, "Starting Modem...", "---> Failed !!!", " ", 0);
|
||||
Serial.println(F("*********** Failed to connect to the modem! ***********"));
|
||||
}
|
||||
}
|
||||
@@ -98,26 +98,26 @@
|
||||
//Serial.println(response); // DEBUG of Modem AT message
|
||||
if(response.indexOf("verified") >= 0) {
|
||||
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 ####################");
|
||||
validAT = true;
|
||||
i = 1;
|
||||
delayATMessage = 0;
|
||||
} else if (ATMessage == "AT+NETOPEN" && response.indexOf("OK") >= 0) {
|
||||
Serial.println("Port Open!");
|
||||
show_display(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
||||
displayShow(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
||||
validAT = true;
|
||||
i = 1;
|
||||
delayATMessage = 0;
|
||||
} else if (ATMessage == "AT+NETOPEN" && response.indexOf("Network is already opened") >= 0) {
|
||||
Serial.println("Port Open! (was already opened)");
|
||||
show_display(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
||||
displayShow(firstLine, "Opening Port...", "---> Port Open", " ", 0);
|
||||
validAT = true;
|
||||
i = 1;
|
||||
delayATMessage = 0;
|
||||
} else if (ATMessage.indexOf("AT+CIPOPEN") == 0 && response.indexOf("PB DONE") >= 0) {
|
||||
Serial.println("Contacted!");
|
||||
show_display(firstLine, "Connecting APRS-IS...", "---> Contacted", " ", 0);
|
||||
displayShow(firstLine, "Connecting APRS-IS...", "---> Contacted", " ", 0);
|
||||
validAT = true;
|
||||
i = 1;
|
||||
delayATMessage = 0;
|
||||
@@ -155,17 +155,17 @@
|
||||
Serial.println("-----> Connecting to APRS IS");
|
||||
while (!modemStartUp) {
|
||||
Serial.print("Opening Port... ");
|
||||
show_display(firstLine, "Opening Port...", " ", " ", 0);
|
||||
displayShow(firstLine, "Opening Port...", " ", " ", 0);
|
||||
modemStartUp = checkATResponse("AT+NETOPEN");
|
||||
delay(2000);
|
||||
} while (!serverStartUp) {
|
||||
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));
|
||||
delay(2000);
|
||||
} while (!userBytesSended) {
|
||||
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));
|
||||
delay(2000);
|
||||
} while (!modemLoggedToAPRSIS) {
|
||||
|
||||
@@ -38,7 +38,7 @@ ________________________________________________________________________________
|
||||
#include "A7670_utils.h"
|
||||
#endif
|
||||
|
||||
String versionDate = "2024.08.13";
|
||||
String versionDate = "2024.08.14";
|
||||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
|
||||
@@ -63,13 +63,12 @@ void setup() {
|
||||
POWER_Utils::setup();
|
||||
BATTERY_Utils::setup();
|
||||
Utils::setupDisplay();
|
||||
Config.check();
|
||||
LoRa_Utils::setup();
|
||||
Utils::validateFreqs();
|
||||
GPS_Utils::generateBeacons();
|
||||
|
||||
#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);
|
||||
#endif
|
||||
|
||||
@@ -163,7 +162,7 @@ void loop() {
|
||||
APRS_IS_Utils::processLoRaPacket(packet); // Send received packet to APRSIS
|
||||
}
|
||||
|
||||
if (Config.digi.mode == 2 || Config.digi.mode == 3 || backUpDigiMode) { // If Digi enabled
|
||||
if (Config.loramodule.txActive && (Config.digi.mode == 2 || Config.digi.mode == 3 || backUpDigiMode)) { // If Digi enabled
|
||||
STATION_Utils::clean25SegBuffer();
|
||||
DIGI_Utils::processLoRaPacket(packet); // Send received packet to Digi
|
||||
}
|
||||
@@ -182,7 +181,7 @@ void loop() {
|
||||
|
||||
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::checkSleepByLowBatteryVoltage(1);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace APRS_IS_Utils {
|
||||
wifiState = "AP";
|
||||
}
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
}
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace APRS_IS_Utils {
|
||||
}
|
||||
#endif
|
||||
if(aprsisState == "--" && !Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
}
|
||||
@@ -160,11 +160,11 @@ namespace APRS_IS_Utils {
|
||||
}
|
||||
if (receivedMessage.indexOf("?") == 0) {
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
}
|
||||
STATION_Utils::addToOutputPacketBuffer(QUERY_Utils::process(receivedMessage, sender, false, thirdParty));
|
||||
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;
|
||||
}
|
||||
else {
|
||||
@@ -192,7 +192,7 @@ namespace APRS_IS_Utils {
|
||||
if (!queryMessage) {
|
||||
const String& aprsPacket = buildPacketToUpload(packet);
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
}
|
||||
lastScreenOn = millis();
|
||||
#ifdef HAS_A7670
|
||||
@@ -203,7 +203,7 @@ namespace APRS_IS_Utils {
|
||||
upload(aprsPacket);
|
||||
#endif
|
||||
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);
|
||||
//Serial.println("---> QUERY Answer : " + queryAnswer.substring(0,queryAnswer.indexOf("\n")));
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
}
|
||||
lastScreenOn = millis();
|
||||
delay(500);
|
||||
@@ -318,16 +318,16 @@ namespace APRS_IS_Utils {
|
||||
Utils::print("Received Message from APRS-IS : " + packet);
|
||||
if (STATION_Utils::wasHeard(Addressee)) {
|
||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 1));
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
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) {
|
||||
Utils::println("Received Object from APRS-IS : " + packet);
|
||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 5));
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
Utils::typeOfPacket(packet, 1); // APRS-LoRa
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace BME_Utils {
|
||||
}
|
||||
}
|
||||
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");
|
||||
} else {
|
||||
switch (wxModuleType) {
|
||||
|
||||
@@ -4,16 +4,6 @@
|
||||
#include "display.h"
|
||||
|
||||
|
||||
void Configuration::check() {
|
||||
if (reload) {
|
||||
show_display("------- UPDATE ------", "config is old", "device will update", "and then reboot", 1000);
|
||||
|
||||
writeFile();
|
||||
|
||||
ESP.restart();
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::writeFile() {
|
||||
Serial.println("Saving config..");
|
||||
|
||||
@@ -27,43 +17,43 @@ void Configuration::writeFile() {
|
||||
}
|
||||
}
|
||||
|
||||
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
||||
data["wifi"]["autoAP"]["powerOff"] = wifiAutoAP.powerOff;
|
||||
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
||||
data["wifi"]["autoAP"]["powerOff"] = wifiAutoAP.powerOff;
|
||||
|
||||
data["callsign"] = callsign;
|
||||
data["callsign"] = callsign;
|
||||
|
||||
data["aprs_is"]["active"] = aprs_is.active;
|
||||
data["aprs_is"]["passcode"] = aprs_is.passcode;
|
||||
data["aprs_is"]["server"] = aprs_is.server;
|
||||
data["aprs_is"]["port"] = aprs_is.port;
|
||||
data["aprs_is"]["filter"] = aprs_is.filter;
|
||||
data["aprs_is"]["messagesToRF"] = aprs_is.messagesToRF;
|
||||
data["aprs_is"]["objectsToRF"] = aprs_is.objectsToRF;
|
||||
data["aprs_is"]["active"] = aprs_is.active;
|
||||
data["aprs_is"]["passcode"] = aprs_is.passcode;
|
||||
data["aprs_is"]["server"] = aprs_is.server;
|
||||
data["aprs_is"]["port"] = aprs_is.port;
|
||||
data["aprs_is"]["filter"] = aprs_is.filter;
|
||||
data["aprs_is"]["messagesToRF"] = aprs_is.messagesToRF;
|
||||
data["aprs_is"]["objectsToRF"] = aprs_is.objectsToRF;
|
||||
|
||||
data["beacon"]["comment"] = beacon.comment;
|
||||
data["beacon"]["interval"] = beacon.interval;
|
||||
data["beacon"]["latitude"] = beacon.latitude;
|
||||
data["beacon"]["longitude"] = beacon.longitude;
|
||||
data["beacon"]["overlay"] = beacon.overlay;
|
||||
data["beacon"]["symbol"] = beacon.symbol;
|
||||
data["beacon"]["sendViaAPRSIS"] = beacon.sendViaAPRSIS;
|
||||
data["beacon"]["sendViaRF"] = beacon.sendViaRF;
|
||||
data["beacon"]["path"] = beacon.path;
|
||||
data["beacon"]["comment"] = beacon.comment;
|
||||
data["beacon"]["interval"] = beacon.interval;
|
||||
data["beacon"]["latitude"] = beacon.latitude;
|
||||
data["beacon"]["longitude"] = beacon.longitude;
|
||||
data["beacon"]["overlay"] = beacon.overlay;
|
||||
data["beacon"]["symbol"] = beacon.symbol;
|
||||
data["beacon"]["sendViaAPRSIS"] = beacon.sendViaAPRSIS;
|
||||
data["beacon"]["sendViaRF"] = beacon.sendViaRF;
|
||||
data["beacon"]["path"] = beacon.path;
|
||||
|
||||
data["digi"]["mode"] = digi.mode;
|
||||
data["digi"]["mode"] = digi.mode;
|
||||
|
||||
data["lora"]["rxFreq"] = loramodule.rxFreq;
|
||||
data["lora"]["txFreq"] = loramodule.txFreq;
|
||||
data["lora"]["spreadingFactor"] = loramodule.spreadingFactor;
|
||||
data["lora"]["signalBandwidth"] = loramodule.signalBandwidth;
|
||||
data["lora"]["codingRate4"] = loramodule.codingRate4;
|
||||
data["lora"]["power"] = loramodule.power;
|
||||
data["lora"]["txActive"] = loramodule.txActive;
|
||||
data["lora"]["rxActive"] = loramodule.rxActive;
|
||||
data["lora"]["rxFreq"] = loramodule.rxFreq;
|
||||
data["lora"]["txFreq"] = loramodule.txFreq;
|
||||
data["lora"]["spreadingFactor"] = loramodule.spreadingFactor;
|
||||
data["lora"]["signalBandwidth"] = loramodule.signalBandwidth;
|
||||
data["lora"]["codingRate4"] = loramodule.codingRate4;
|
||||
data["lora"]["power"] = loramodule.power;
|
||||
data["lora"]["txActive"] = loramodule.txActive;
|
||||
data["lora"]["rxActive"] = loramodule.rxActive;
|
||||
|
||||
data["display"]["alwaysOn"] = display.alwaysOn;
|
||||
data["display"]["timeout"] = display.timeout;
|
||||
data["display"]["turn180"] = display.turn180;
|
||||
data["display"]["alwaysOn"] = display.alwaysOn;
|
||||
data["display"]["timeout"] = display.timeout;
|
||||
data["display"]["turn180"] = display.turn180;
|
||||
|
||||
data["battery"]["sendInternalVoltage"] = battery.sendInternalVoltage;
|
||||
data["battery"]["monitorInternalVoltage"] = battery.monitorInternalVoltage;
|
||||
@@ -73,40 +63,39 @@ void Configuration::writeFile() {
|
||||
data["battery"]["externalVoltagePin"] = battery.externalVoltagePin;
|
||||
data["battery"]["monitorExternalVoltage"] = battery.monitorExternalVoltage;
|
||||
data["battery"]["externalSleepVoltage"] = battery.externalSleepVoltage;
|
||||
data["battery"]["voltageDividerR1"] = battery.voltageDividerR1;
|
||||
data["battery"]["voltageDividerR2"] = battery.voltageDividerR2;
|
||||
data["battery"]["voltageDividerR1"] = battery.voltageDividerR1;
|
||||
data["battery"]["voltageDividerR2"] = battery.voltageDividerR2;
|
||||
|
||||
data["bme"]["active"] = bme.active;
|
||||
data["bme"]["heightCorrection"] = bme.heightCorrection;
|
||||
data["bme"]["temperatureCorrection"] = bme.temperatureCorrection;
|
||||
|
||||
data["bme"]["active"] = bme.active;
|
||||
data["bme"]["heightCorrection"] = bme.heightCorrection;
|
||||
data["bme"]["temperatureCorrection"] = bme.temperatureCorrection;
|
||||
data["syslog"]["active"] = syslog.active;
|
||||
data["syslog"]["server"] = syslog.server;
|
||||
data["syslog"]["port"] = syslog.port;
|
||||
|
||||
data["syslog"]["active"] = syslog.active;
|
||||
data["syslog"]["server"] = syslog.server;
|
||||
data["syslog"]["port"] = syslog.port;
|
||||
data["tnc"]["enableServer"] = tnc.enableServer;
|
||||
data["tnc"]["enableSerial"] = tnc.enableSerial;
|
||||
data["tnc"]["acceptOwn"] = tnc.acceptOwn;
|
||||
|
||||
data["tnc"]["enableServer"] = tnc.enableServer;
|
||||
data["tnc"]["enableSerial"] = tnc.enableSerial;
|
||||
data["tnc"]["acceptOwn"] = tnc.acceptOwn;
|
||||
data["other"]["rebootMode"] = rebootMode;
|
||||
data["other"]["rebootModeTime"] = rebootModeTime;
|
||||
|
||||
data["other"]["rebootMode"] = rebootMode;
|
||||
data["other"]["rebootModeTime"] = rebootModeTime;
|
||||
|
||||
data["ota"]["username"] = ota.username;
|
||||
data["ota"]["password"] = ota.password;
|
||||
data["ota"]["username"] = ota.username;
|
||||
data["ota"]["password"] = ota.password;
|
||||
|
||||
data["other"]["rememberStationTime"] = rememberStationTime;
|
||||
|
||||
data["other"]["backupDigiMode"] = backupDigiMode;
|
||||
data["other"]["backupDigiMode"] = backupDigiMode;
|
||||
|
||||
data["other"]["lowPowerMode"] = lowPowerMode;
|
||||
data["other"]["lowVoltageCutOff"] = lowVoltageCutOff;
|
||||
data["other"]["lowPowerMode"] = lowPowerMode;
|
||||
data["other"]["lowVoltageCutOff"] = lowVoltageCutOff;
|
||||
|
||||
data["personalNote"] = personalNote;
|
||||
data["personalNote"] = personalNote;
|
||||
|
||||
data["webadmin"]["active"] = webadmin.active;
|
||||
data["webadmin"]["username"] = webadmin.username;
|
||||
data["webadmin"]["password"] = webadmin.password;
|
||||
data["webadmin"]["active"] = webadmin.active;
|
||||
data["webadmin"]["username"] = webadmin.username;
|
||||
data["webadmin"]["password"] = webadmin.password;
|
||||
|
||||
serializeJson(data, configFile);
|
||||
|
||||
@@ -137,137 +126,84 @@ bool Configuration::readFile() {
|
||||
wifiAPs.push_back(wifiap);
|
||||
}
|
||||
|
||||
wifiAutoAP.password = data["wifi"]["autoAP"]["password"].as<String>();
|
||||
wifiAutoAP.powerOff = data["wifi"]["autoAP"]["powerOff"].as<int>();
|
||||
wifiAutoAP.password = data["wifi"]["autoAP"]["password"] | "1234567890";
|
||||
wifiAutoAP.powerOff = data["wifi"]["autoAP"]["powerOff"] | 10;
|
||||
|
||||
callsign = data["callsign"].as<String>();
|
||||
rememberStationTime = data["other"]["rememberStationTime"].as<int>();
|
||||
callsign = data["callsign"] | "NOCALL-10";
|
||||
rememberStationTime = data["other"]["rememberStationTime"] | 30;
|
||||
|
||||
battery.sendInternalVoltage = data["battery"]["sendInternalVoltage"].as<bool>();
|
||||
battery.monitorInternalVoltage = data["battery"]["monitorInternalVoltage"].as<bool>();
|
||||
battery.internalSleepVoltage = data["battery"]["internalSleepVoltage"].as<float>();
|
||||
|
||||
battery.sendExternalVoltage = data["battery"]["sendExternalVoltage"].as<bool>();
|
||||
battery.externalVoltagePin = data["battery"]["externalVoltagePin"].as<int>();
|
||||
battery.monitorExternalVoltage = data["battery"]["monitorExternalVoltage"].as<bool>();
|
||||
battery.externalSleepVoltage = data["battery"]["externalSleepVoltage"].as<float>();
|
||||
battery.voltageDividerR1 = data["battery"]["voltageDividerR1"].as<float>();
|
||||
battery.voltageDividerR2 = data["battery"]["voltageDividerR2"].as<float>();
|
||||
|
||||
aprs_is.passcode = data["aprs_is"]["passcode"].as<String>();
|
||||
aprs_is.server = data["aprs_is"]["server"].as<String>();
|
||||
aprs_is.port = data["aprs_is"]["port"].as<int>();
|
||||
|
||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
||||
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>();
|
||||
loramodule.power = data["lora"]["power"].as<int>();
|
||||
|
||||
display.alwaysOn = data["display"]["alwaysOn"].as<bool>();
|
||||
display.timeout = data["display"]["timeout"].as<int>();
|
||||
display.turn180 = data["display"]["turn180"].as<bool>();
|
||||
|
||||
syslog.active = data["syslog"]["active"].as<bool>();
|
||||
syslog.server = data["syslog"]["server"].as<String>();
|
||||
syslog.port = data["syslog"]["port"].as<int>();
|
||||
|
||||
bme.active = data["bme"]["active"].as<bool>();
|
||||
bme.heightCorrection = data["bme"]["heightCorrection"].as<int>();
|
||||
bme.temperatureCorrection = data["bme"]["temperatureCorrection"].as<float>();
|
||||
|
||||
ota.username = data["ota"]["username"].as<String>();
|
||||
ota.password = data["ota"]["password"].as<String>();
|
||||
|
||||
tnc.enableServer = data["tnc"]["enableServer"].as<bool>();
|
||||
tnc.enableSerial = data["tnc"]["enableSerial"].as<bool>();
|
||||
tnc.acceptOwn = data["tnc"]["acceptOwn"].as<bool>();
|
||||
|
||||
lowPowerMode = data["other"]["lowPowerMode"].as<bool>();
|
||||
lowVoltageCutOff = data["other"]["lowVoltageCutOff"].as<double>();
|
||||
|
||||
backupDigiMode = data["other"]["backupDigiMode"].as<bool>();
|
||||
|
||||
rebootMode = data["other"]["rebootMode"].as<bool>();
|
||||
rebootModeTime = data["other"]["rebootModeTime"].as<int>();
|
||||
|
||||
personalNote = data["personalNote"].as<String>();
|
||||
|
||||
webadmin.active = data["webadmin"]["active"].as<bool>();
|
||||
webadmin.username = data["webadmin"]["username"].as<String>();
|
||||
webadmin.password = data["webadmin"]["password"].as<String>();
|
||||
|
||||
int stationMode = data["stationMode"].as<int>(); // deprecated but need to specify config version
|
||||
|
||||
if (stationMode == 0) {
|
||||
// Load new settings
|
||||
|
||||
beacon.latitude = data["beacon"]["latitude"].as<double>();
|
||||
beacon.longitude = data["beacon"]["longitude"].as<double>();
|
||||
beacon.comment = data["beacon"]["comment"].as<String>();
|
||||
beacon.overlay = data["beacon"]["overlay"].as<String>();
|
||||
beacon.symbol = data["beacon"]["symbol"].as<String>();
|
||||
beacon.interval = data["beacon"]["interval"].as<int>();
|
||||
beacon.sendViaAPRSIS = data["beacon"]["sendViaAPRSIS"].as<bool>();
|
||||
beacon.sendViaRF = data["beacon"]["sendViaRF"].as<bool>();
|
||||
beacon.path = data["beacon"]["path"].as<String>();
|
||||
|
||||
digi.mode = data["digi"]["mode"].as<int>();
|
||||
|
||||
aprs_is.active = data["aprs_is"]["active"].as<bool>();
|
||||
aprs_is.filter = data["aprs_is"]["filter"].as<String>();
|
||||
aprs_is.messagesToRF = data["aprs_is"]["messagesToRF"].as<bool>();
|
||||
aprs_is.objectsToRF = data["aprs_is"]["objectsToRF"].as<bool>();
|
||||
|
||||
loramodule.txFreq = data["lora"]["txFreq"].as<long>();
|
||||
loramodule.rxFreq = data["lora"]["rxFreq"].as<long>();
|
||||
loramodule.txActive = data["lora"]["txActive"].as<bool>();
|
||||
loramodule.rxActive = data["lora"]["rxActive"].as<bool>();
|
||||
} else {
|
||||
// Load old settings and put into new variables not actual config
|
||||
|
||||
String iGateComment = data["iGateComment"].as<String>();
|
||||
int beaconInterval = data["other"]["beaconInterval"].as<int>();
|
||||
|
||||
long iGateFreq = data["lora"]["iGateFreq"].as<long>();
|
||||
long digirepeaterTxFreq = data["lora"]["digirepeaterTxFreq"].as<long>();
|
||||
long digirepeaterRxFreq = data["lora"]["digirepeaterRxFreq"].as<long>();
|
||||
beacon.latitude = data["beacon"]["latitude"] | 0.0;
|
||||
beacon.longitude = data["beacon"]["longitude"] | 0.0;
|
||||
beacon.comment = data["beacon"]["comment"] | "LoRa APRS";
|
||||
beacon.interval = data["beacon"]["interval"] | 15;
|
||||
beacon.overlay = data["beacon"]["overlay"] | "L";
|
||||
beacon.symbol = data["beacon"]["symbol"] | "a";
|
||||
beacon.path = data["beacon"]["path"] | "WIDE1-1";
|
||||
beacon.sendViaAPRSIS = data["beacon"]["sendViaAPRSIS"] | false;
|
||||
beacon.sendViaRF = data["beacon"]["sendViaRF"] | false;
|
||||
|
||||
String digiComment = data["digi"]["comment"].as<String>();
|
||||
double digiLatitude = data["digi"]["latitude"].as<double>();
|
||||
double digiLongitude = data["digi"]["longitude"].as<double>();
|
||||
aprs_is.active = data["aprs_is"]["active"] | false;
|
||||
aprs_is.passcode = data["aprs_is"]["passcode"] | "XYZWV";
|
||||
aprs_is.server = data["aprs_is"]["server"] | "rotate.aprs2.net";
|
||||
aprs_is.port = data["aprs_is"]["port"] | 14580;
|
||||
aprs_is.filter = data["aprs_is"]["filter"] | "m/10";
|
||||
aprs_is.messagesToRF = data["aprs_is"]["messagesToRF"] | false;
|
||||
aprs_is.objectsToRF = data["aprs_is"]["objectsToRF"] | false;
|
||||
|
||||
digi.mode = data["digi"]["mode"].as<int>();
|
||||
|
||||
beacon.latitude = digiLatitude;
|
||||
beacon.longitude = digiLongitude;
|
||||
beacon.interval = beaconInterval;
|
||||
loramodule.txFreq = data["lora"]["txFreq"] | 433775000;
|
||||
loramodule.rxFreq = data["lora"]["rxFreq"] | 433775000;
|
||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"] | 12;
|
||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"] | 125000;
|
||||
loramodule.codingRate4 = data["lora"]["codingRate4"] | 5;
|
||||
loramodule.power = data["lora"]["power"] | 20;
|
||||
loramodule.txActive = data["lora"]["txActive"] | false;
|
||||
loramodule.rxActive = data["lora"]["rxActive"] | false;
|
||||
|
||||
loramodule.txFreq = digirepeaterTxFreq;
|
||||
loramodule.rxFreq = digirepeaterRxFreq;
|
||||
loramodule.rxActive = true;
|
||||
beacon.sendViaAPRSIS = true;
|
||||
beacon.sendViaRF = false;
|
||||
display.alwaysOn = data["display"]["alwaysOn"] | true;
|
||||
display.timeout = data["display"]["timeout"] | 4;
|
||||
display.turn180 = data["display"]["turn180"] | false;
|
||||
|
||||
switch (stationMode) {
|
||||
case 1: // IGate only
|
||||
// aprs_is.active = true; // better don't do that automatically
|
||||
beacon.comment = iGateComment;
|
||||
loramodule.rxFreq = iGateFreq;
|
||||
break;
|
||||
case 5: // Digi + IGate
|
||||
case 2: // Digi + IGate
|
||||
// aprs_is.active = true; // better don't do that automatically
|
||||
// digi.mode = 2; // better don't do that automatically
|
||||
beacon.comment = digiComment;
|
||||
loramodule.rxFreq = iGateFreq;
|
||||
break;
|
||||
case 3: // Digi
|
||||
case 4: // Digi
|
||||
// digi.mode = 2; // better don't do that automatically
|
||||
beacon.comment = digiComment;
|
||||
break;
|
||||
}
|
||||
battery.sendInternalVoltage = data["battery"]["sendInternalVoltage"] | false;
|
||||
battery.monitorInternalVoltage = data["battery"]["monitorInternalVoltage"] | false;
|
||||
battery.internalSleepVoltage = data["battery"]["internalSleepVoltage"] | 3.0;
|
||||
|
||||
reload = true;
|
||||
}
|
||||
battery.sendExternalVoltage = data["battery"]["sendExternalVoltage"] | false;
|
||||
battery.externalVoltagePin = data["battery"]["externalVoltagePin"] | 34;
|
||||
battery.monitorExternalVoltage = data["battery"]["monitorExternalVoltage"] | false;
|
||||
battery.externalSleepVoltage = data["battery"]["externalSleepVoltage"] | false;
|
||||
battery.voltageDividerR1 = data["battery"]["voltageDividerR1"] | 100.0;
|
||||
battery.voltageDividerR2 = data["battery"]["voltageDividerR2"] | 27.0;
|
||||
|
||||
bme.active = data["bme"]["active"] | false;
|
||||
bme.heightCorrection = data["bme"]["heightCorrection"] | 0;
|
||||
bme.temperatureCorrection = data["bme"]["temperatureCorrection"] | 0.0;
|
||||
|
||||
syslog.active = data["syslog"]["active"] | false;
|
||||
syslog.server = data["syslog"]["server"] | "192.168.0.100";
|
||||
syslog.port = data["syslog"]["port"] | 514;
|
||||
|
||||
tnc.enableServer = data["tnc"]["enableServer"] | false;
|
||||
tnc.enableSerial = data["tnc"]["enableSerial"] | false;
|
||||
tnc.acceptOwn = data["tnc"]["acceptOwn"] | false;
|
||||
|
||||
ota.username = data["ota"]["username"] | "";
|
||||
ota.password = data["ota"]["password"] | "";
|
||||
|
||||
webadmin.active = data["webadmin"]["active"] | false;
|
||||
webadmin.username = data["webadmin"]["username"] | "admin";
|
||||
webadmin.password = data["webadmin"]["password"] | "";
|
||||
|
||||
lowPowerMode = data["other"]["lowPowerMode"] | false;
|
||||
lowVoltageCutOff = data["other"]["lowVoltageCutOff"] | 0;
|
||||
|
||||
backupDigiMode = data["other"]["backupDigiMode"] | false;
|
||||
|
||||
rebootMode = data["other"]["rebootMode"] | false;
|
||||
rebootModeTime = data["other"]["rebootModeTime"] | 6;
|
||||
|
||||
personalNote = data["personalNote"] | "personal note here...";
|
||||
|
||||
if (wifiAPs.size() == 0) { // If we don't have any WiFi's from config we need to add "empty" SSID for AUTO AP
|
||||
WiFi_AP wifiap;
|
||||
@@ -286,68 +222,67 @@ bool Configuration::readFile() {
|
||||
}
|
||||
|
||||
void Configuration::init() {
|
||||
reload = false;
|
||||
|
||||
WiFi_AP wifiap;
|
||||
wifiap.ssid = "";
|
||||
wifiap.password = "";
|
||||
wifiap.ssid = "";
|
||||
wifiap.password = "";
|
||||
|
||||
wifiAPs.push_back(wifiap);
|
||||
|
||||
wifiAutoAP.password = "1234567890";
|
||||
wifiAutoAP.powerOff = 15;
|
||||
wifiAutoAP.password = "1234567890";
|
||||
wifiAutoAP.powerOff = 15;
|
||||
|
||||
callsign = "N0CALL";
|
||||
callsign = "N0CALL-10";
|
||||
|
||||
beacon.comment = "LoRa APRS"; // new
|
||||
beacon.latitude = 0.0; // new
|
||||
beacon.longitude = 0.0; // new
|
||||
beacon.interval = 15; // new
|
||||
beacon.overlay = "L"; // new
|
||||
beacon.symbol = "#"; // new
|
||||
beacon.sendViaAPRSIS = true; // new
|
||||
beacon.sendViaRF = false; // new
|
||||
beacon.path = "WIDE1-1"; // new
|
||||
beacon.comment = "LoRa APRS";
|
||||
beacon.latitude = 0.0;
|
||||
beacon.longitude = 0.0;
|
||||
beacon.interval = 15;
|
||||
beacon.overlay = "L";
|
||||
beacon.symbol = "a";
|
||||
beacon.sendViaAPRSIS = true;
|
||||
beacon.sendViaRF = false;
|
||||
beacon.path = "WIDE1-1";
|
||||
|
||||
digi.mode = 0;
|
||||
|
||||
tnc.enableServer = false;
|
||||
tnc.enableSerial = false;
|
||||
tnc.acceptOwn = false;
|
||||
tnc.enableServer = false;
|
||||
tnc.enableSerial = false;
|
||||
tnc.acceptOwn = false;
|
||||
|
||||
aprs_is.active = false; // new
|
||||
aprs_is.passcode = "XYZVW";
|
||||
aprs_is.server = "rotate.aprs2.net";
|
||||
aprs_is.port = 14580;
|
||||
aprs_is.filter = "m/10"; // new
|
||||
aprs_is.messagesToRF = false;
|
||||
aprs_is.objectsToRF = false;
|
||||
aprs_is.active = false;
|
||||
aprs_is.passcode = "XYZVW";
|
||||
aprs_is.server = "rotate.aprs2.net";
|
||||
aprs_is.port = 14580;
|
||||
aprs_is.filter = "m/10";
|
||||
aprs_is.messagesToRF = false;
|
||||
aprs_is.objectsToRF = false;
|
||||
|
||||
loramodule.txFreq = 433775000; // new
|
||||
loramodule.rxFreq = 433775000; // new
|
||||
loramodule.spreadingFactor = 12;
|
||||
loramodule.signalBandwidth = 125000;
|
||||
loramodule.codingRate4 = 5;
|
||||
loramodule.power = 20;
|
||||
loramodule.txActive = false; // new
|
||||
loramodule.rxActive = true; // new
|
||||
loramodule.txFreq = 433775000;
|
||||
loramodule.rxFreq = 433775000;
|
||||
loramodule.spreadingFactor = 12;
|
||||
loramodule.signalBandwidth = 125000;
|
||||
loramodule.codingRate4 = 5;
|
||||
loramodule.power = 20;
|
||||
loramodule.txActive = false;
|
||||
loramodule.rxActive = true;
|
||||
|
||||
display.alwaysOn = true;
|
||||
display.timeout = 4;
|
||||
display.turn180 = false;
|
||||
display.alwaysOn = true;
|
||||
display.timeout = 4;
|
||||
display.turn180 = false;
|
||||
|
||||
syslog.active = false;
|
||||
syslog.server = "192.168.0.100";
|
||||
syslog.port = 514;
|
||||
syslog.active = false;
|
||||
syslog.server = "192.168.0.100";
|
||||
syslog.port = 514;
|
||||
|
||||
bme.active = false;
|
||||
bme.heightCorrection = 0;
|
||||
bme.temperatureCorrection = 0.0;
|
||||
bme.active = false;
|
||||
bme.heightCorrection = 0;
|
||||
bme.temperatureCorrection = 0.0;
|
||||
|
||||
ota.username = "";
|
||||
ota.password = "";
|
||||
ota.username = "";
|
||||
ota.password = "";
|
||||
|
||||
rememberStationTime = 30;
|
||||
rememberStationTime = 30;
|
||||
|
||||
battery.sendInternalVoltage = false;
|
||||
battery.monitorInternalVoltage = false;
|
||||
@@ -356,23 +291,23 @@ void Configuration::init() {
|
||||
battery.sendExternalVoltage = false;
|
||||
battery.externalVoltagePin = 34;
|
||||
battery.monitorExternalVoltage = false;
|
||||
battery.externalSleepVoltage = 3.0;
|
||||
battery.voltageDividerR1 = 100.0;
|
||||
battery.voltageDividerR2 = 27.0;
|
||||
battery.externalSleepVoltage = 10.9;
|
||||
battery.voltageDividerR1 = 100.0;
|
||||
battery.voltageDividerR2 = 27.0;
|
||||
|
||||
lowPowerMode = false;
|
||||
lowVoltageCutOff = 0;
|
||||
lowPowerMode = false;
|
||||
lowVoltageCutOff = 0;
|
||||
|
||||
backupDigiMode = false;
|
||||
backupDigiMode = false;
|
||||
|
||||
rebootMode = false;
|
||||
rebootModeTime = 0;
|
||||
rebootMode = false;
|
||||
rebootModeTime = 0;
|
||||
|
||||
personalNote = "";
|
||||
personalNote = "";
|
||||
|
||||
webadmin.active = false;
|
||||
webadmin.username = "admin";
|
||||
webadmin.password = "";
|
||||
webadmin.active = false;
|
||||
webadmin.username = "admin";
|
||||
webadmin.password = "";
|
||||
|
||||
Serial.println("All is Written!");
|
||||
}
|
||||
|
||||
@@ -115,7 +115,6 @@ public:
|
||||
|
||||
class Configuration {
|
||||
public:
|
||||
bool reload; // ?
|
||||
String callsign;
|
||||
int rememberStationTime;
|
||||
bool lowPowerMode;
|
||||
@@ -140,7 +139,6 @@ public:
|
||||
|
||||
void init();
|
||||
void writeFile();
|
||||
void check();
|
||||
Configuration();
|
||||
|
||||
private:
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace DIGI_Utils {
|
||||
} else {
|
||||
STATION_Utils::addToOutputPacketBuffer(loraPacket);
|
||||
}
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ void cleanTFT() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void setup_display() {
|
||||
void displaySetup() {
|
||||
#ifdef HAS_DISPLAY
|
||||
delay(500);
|
||||
#ifdef HAS_TFT
|
||||
@@ -83,7 +83,7 @@ void setup_display() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void display_toggle(bool toggle) {
|
||||
void displayToggle(bool toggle) {
|
||||
#ifdef HAS_DISPLAY
|
||||
if (toggle) {
|
||||
#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
|
||||
const String* const lines[] = {&line1, &line2, &line3};
|
||||
#ifdef HAS_TFT
|
||||
@@ -162,7 +162,7 @@ void show_display(const String& header, const String& line1, const String& line2
|
||||
#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
|
||||
const String* const lines[] = {&line1, &line2, &line3, &line4, &line5, &line6};
|
||||
#ifdef HAS_TFT
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
||||
|
||||
void cleanTFT();
|
||||
void setup_display();
|
||||
void display_toggle(bool toggle);
|
||||
void displaySetup();
|
||||
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, 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 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, 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
|
||||
@@ -57,12 +57,13 @@ namespace GPS_Utils {
|
||||
|
||||
void generateBeacons() {
|
||||
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.aprs_is.messagesToRF = false;
|
||||
Config.aprs_is.objectsToRF = false;
|
||||
Config.beacon.sendViaRF = false;
|
||||
Config.digi.mode = 0;
|
||||
Config.backupDigiMode = false;
|
||||
}
|
||||
String beaconPacket = Config.callsign;
|
||||
beaconPacket += ">APLRG1";
|
||||
|
||||
@@ -29,31 +29,31 @@ namespace OTA_Utils {
|
||||
|
||||
void onOTAStart() {
|
||||
Serial.println("OTA update started!");
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
show_display("", "", "", " OTA update started!", "", "", "", 1000);
|
||||
displayShow("", "", "", " OTA update started!", "", "", "", 1000);
|
||||
isUpdatingOTA = true;
|
||||
}
|
||||
|
||||
void onOTAProgress(size_t current, size_t final) {
|
||||
if (millis() - ota_progress_millis > 1000) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
ota_progress_millis = millis();
|
||||
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) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
if (success) {
|
||||
Serial.println("OTA update finished successfully!");
|
||||
show_display("", "", " OTA update success!", "", " Rebooting ...", "", "", 4000);
|
||||
displayShow("", "", " OTA update success!", "", " Rebooting ...", "", "", 4000);
|
||||
} else {
|
||||
Serial.println("There was an error during OTA update!");
|
||||
show_display("", "", " OTA update fail!", "", "", "", "", 4000);
|
||||
displayShow("", "", " OTA update fail!", "", "", "", "", 4000);
|
||||
}
|
||||
isUpdatingOTA = false;
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ namespace Utils {
|
||||
}
|
||||
|
||||
void setupDisplay() {
|
||||
setup_display();
|
||||
displaySetup();
|
||||
#ifdef INTERNAL_LED_PIN
|
||||
digitalWrite(INTERNAL_LED_PIN,HIGH);
|
||||
#endif
|
||||
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
|
||||
digitalWrite(INTERNAL_LED_PIN,LOW);
|
||||
#endif
|
||||
@@ -110,7 +110,7 @@ namespace Utils {
|
||||
|
||||
if (beaconUpdate) {
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
displayToggle(true);
|
||||
}
|
||||
Utils::println("-- Sending Beacon to APRSIS --");
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Utils {
|
||||
}
|
||||
|
||||
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...";
|
||||
#ifdef HAS_A7670
|
||||
A7670_Utils::uploadToAPRSIS(beaconPacket);
|
||||
@@ -182,7 +182,7 @@ namespace Utils {
|
||||
}
|
||||
|
||||
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...";
|
||||
STATION_Utils::addToOutputPacketBuffer(secondaryBeaconPacket);
|
||||
}
|
||||
@@ -200,14 +200,14 @@ namespace Utils {
|
||||
void checkDisplayInterval() {
|
||||
uint32_t lastDisplayTime = millis() - lastScreenOn;
|
||||
if (!Config.display.alwaysOn && lastDisplayTime >= Config.display.timeout * 1000) {
|
||||
display_toggle(false);
|
||||
displayToggle(false);
|
||||
}
|
||||
}
|
||||
|
||||
void validateFreqs() {
|
||||
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");
|
||||
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.writeFile();
|
||||
ESP.restart();
|
||||
@@ -313,7 +313,7 @@ namespace Utils {
|
||||
Serial.println("\n\n*** Sleeping Low Battey Voltage ***\n\n");
|
||||
esp_sleep_enable_timer_wakeup(30 * 60 * 1000000); // sleep 30 min
|
||||
if (mode == 1) {
|
||||
display_toggle(false);
|
||||
displayToggle(false);
|
||||
}
|
||||
#ifdef VEXT_CTRL
|
||||
#ifndef HELTEC_WSL_V3
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace WEB_Utils {
|
||||
AsyncWebServerResponse *response = request->beginResponse(302, "text/html", "");
|
||||
response->addHeader("Location", "/");
|
||||
request->send(response);
|
||||
display_toggle(false);
|
||||
displayToggle(false);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace WEB_Utils {
|
||||
|
||||
request->send(200, "text/plain", "Beacon will be sent in a while");
|
||||
} else if (type == "reboot") {
|
||||
display_toggle(false);
|
||||
displayToggle(false);
|
||||
ESP.restart();
|
||||
} else {
|
||||
request->send(404, "text/plain", "Not Found");
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace WIFI_Utils {
|
||||
WiFi.disconnect();
|
||||
delay(500);
|
||||
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("' ...");
|
||||
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||
while (WiFi.status() != WL_CONNECTED && wifiCounter<myWiFiAPSize) {
|
||||
@@ -99,7 +99,7 @@ namespace WIFI_Utils {
|
||||
currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
start = millis();
|
||||
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.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
|
||||
}
|
||||
@@ -113,17 +113,17 @@ namespace WIFI_Utils {
|
||||
Serial.print(WiFi.localIP());
|
||||
Serial.print(" / MAC Address: ");
|
||||
Serial.println(WiFi.macAddress());
|
||||
show_display("", " Connected!!", "" , " loading ...", 1000);
|
||||
displayShow("", " Connected!!", "" , " loading ...", 1000);
|
||||
} else if (WiFi.status() != WL_CONNECTED) {
|
||||
startAP = true;
|
||||
|
||||
Serial.println("\nNot connected to WiFi! Starting Auto AP");
|
||||
show_display("", " WiFi Not Connected!", "" , " loading ...", 1000);
|
||||
displayShow("", " WiFi Not Connected!", "" , " loading ...", 1000);
|
||||
}
|
||||
WiFiConnected = !startAP;
|
||||
if (startAP) {
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user