mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-14 09:23:58 +01:00
code cleaned to lighter versions
This commit is contained in:
parent
f879182f62
commit
d628de9c9c
|
|
@ -48,7 +48,7 @@ ___________________________________________________________________*/
|
|||
#include "A7670_utils.h"
|
||||
#endif
|
||||
|
||||
String versionDate = "2025.01.22";
|
||||
String versionDate = "2025.02.12";
|
||||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
#ifdef HAS_GPS
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ namespace OTA_Utils {
|
|||
void onOTAEnd(bool success) {
|
||||
displayToggle(true);
|
||||
lastScreenOn = millis();
|
||||
if (success) {
|
||||
Serial.println("OTA update finished successfully!");
|
||||
displayShow("", "", " OTA update success!", "", " Rebooting ...", "", "", 4000);
|
||||
} else {
|
||||
Serial.println("There was an error during OTA update!");
|
||||
displayShow("", "", " OTA update fail!", "", "", "", "", 4000);
|
||||
}
|
||||
|
||||
String statusMessage = success ? "OTA update success!" : "OTA update fail!";
|
||||
String rebootMessage = success ? "Rebooting ..." : "";
|
||||
|
||||
Serial.println(success ? "OTA update finished successfully!" : "There was an error during OTA update!");
|
||||
displayShow("", "", statusMessage, "", rebootMessage, "", "", 4000);
|
||||
|
||||
isUpdatingOTA = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,13 +81,9 @@ namespace STATION_Utils {
|
|||
lastHeardStations.push_back(lastStation);
|
||||
}
|
||||
|
||||
fourthLine = "Stations (";
|
||||
fourthLine += String(Config.rememberStationTime);
|
||||
fourthLine += "min) = ";
|
||||
if (lastHeardStations.size() < 10) {
|
||||
fourthLine += " ";
|
||||
}
|
||||
fourthLine += String(lastHeardStations.size());
|
||||
char buffer[30]; // Adjust size as needed
|
||||
sprintf(buffer, "Stations (%dmin) = %2d", Config.rememberStationTime, lastHeardStations.size());
|
||||
fourthLine = buffer;
|
||||
}
|
||||
|
||||
bool wasHeard(const String& station) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ namespace SYSLOG_Utils {
|
|||
char signalData[35];
|
||||
snprintf(signalData, sizeof(signalData), " / %ddBm / %.2fdB / %dHz", rssi, snr, freqError);
|
||||
|
||||
int colonIndex = packet.indexOf(":");
|
||||
char nextChar = packet[colonIndex + 1];
|
||||
String sender = packet.substring(3, packet.indexOf(">"));
|
||||
|
||||
switch (type) {
|
||||
case 0: // CRC
|
||||
syslogPacket.concat("CRC / CRC-ERROR / ");
|
||||
|
|
@ -28,59 +32,56 @@ namespace SYSLOG_Utils {
|
|||
break;
|
||||
case 1: // RX
|
||||
syslogPacket.concat("RX / ");
|
||||
if (packet.indexOf("::") > 10) {
|
||||
if (nextChar == ':') {
|
||||
syslogPacket.concat("MESSAGE / ");
|
||||
syslogPacket.concat(packet.substring(3, packet.indexOf(">")));
|
||||
syslogPacket.concat(" ---> "); syslogPacket.concat(packet.substring(packet.indexOf("::") + 2));
|
||||
syslogPacket.concat(signalData);
|
||||
} else if (packet.indexOf(":!") > 10 || packet.indexOf(":=") > 10) {
|
||||
syslogPacket.concat(sender);
|
||||
syslogPacket.concat(" ---> ");
|
||||
syslogPacket.concat(packet.substring(colonIndex + 2));
|
||||
} else if (nextChar == '!' || nextChar == '=') {
|
||||
syslogPacket.concat("GPS / ");
|
||||
syslogPacket.concat(packet.substring(3, packet.indexOf(">")));
|
||||
syslogPacket.concat(sender);
|
||||
syslogPacket.concat(" / ");
|
||||
if (packet.indexOf("WIDE1-1") > 10) {
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(">") + 1, packet.indexOf(",")));
|
||||
syslogPacket.concat(" / WIDE1-1");
|
||||
} else {
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(">") + 1, packet.indexOf(":")));
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(">") + 1, colonIndex));
|
||||
syslogPacket.concat(" / -");
|
||||
}
|
||||
syslogPacket.concat(signalData);
|
||||
syslogPacket.concat(" / ");
|
||||
syslogPacket.concat(GPS_Utils::getDistanceAndComment(packet));
|
||||
} else if (packet.indexOf(":>") > 10) {
|
||||
} else if (nextChar == '>') {
|
||||
syslogPacket.concat("STATUS / ");
|
||||
syslogPacket.concat(packet.substring(3, packet.indexOf(">")));
|
||||
syslogPacket.concat(sender);
|
||||
syslogPacket.concat(" ---> ");
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(":>") + 2));
|
||||
syslogPacket.concat(signalData);
|
||||
} else if (packet.indexOf(":`") > 10) {
|
||||
syslogPacket.concat(packet.substring(colonIndex + 2));
|
||||
} else if (nextChar == '`') {
|
||||
syslogPacket.concat("MIC-E / ");
|
||||
syslogPacket.concat(packet.substring(3, packet.indexOf(">")));
|
||||
syslogPacket.concat(sender);
|
||||
syslogPacket.concat(" ---> ");
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(":`") + 2));
|
||||
syslogPacket.concat(signalData);
|
||||
syslogPacket.concat(packet.substring(colonIndex + 2));
|
||||
} else if (nextChar == ';') {
|
||||
syslogPacket.concat("OBJECT / ");
|
||||
syslogPacket.concat(sender);
|
||||
syslogPacket.concat(" ---> ");
|
||||
syslogPacket.concat(packet.substring(colonIndex + 2));
|
||||
} else if (packet.indexOf(":T#") >= 10 && packet.indexOf(":=/") == -1) {
|
||||
syslogPacket.concat("TELEMETRY / ");
|
||||
syslogPacket.concat(packet.substring(3, packet.indexOf(">")));
|
||||
syslogPacket.concat(sender);
|
||||
syslogPacket.concat(" ---> ");
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(":T#") + 3));
|
||||
syslogPacket.concat(signalData);
|
||||
} else if (packet.indexOf(":;") > 10) {
|
||||
syslogPacket.concat("OBJECT / ");
|
||||
syslogPacket.concat(packet.substring(3, packet.indexOf(">")));
|
||||
syslogPacket.concat(" ---> ");
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(":;") + 2));
|
||||
syslogPacket.concat(signalData);
|
||||
} else {
|
||||
syslogPacket.concat(packet);
|
||||
syslogPacket.concat(signalData);
|
||||
}
|
||||
syslogPacket.concat(signalData);
|
||||
if (nextChar == '!' || nextChar == '=') {
|
||||
syslogPacket.concat(" / ");
|
||||
syslogPacket.concat(GPS_Utils::getDistanceAndComment(packet));
|
||||
}
|
||||
break;
|
||||
case 2: // APRSIS TX
|
||||
syslogPacket.concat("APRSIS TX / ");
|
||||
if (packet.indexOf(":>") > 10) {
|
||||
if (nextChar == '>') {
|
||||
syslogPacket.concat("StartUp_Status / ");
|
||||
syslogPacket.concat(packet.substring(packet.indexOf(":>") + 2));
|
||||
syslogPacket.concat(packet.substring(colonIndex + 2));
|
||||
} else {
|
||||
syslogPacket.concat("QUERY / ");
|
||||
syslogPacket.concat(packet);
|
||||
|
|
@ -91,11 +92,11 @@ namespace SYSLOG_Utils {
|
|||
if (packet.indexOf("RFONLY") > 10) {
|
||||
syslogPacket.concat("RFONLY / ");
|
||||
syslogPacket.concat(packet);
|
||||
} else if (packet.indexOf("::") > 10) {
|
||||
} else if (nextChar == ':') {
|
||||
syslogPacket.concat("MESSAGE / ");
|
||||
syslogPacket.concat(packet.substring(0,packet.indexOf(">")));
|
||||
syslogPacket.concat(sender);
|
||||
syslogPacket.concat(" ---> ");
|
||||
syslogPacket.concat(packet.substring(packet.indexOf("::") + 2));
|
||||
syslogPacket.concat(packet.substring(colonIndex + 2));
|
||||
} else {
|
||||
syslogPacket.concat(packet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,16 +44,9 @@ namespace TNC_Utils {
|
|||
}
|
||||
|
||||
void handleInputData(char character, int bufferIndex) {
|
||||
String* data;
|
||||
if (bufferIndex == -1) {
|
||||
data = &inputSerialBuffer;
|
||||
} else {
|
||||
data = &inputServerBuffer[bufferIndex];
|
||||
}
|
||||
if (data->length() == 0 && character != (char)FEND) {
|
||||
return;
|
||||
}
|
||||
|
||||
String* data = (bufferIndex == -1) ? &inputSerialBuffer : &inputServerBuffer[bufferIndex];
|
||||
if (data->length() == 0 && character != (char)FEND) return;
|
||||
|
||||
data->concat(character);
|
||||
|
||||
if (character == (char)FEND && data->length() > 3) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue