syslog fix for stationMode5

This commit is contained in:
richonguzman 2023-11-28 00:57:15 -03:00
parent 07ff67761d
commit e635d5757f
7 changed files with 21 additions and 21 deletions

View file

@ -71,7 +71,7 @@ namespace APRS_IS_Utils {
}
String createPacket(String packet) {
if (stationMode > 1) {
if (stationMode>1) {
return packet.substring(3, packet.indexOf(':')) + ",qAR," + Config.callsign + packet.substring(packet.indexOf(':')) + "\n";
} else {
return packet.substring(3, packet.indexOf(':')) + ",qAO," + Config.callsign + packet.substring(packet.indexOf(':')) + "\n";
@ -93,7 +93,7 @@ namespace APRS_IS_Utils {
#endif
Sender = packet.substring(3,packet.indexOf(">"));
if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
if (stationMode == 2 || stationMode == 5) {
if (stationMode==2 || stationMode==5) {
if (packet.indexOf("::") > 10) { // its a Message!
AddresseeAndMessage = packet.substring(packet.indexOf("::")+2);
Addressee = AddresseeAndMessage.substring(0,AddresseeAndMessage.indexOf(":"));

View file

@ -51,18 +51,18 @@ namespace DIGI_Utils {
LoRa_Utils::sendNewPacket("APRS", loraPacket);
display_toggle(true);
lastScreenOn = millis();
} else if (stationMode ==4){
} else if (stationMode==4){
if (packet.indexOf("WIDE1-1") == -1) {
loraPacket = packet.substring(3,packet.indexOf(":")) + "," + Config.callsign + "*" + packet.substring(packet.indexOf(":"));
} else {
loraPacket = packet.substring(3,packet.indexOf(",")+1) + Config.callsign + "*" + packet.substring(packet.indexOf(","));
}
delay(500);
if (stationMode == 4) {
if (stationMode==4) {
LoRa_Utils::changeFreqTx();
}
LoRa_Utils::sendNewPacket("APRS", loraPacket);
if (stationMode == 4) {
if (stationMode==4) {
LoRa_Utils::changeFreqRx();
}
display_toggle(true);

View file

@ -80,7 +80,7 @@ String processLongitudeAPRS(double lon) {
String generateBeacon() {
String stationLatitude, stationLongitude, beaconPacket;
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED && espClient.connected()) || stationMode==6) {
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status()==WL_CONNECTED && espClient.connected()) || stationMode==6) {
stationLatitude = processLatitudeAPRS(currentWiFi->latitude);
stationLongitude = processLongitudeAPRS(currentWiFi->longitude);
beaconPacket = Config.callsign + ">APLRG1,WIDE1-1";
@ -88,7 +88,7 @@ String generateBeacon() {
beaconPacket += ",qAC";
}
beaconPacket += ":=" + stationLatitude + "L" + stationLongitude;
if (stationMode == 1) {
if (stationMode==1) {
beaconPacket += "&";
} else {
beaconPacket += "a";

View file

@ -18,7 +18,7 @@ namespace LoRa_Utils {
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ);
long freq;
if (stationMode == 1 || stationMode == 2) {
if (stationMode==1 || stationMode==2) {
freq = Config.loramodule.iGateFreq;
} else {
freq = Config.loramodule.digirepeaterTxFreq;

View file

@ -13,7 +13,7 @@ namespace SYSLOG_Utils {
void log(String type, String packet, int rssi, float snr, int freqError) {
String syslogPacket = "ESP32 LoRa [APRS] - " + Config.callsign + " - ";
if (Config.syslog.active && (stationMode==1 || stationMode==2 || stationMode==5)) {
if (Config.syslog.active && (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status()==WL_CONNECTED))) {
if (type == "APRSIS Tx") {
if (packet.indexOf(":>") > 10) {
syslogPacket += type + " - StartUp STATUS - " + packet.substring(packet.indexOf(":>")+2);
@ -50,7 +50,7 @@ void log(String type, String packet, int rssi, float snr, int freqError) {
}
void setup() {
if (Config.syslog.active && (stationMode==1 || stationMode==2 || stationMode==5)) {
if (Config.syslog.active && (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status()==WL_CONNECTED))) {
udpClient.begin(WiFi.localIP(), 0);
Serial.println("init : Syslog Server ... done! (at " + Config.syslog.server + ")");
}

View file

@ -63,11 +63,11 @@ namespace Utils {
} else {
delay(5000);
status += ":>https://github.com/richonguzman/LoRa_APRS_iGate " + versionDate;
if (stationMode == 4) {
if (stationMode==4) {
LoRa_Utils::changeFreqTx();
}
LoRa_Utils::sendNewPacket("APRS", status);
if (stationMode == 4) {
if (stationMode==4) {
LoRa_Utils::changeFreqRx();
}
}
@ -247,7 +247,7 @@ namespace Utils {
}
void validateDigiFreqs() {
if (stationMode == 4) {
if (stationMode==4) {
if (abs(Config.loramodule.digirepeaterTxFreq - Config.loramodule.digirepeaterRxFreq) < 125000) {
Serial.println("Tx Freq less than 125kHz from Rx Freq ---> NOT VALID, check 'data/igate_conf.json'");
show_display("Tx Freq is less than ", "125kHz from Rx Freq", "change it on : /data/", "igate_conf.json", 0);
@ -258,7 +258,7 @@ namespace Utils {
void typeOfPacket(String packet, String packetType) {
String sender;
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED)) {
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") {
@ -308,7 +308,7 @@ namespace Utils {
}
void startServer() {
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED)) {
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status()==WL_CONNECTED)) {
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "text/plain", "Hi " + Config.callsign + ", \n\nthis is your (Richonguzman/CA2RXU) LoRa iGate , version " + versionDate + ".\n\nTo update your firmware or filesystem go to: http://" + getLocalIP().substring(getLocalIP().indexOf(":")+3) + "/update\n\n\n73!");
});

View file

@ -26,7 +26,7 @@ void checkWiFi() {
void startWiFi() {
int wifiCounter = 0;
int status = WL_IDLE_STATUS;
if (stationMode != 6) {
if (stationMode!=6) {
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(500);
@ -71,7 +71,7 @@ void startWiFi() {
}
void setup() {
if (stationMode == 1 || stationMode == 2) {
if (stationMode==1 || stationMode==2) {
if (stationMode==1) {
Serial.println("stationMode ---> iGate (only Rx)");
} else {
@ -79,17 +79,17 @@ void setup() {
}
startWiFi();
btStop();
} else if (stationMode == 3 || stationMode == 4) {
if (stationMode == 3) {
} else if (stationMode==3 || stationMode==4) {
if (stationMode==3) {
Serial.println("stationMode ---> DigiRepeater (Rx freq == Tx freq)");
} else {
Serial.println("stationMode ---> DigiRepeater (Rx freq != Tx freq)");
}
WiFi.mode(WIFI_OFF);
btStop();
} else if (stationMode == 5) {
} else if (stationMode==5) {
Serial.println("stationMode ---> iGate when Wifi/APRS available (DigiRepeater when not)");
} else if (stationMode == 6) {
} else if (stationMode==6) {
Serial.println("stationMode ---> Digirepeater with iGate capabilities (when WiFi available)");
WiFi.mode(WIFI_STA);
WiFi.disconnect();