This commit is contained in:
richonguzman 2023-07-30 18:21:06 -04:00
parent 5ee4418d5b
commit 2ca791ef75
5 changed files with 30 additions and 26 deletions

View file

@ -5,9 +5,9 @@
"wifi": {
"AP": [
{ "ssid": "Richon",
"password": "k4fPnmg5qnyf",
"latitude": -33.0337313,
"longitude": -71.5737261
"password": "k4fPnmg5qny",
"latitude": -32.9543284,
"longitude": -71.1202063
},
{ "ssid": "iPhone Richon",
"password": "1234poto5678",
@ -22,7 +22,7 @@
"longitude": -71.1202063
},
"aprs_is": {
"passcode": "23202",
"passcode": "23201",
"server": "euro.aprs2.net",
"port": 14580,
"reportingDistance": 30

View file

@ -82,16 +82,7 @@ void loop() {
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
DIGI_Utils::processPacket(LoRa_Utils::receivePacket());
} else if (stationMode==5) {
uint32_t WiFiCheck = millis() - lastWiFiCheck;
if (WiFi.status() != WL_CONNECTED && WiFiCheck >= Config.lastWiFiCheck*4*1000) {
WiFiConnect = true;
}
if (WiFiConnect) {
Serial.println("\n\n###############\nRevision WiFi\n###############");
WIFI_Utils::startWiFi2();
lastWiFiCheck = millis();
WiFiConnect = false;
}
Utils::checkWiFiInterval();
if (WiFi.status() == WL_CONNECTED) { // Modo iGate
thirdLine = Utils::getLocalIP();
if (!espClient.connected()) {
@ -117,6 +108,9 @@ void loop() {
if (lastStationModeState == 0) {
iGateBeaconPacket = GPS_Utils::generateBeacon();
lastStationModeState = 1;
String Tx = String(Config.loramodule.digirepeaterTxFreq);
secondLine = "Rx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
secondLine += " Tx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
thirdLine = "<< DigiRepeater >>";
}
Utils::checkDisplayInterval();

View file

@ -41,6 +41,8 @@ extern float snr;
extern int freqError;
extern String distance;
extern String versionDate;
extern uint32_t lastWiFiCheck;
extern bool WiFiConnect;
namespace Utils {
@ -147,13 +149,13 @@ void checkBeaconInterval() {
LoRa_Utils::changeFreqRx();
}
} else if (stationMode==5) {
if (!Config.bme.active) {
fifthLine = "";
}
sixthLine = "";
if (WiFi.status() == WL_CONNECTED && espClient.connected()) {
APRS_IS_Utils::checkStatus();
thirdLine = getLocalIP();
if (!Config.bme.active) {
fifthLine = "";
}
sixthLine = "";
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000);
if (Config.sendBatteryVoltage) {
sixthLine = " (Batt=" + String(BATTERY_Utils::checkVoltages(),2) + "V)";
@ -162,12 +164,6 @@ void checkBeaconInterval() {
espClient.write((beaconPacket + "\n").c_str());
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
} else {
String Tx = String(Config.loramodule.digirepeaterTxFreq);
secondLine = "Rx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
secondLine += " Tx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
thirdLine = "<< DigiRepeater >>";
fifthLine = "";
sixthLine = "";
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0);
if (Config.sendBatteryVoltage) {
sixthLine = " (Batt=" + String(BATTERY_Utils::checkVoltages(),2) + "V)";
@ -194,6 +190,19 @@ void checkDisplayInterval() {
}
}
void checkWiFiInterval() {
uint32_t WiFiCheck = millis() - lastWiFiCheck;
if (WiFi.status() != WL_CONNECTED && WiFiCheck >= Config.lastWiFiCheck*4*1000) { //60!!!
WiFiConnect = true;
}
if (WiFiConnect) {
Serial.println("\nConnecting to WiFi ...");
WIFI_Utils::startWiFi2();
lastWiFiCheck = millis();
WiFiConnect = false;
}
}
void validateDigiFreqs() {
if (stationMode == 4) {
if (abs(Config.loramodule.digirepeaterTxFreq - Config.loramodule.digirepeaterRxFreq) < 125000) {
@ -206,7 +215,7 @@ void validateDigiFreqs() {
void typeOfPacket(String packet, String packetType) {
String sender;
if (stationMode==1 || stationMode==2) {
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED)) {
if (packetType == "LoRa-APRS") {
fifthLine = "LoRa Rx ----> APRS-IS";
} else if (packetType == "APRS-LoRa") {

View file

@ -11,6 +11,7 @@ void setupDisplay();
void activeStations();
void checkBeaconInterval();
void checkDisplayInterval();
void checkWiFiInterval();
void validateDigiFreqs();
void typeOfPacket(String packet, String packetType);
void startOTAServer();

View file

@ -97,7 +97,7 @@ void startWiFi2() {
Serial.println(WiFi.localIP());
show_display("", "", " Connected!!", "" , " loading ...", 1000);
} else {
Serial.println("\nNot connected to WiFi! (starting DigiRepeater Mode)");
Serial.println("\nNot connected to WiFi! (DigiRepeater Mode)");
show_display("", "", " WiFi Not Connected!", " DigiRepeater MODE" , " loading ...", 2000);
}
}