mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-01-22 00:30:16 +01:00
testing lowerMemory Ussssage
This commit is contained in:
parent
e63d54d9f0
commit
a87cc0be58
|
|
@ -100,7 +100,10 @@ namespace APRS_IS_Utils {
|
|||
lastScreenOn = millis();
|
||||
}
|
||||
}
|
||||
secondLine = "WiFi: " + wifiState + " APRS-IS: " + aprsisState;
|
||||
secondLine = "WiFi: ";
|
||||
secondLine += wifiState;
|
||||
secondLine += " APRS-IS: ";
|
||||
secondLine += aprsisState;
|
||||
}
|
||||
|
||||
String buildPacketToUpload(const String& packet) {
|
||||
|
|
@ -115,7 +118,9 @@ namespace APRS_IS_Utils {
|
|||
String buildPacketToTx(const String& aprsisPacket, uint8_t packetType) {
|
||||
String packet = aprsisPacket;
|
||||
packet.trim();
|
||||
String outputPacket = packet.substring(0, packet.indexOf(",")) + ",TCPIP,WIDE1-1," + Config.callsign;
|
||||
String outputPacket = packet.substring(0, packet.indexOf(","));
|
||||
outputPacket.concat(",TCPIP,WIDE1-1,");
|
||||
outputPacket.concat(Config.callsign);
|
||||
switch (packetType) {
|
||||
case 0: // gps
|
||||
if (packet.indexOf(":=") > 0) {
|
||||
|
|
@ -150,7 +155,8 @@ namespace APRS_IS_Utils {
|
|||
bool processReceivedLoRaMessage(const String& sender, const String& packet) {
|
||||
String receivedMessage;
|
||||
if (packet.indexOf("{") > 0) { // ack?
|
||||
String ackMessage = "ack" + packet.substring(packet.indexOf("{") + 1);
|
||||
String ackMessage = "ack";
|
||||
ackMessage.concat(packet.substring(packet.indexOf("{") + 1));
|
||||
ackMessage.trim();
|
||||
//Serial.println(ackMessage);
|
||||
String processedSender = sender;
|
||||
|
|
@ -268,8 +274,10 @@ namespace APRS_IS_Utils {
|
|||
for (int j = sixthLine.length();j < 9;j++) {
|
||||
sixthLine += " ";
|
||||
}
|
||||
sixthLine += "> " + Sender;
|
||||
seventhLine = "QUERY = " + receivedMessage;
|
||||
sixthLine += "> ";
|
||||
sixthLine += Sender;
|
||||
seventhLine = "QUERY = ";
|
||||
seventhLine += receivedMessage;
|
||||
}
|
||||
} else {
|
||||
Utils::print("Received Message from APRS-IS : " + packet);
|
||||
|
|
|
|||
|
|
@ -222,10 +222,26 @@ namespace BME_Utils {
|
|||
humStr = "..";
|
||||
}
|
||||
presStr = generatePresString(newPress + (Config.bme.heightCorrection/CORRECTION_FACTOR));
|
||||
fifthLine = "BME-> " + String(int(newTemp + Config.bme.temperatureCorrection))+"C " + humStr + "% " + presStr.substring(0,4) + "hPa";
|
||||
wx = ".../...g...t" + tempStr + "r...p...P...h" + humStr + "b" + presStr;
|
||||
|
||||
fifthLine = "BME-> ";
|
||||
fifthLine += String(int(newTemp + Config.bme.temperatureCorrection));
|
||||
fifthLine += "C ";
|
||||
fifthLine += humStr;
|
||||
fifthLine += "% ";
|
||||
fifthLine += presStr.substring(0,4);
|
||||
fifthLine += "hPa";
|
||||
|
||||
wx = ".../...g...t";
|
||||
wx += tempStr;
|
||||
wx += "r...p...P...h";
|
||||
wx += humStr;
|
||||
wx += "b";
|
||||
wx += presStr;
|
||||
|
||||
if (wxModuleType == 3) {
|
||||
wx += "Gas: " + String(newGas) + "Kohms";
|
||||
wx += "Gas: ";
|
||||
wx += String(newGas);
|
||||
wx += "Kohms";
|
||||
}
|
||||
return wx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,13 @@ namespace DIGI_Utils {
|
|||
else {
|
||||
path.replace("WIDE1-" + hop, Config.callsign + "*,WIDE1-" + String(hop.toInt() - 1));
|
||||
}
|
||||
String repeatedPacket = sender + ">" + tocall + "," + path + packet.substring(packet.indexOf(":"));
|
||||
|
||||
String repeatedPacket = sender;
|
||||
repeatedPacket += ">";
|
||||
repeatedPacket += tocall;
|
||||
repeatedPacket += ",";
|
||||
repeatedPacket += path;
|
||||
repeatedPacket += packet.substring(packet.indexOf(":"));
|
||||
return repeatedPacket;
|
||||
}
|
||||
else {
|
||||
|
|
@ -63,7 +69,7 @@ namespace DIGI_Utils {
|
|||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
||||
Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign) {
|
||||
if (STATION_Utils::check25SegBuffer(Sender, packet.substring(packet.indexOf(":")+2))) {
|
||||
if (STATION_Utils::check25SegBuffer(Sender, packet.substring(packet.indexOf(":") + 2))) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 2); // Digi
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
|
|
|
|||
|
|
@ -54,11 +54,18 @@ namespace GPS_Utils {
|
|||
void generateBeacons() {
|
||||
String beaconPacket = Config.callsign + ">APLRG1";
|
||||
if (Config.beacon.path != "") {
|
||||
beaconPacket += "," + Config.beacon.path;
|
||||
beaconPacket += ",";
|
||||
beaconPacket += Config.beacon.path;
|
||||
}
|
||||
String encodedGPS = encodeGPS(Config.beacon.latitude, Config.beacon.longitude, Config.beacon.overlay, Config.beacon.symbol);
|
||||
iGateBeaconPacket = beaconPacket + ",qAC:!" + encodedGPS;
|
||||
iGateLoRaBeaconPacket = beaconPacket + ":!" + encodedGPS;
|
||||
|
||||
iGateBeaconPacket = beaconPacket;
|
||||
iGateBeaconPacket += ",qAC:!";
|
||||
iGateBeaconPacket += encodedGPS;
|
||||
|
||||
iGateLoRaBeaconPacket = beaconPacket;
|
||||
iGateLoRaBeaconPacket += ":!";
|
||||
iGateLoRaBeaconPacket += encodedGPS;
|
||||
}
|
||||
|
||||
double calculateDistanceTo(double latitude, double longitude) {
|
||||
|
|
@ -93,9 +100,9 @@ namespace GPS_Utils {
|
|||
String getReceivedGPS(const String& packet) {
|
||||
String infoGPS;
|
||||
if (packet.indexOf(":!") > 10) {
|
||||
infoGPS = packet.substring(packet.indexOf(":!")+2);
|
||||
infoGPS = packet.substring(packet.indexOf(":!") + 2);
|
||||
} else if (packet.indexOf(":=") > 10) {
|
||||
infoGPS = packet.substring(packet.indexOf(":=")+2);
|
||||
infoGPS = packet.substring(packet.indexOf(":=") + 2);
|
||||
}
|
||||
String Latitude = infoGPS.substring(0,8);
|
||||
String Longitude = infoGPS.substring(9,18);
|
||||
|
|
@ -104,10 +111,11 @@ namespace GPS_Utils {
|
|||
float convertedLatitude, convertedLongitude;
|
||||
String firstLatPart = Latitude.substring(0,2);
|
||||
String secondLatPart = Latitude.substring(2,4);
|
||||
String thirdLatPart = Latitude.substring(Latitude.indexOf(".")+1,Latitude.indexOf(".")+3);
|
||||
String thirdLatPart = Latitude.substring(Latitude.indexOf(".") + 1, Latitude.indexOf(".") + 3);
|
||||
String firstLngPart = Longitude.substring(0,3);
|
||||
String secondLngPart = Longitude.substring(3,5);
|
||||
String thirdLngPart = Longitude.substring(Longitude.indexOf(".")+1,Longitude.indexOf(".")+3);
|
||||
String thirdLngPart = Longitude.substring(Longitude.indexOf(".") + 1, Longitude.indexOf(".") + 3);
|
||||
|
||||
convertedLatitude = firstLatPart.toFloat() + (secondLatPart.toFloat()/60) + (thirdLatPart.toFloat()/(60*100));
|
||||
convertedLongitude = firstLngPart.toFloat() + (secondLngPart.toFloat()/60) + (thirdLngPart.toFloat()/(60*100));
|
||||
|
||||
|
|
|
|||
|
|
@ -188,9 +188,9 @@ namespace LoRa_Utils {
|
|||
return packet;
|
||||
}
|
||||
} else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
|
||||
rssi = radio.getRSSI();
|
||||
snr = radio.getSNR();
|
||||
freqError = radio.getFrequencyError();
|
||||
rssi = radio.getRSSI();
|
||||
snr = radio.getSNR();
|
||||
freqError = radio.getFrequencyError();
|
||||
Utils::println(F("CRC error!"));
|
||||
if (Config.syslog.active && WiFi.status() == WL_CONNECTED) {
|
||||
SYSLOG_Utils::log(0, packet, rssi, snr, freqError); // CRC
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ namespace STATION_Utils {
|
|||
lastHeardStation.push_back(station + "," + String(millis()));
|
||||
}
|
||||
|
||||
fourthLine = "Stations (" + String(Config.rememberStationTime) + "min) = ";
|
||||
fourthLine = "Stations (";
|
||||
fourthLine += String(Config.rememberStationTime);
|
||||
fourthLine += "min) = ";
|
||||
if (lastHeardStation.size() < 10) {
|
||||
fourthLine += " ";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,18 +45,22 @@ uint32_t lastScreenOn = millis();
|
|||
namespace Utils {
|
||||
|
||||
void processStatus() {
|
||||
String status = Config.callsign + ">APLRG1," + Config.beacon.path;
|
||||
String status = Config.callsign;
|
||||
status.concat(">APLRG1,");
|
||||
status.concat(Config.beacon.path);
|
||||
|
||||
if (WiFi.status() == WL_CONNECTED && Config.aprs_is.active && Config.beacon.sendViaAPRSIS) {
|
||||
delay(1000);
|
||||
status += ",qAC:>https://github.com/richonguzman/LoRa_APRS_iGate " + versionDate;
|
||||
status.concat(",qAC:>https://github.com/richonguzman/LoRa_APRS_iGate ");
|
||||
status.concat(versionDate);
|
||||
APRS_IS_Utils::upload(status);
|
||||
SYSLOG_Utils::log(2, status, 0, 0.0, 0); // APRSIS TX
|
||||
statusAfterBoot = false;
|
||||
}
|
||||
if (statusAfterBoot && !Config.beacon.sendViaAPRSIS && Config.beacon.sendViaRF) {
|
||||
delay(2000);
|
||||
status += ":>https://github.com/richonguzman/LoRa_APRS_iGate " + versionDate;
|
||||
status.concat(":>https://github.com/richonguzman/LoRa_APRS_iGate ");
|
||||
status.concat(versionDate);
|
||||
STATION_Utils::addToOutputPacketBuffer(status);
|
||||
statusAfterBoot = false;
|
||||
}
|
||||
|
|
@ -87,11 +91,13 @@ namespace Utils {
|
|||
}
|
||||
|
||||
void activeStations() {
|
||||
fourthLine = "Stations (" + String(Config.rememberStationTime) + "min) = ";
|
||||
fourthLine = "Stations (";
|
||||
fourthLine.concat(String(Config.rememberStationTime));
|
||||
fourthLine.concat("min) = ");
|
||||
if (lastHeardStation.size() < 10) {
|
||||
fourthLine += " ";
|
||||
}
|
||||
fourthLine += String(lastHeardStation.size());
|
||||
fourthLine.concat(String(lastHeardStation.size()));
|
||||
}
|
||||
|
||||
void checkBeaconInterval() {
|
||||
|
|
@ -129,9 +135,13 @@ namespace Utils {
|
|||
float internalVoltage = BATTERY_Utils::checkInternalVoltage();
|
||||
String internalVoltageInfo = String(internalVoltage,2) + "V";
|
||||
if (Config.battery.sendInternalVoltage) {
|
||||
beaconPacket += " Batt=" + internalVoltageInfo;
|
||||
secondaryBeaconPacket += " Batt=" + internalVoltageInfo;
|
||||
sixthLine = " (Batt=" + internalVoltageInfo + ")";
|
||||
beaconPacket += " Batt=";
|
||||
beaconPacket += internalVoltageInfo;
|
||||
secondaryBeaconPacket += " Batt=";
|
||||
secondaryBeaconPacket += internalVoltageInfo;
|
||||
sixthLine = " (Batt=";
|
||||
sixthLine += internalVoltageInfo;
|
||||
sixthLine += ")";
|
||||
}
|
||||
if (Config.battery.monitorInternalVoltage && internalVoltage < Config.battery.internalSleepVoltage) {
|
||||
beaconPacket += " **IntBatWarning:SLEEP**";
|
||||
|
|
@ -145,9 +155,13 @@ namespace Utils {
|
|||
float externalVoltage = BATTERY_Utils::checkExternalVoltage();
|
||||
String externalVoltageInfo = String(externalVoltage,2) + "V";
|
||||
if (Config.battery.sendExternalVoltage) {
|
||||
beaconPacket += " Ext=" + externalVoltageInfo;
|
||||
secondaryBeaconPacket += " Ext=" + externalVoltageInfo;
|
||||
sixthLine = " (Ext V=" + externalVoltageInfo + ")";
|
||||
beaconPacket += " Ext=";
|
||||
beaconPacket += externalVoltageInfo;
|
||||
secondaryBeaconPacket += " Ext=";
|
||||
secondaryBeaconPacket += externalVoltageInfo;
|
||||
sixthLine = " (Ext V=";
|
||||
sixthLine += externalVoltageInfo;
|
||||
sixthLine += ")";
|
||||
}
|
||||
if (Config.battery.monitorExternalVoltage && externalVoltage < Config.battery.externalSleepVoltage) {
|
||||
beaconPacket += " **ExtBatWarning:SLEEP**";
|
||||
|
|
@ -200,36 +214,42 @@ namespace Utils {
|
|||
}
|
||||
|
||||
void typeOfPacket(const String& packet, uint8_t packetType) {
|
||||
String sender;
|
||||
String sender = packet.substring(0,packet.indexOf(">"));
|
||||
switch (packetType) {
|
||||
case 0: // LoRa-APRS
|
||||
fifthLine = "LoRa Rx ----> APRS-IS";
|
||||
sender = packet.substring(0,packet.indexOf(">"));
|
||||
break;
|
||||
case 1: // APRS-LoRa
|
||||
fifthLine = "APRS-IS ----> LoRa Tx";
|
||||
sender = packet.substring(0,packet.indexOf(">"));
|
||||
break;
|
||||
case 2: // Digi
|
||||
fifthLine = "LoRa Rx ----> LoRa Tx";
|
||||
sender = packet.substring(0,packet.indexOf(">"));
|
||||
break;
|
||||
}
|
||||
for (int i = sender.length(); i < 9; i++) {
|
||||
sender += " ";
|
||||
}
|
||||
sixthLine = sender;
|
||||
String seventhLineHelper = "RSSI:";
|
||||
seventhLineHelper += String(rssi);
|
||||
seventhLineHelper += "dBm SNR: ";
|
||||
seventhLineHelper += String(snr);
|
||||
seventhLineHelper += "dBm";
|
||||
|
||||
if (packet.indexOf("::") >= 10) {
|
||||
sixthLine = sender + "> MESSAGE";
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
|
||||
sixthLine += "> MESSAGE";
|
||||
seventhLine = seventhLineHelper;
|
||||
} else if (packet.indexOf(":>") >= 10) {
|
||||
sixthLine = sender + "> NEW STATUS";
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
|
||||
sixthLine += "> NEW STATUS";
|
||||
seventhLine = seventhLineHelper;
|
||||
} else if (packet.indexOf(":!") >= 10 || packet.indexOf(":=") >= 10) {
|
||||
sixthLine = sender + "> GPS BEACON";
|
||||
sixthLine += "> GPS BEACON";
|
||||
if (!Config.syslog.active) {
|
||||
GPS_Utils::getDistanceAndComment(packet); // to be checked!!!
|
||||
}
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm";
|
||||
}
|
||||
seventhLine = "RSSI:";
|
||||
seventhLine += String(rssi);
|
||||
seventhLine += "dBm";
|
||||
if (rssi <= -100) {
|
||||
seventhLine += " ";
|
||||
} else {
|
||||
|
|
@ -238,19 +258,21 @@ namespace Utils {
|
|||
if (distance.indexOf(".") == 1) {
|
||||
seventhLine += " ";
|
||||
}
|
||||
seventhLine += "D:" + distance + "km";
|
||||
seventhLine += "D:";
|
||||
seventhLine += distance;
|
||||
seventhLine += "km";
|
||||
} else if (packet.indexOf(":T#") >= 10 && packet.indexOf(":=/") == -1) {
|
||||
sixthLine = sender + "> TELEMETRY";
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
|
||||
sixthLine += "> TELEMETRY";
|
||||
seventhLine = seventhLineHelper;
|
||||
} else if (packet.indexOf(":`") >= 10) {
|
||||
sixthLine = sender + "> MIC-E";
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
|
||||
sixthLine += "> MIC-E";
|
||||
seventhLine = seventhLineHelper;
|
||||
} else if (packet.indexOf(":;") >= 10) {
|
||||
sixthLine = sender + "> OBJECT";
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
|
||||
sixthLine += "> OBJECT";
|
||||
seventhLine = seventhLineHelper;
|
||||
} else {
|
||||
sixthLine = sender + "> ??????????";
|
||||
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
|
||||
sixthLine += "> ??????????";
|
||||
seventhLine = seventhLineHelper;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue