many updates const String and 3rd party
This commit is contained in:
parent
64b51fea72
commit
b97457146a
|
|
@ -146,7 +146,12 @@
|
|||
}
|
||||
|
||||
void APRS_IS_connect() {
|
||||
String loginInfo = "user " + Config.callsign + " pass " + String(Config.aprs_is.passcode) + " vers CA2RXU_LoRa_iGate 1.3 filter " + Config.aprs_is.filter;
|
||||
String loginInfo = "user ";
|
||||
loginInfo += Config.callsign;
|
||||
loginInfo += " pass ";
|
||||
loginInfo += String(Config.aprs_is.passcode);
|
||||
loginInfo += " vers CA2RXU_LoRa_iGate 1.3 filter ";
|
||||
loginInfo += Config.aprs_is.filter;
|
||||
Serial.println("-----> Connecting to APRS IS");
|
||||
while (!modemStartUp) {
|
||||
Serial.print("Opening Port... ");
|
||||
|
|
|
|||
|
|
@ -36,9 +36,8 @@ namespace APRS_IS_Utils {
|
|||
}
|
||||
|
||||
void connect() {
|
||||
uint8_t count = 0;
|
||||
String aprsauth;
|
||||
Serial.print("Connecting to APRS-IS ... ");
|
||||
uint8_t count = 0;
|
||||
while (!espClient.connect(Config.aprs_is.server.c_str(), Config.aprs_is.port) && count < 20) {
|
||||
Serial.println("Didn't connect with server...");
|
||||
delay(1000);
|
||||
|
|
@ -54,10 +53,14 @@ namespace APRS_IS_Utils {
|
|||
}
|
||||
else {
|
||||
Serial.println("Connected!\n(Server: " + String(Config.aprs_is.server) + " / Port: " + String(Config.aprs_is.port) + ")");
|
||||
|
||||
// String filter = "t/m/" + Config.callsign + "/" + (String)Config.aprs_is.reportingDistance;
|
||||
|
||||
aprsauth = "user " + Config.callsign + " pass " + Config.aprs_is.passcode + " vers CA2RXU_LoRa_iGate 1.3 filter " + Config.aprs_is.filter;
|
||||
String aprsauth = "user ";
|
||||
aprsauth += Config.callsign;
|
||||
aprsauth += " pass ";
|
||||
aprsauth += Config.aprs_is.passcode;
|
||||
aprsauth += " vers CA2RXU_LoRa_iGate 1.3 filter ";
|
||||
aprsauth += Config.aprs_is.filter;
|
||||
upload(aprsauth);
|
||||
delay(200);
|
||||
}
|
||||
|
|
@ -115,12 +118,15 @@ namespace APRS_IS_Utils {
|
|||
}
|
||||
|
||||
String buildPacketToUpload(const String& packet) {
|
||||
String payload = checkForStartingBytes(packet.substring(packet.indexOf(":")));
|
||||
String buildedPacket = packet.substring(3, packet.indexOf(":"));
|
||||
if (!(Config.aprs_is.active && Config.digi.mode == 0)) { // Check if NOT only IGate
|
||||
return packet.substring(3, packet.indexOf(":")) + ",qAR," + Config.callsign + payload;
|
||||
buildedPacket += ",qAR,";
|
||||
} else {
|
||||
return packet.substring(3, packet.indexOf(":")) + ",qAO," + Config.callsign + payload;
|
||||
buildedPacket += ",qAO,";
|
||||
}
|
||||
buildedPacket += Config.callsign;
|
||||
buildedPacket += checkForStartingBytes(packet.substring(packet.indexOf(":")));
|
||||
return buildedPacket;
|
||||
}
|
||||
|
||||
String buildPacketToTx(const String& aprsisPacket, uint8_t packetType) {
|
||||
|
|
@ -175,16 +181,24 @@ namespace APRS_IS_Utils {
|
|||
ackMessage.concat(packet.substring(packet.indexOf("{") + 1));
|
||||
ackMessage.trim();
|
||||
//Serial.println(ackMessage);
|
||||
|
||||
String addToBuffer = Config.callsign;
|
||||
addToBuffer += ">APLRG1,RFONLY";
|
||||
if (Config.beacon.path != "") {
|
||||
addToBuffer += ",";
|
||||
addToBuffer += Config.beacon.path;
|
||||
}
|
||||
addToBuffer += "::";
|
||||
|
||||
String processedSender = sender;
|
||||
for (int i = sender.length(); i < 9; i++) {
|
||||
processedSender += ' ';
|
||||
}
|
||||
if (Config.beacon.path == "") {
|
||||
STATION_Utils::addToOutputPacketBuffer(Config.callsign + ">APLRG1,RFONLY::" + processedSender + ":" + ackMessage);
|
||||
} else {
|
||||
STATION_Utils::addToOutputPacketBuffer(Config.callsign + ">APLRG1,RFONLY," + Config.beacon.path + "::" + processedSender + ":" + ackMessage);
|
||||
}
|
||||
addToBuffer += processedSender;
|
||||
|
||||
addToBuffer += ":";
|
||||
addToBuffer += ackMessage;
|
||||
STATION_Utils::addToOutputPacketBuffer(addToBuffer);
|
||||
receivedMessage = packet.substring(packet.indexOf(":") + 1, packet.indexOf("{"));
|
||||
} else {
|
||||
receivedMessage = packet.substring(packet.indexOf(":") + 1);
|
||||
|
|
@ -205,22 +219,21 @@ namespace APRS_IS_Utils {
|
|||
|
||||
void processLoRaPacket(const String& packet) {
|
||||
if (espClient.connected() || modemLoggedToAPRSIS) {
|
||||
bool queryMessage = false;
|
||||
String aprsPacket, Sender, AddresseeAndMessage, Addressee;
|
||||
if (packet != "") {
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("}") == -1 && packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||
Sender = packet.substring(3, packet.indexOf(">"));
|
||||
const String& Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 0); // LoRa-APRS
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
bool queryMessage = false;
|
||||
if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me!
|
||||
queryMessage = processReceivedLoRaMessage(Sender, checkForStartingBytes(AddresseeAndMessage));
|
||||
}
|
||||
if (!queryMessage) {
|
||||
aprsPacket = buildPacketToUpload(packet);
|
||||
const String& aprsPacket = buildPacketToUpload(packet);
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
|
||||
display_toggle(true);
|
||||
}
|
||||
|
|
@ -242,22 +255,28 @@ namespace APRS_IS_Utils {
|
|||
}
|
||||
|
||||
void processAPRSISPacket(const String& packet) {
|
||||
String Sender, AddresseeAndMessage, Addressee, receivedMessage;
|
||||
if (!packet.startsWith("#")) {
|
||||
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
||||
Sender = packet.substring(0, packet.indexOf(">"));
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
String Sender = packet.substring(0, packet.indexOf(">"));
|
||||
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
if (Addressee == Config.callsign) { // its for me!
|
||||
String receivedMessage;
|
||||
if (AddresseeAndMessage.indexOf("{") > 0) { // ack?
|
||||
String ackMessage = "ack" + AddresseeAndMessage.substring(AddresseeAndMessage.indexOf("{") + 1);
|
||||
String ackMessage = "ack";
|
||||
ackMessage += AddresseeAndMessage.substring(AddresseeAndMessage.indexOf("{") + 1);
|
||||
ackMessage.trim();
|
||||
delay(4000);
|
||||
for (int i = Sender.length(); i < 9; i++) {
|
||||
Sender += ' ';
|
||||
}
|
||||
String ackPacket = Config.callsign + ">APLRG1,TCPIP,qAC::" + Sender + ":" + ackMessage;
|
||||
|
||||
String ackPacket = Config.callsign;
|
||||
ackPacket += ">APLRG1,TCPIP,qAC::";
|
||||
ackPacket += Sender;
|
||||
ackPacket += ":";
|
||||
ackPacket += ackMessage;
|
||||
#ifdef HAS_A7670
|
||||
A7670_Utils::uploadToAPRSIS(ackPacket);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -91,11 +91,8 @@ namespace BATTERY_Utils {
|
|||
|
||||
void checkIfShouldSleep() {
|
||||
if (lastBatteryCheck == 0 || millis() - lastBatteryCheck >= 15 * 60 * 1000) {
|
||||
lastBatteryCheck = millis();
|
||||
|
||||
float voltage = checkInternalVoltage();
|
||||
|
||||
if (voltage < Config.lowVoltageCutOff) {
|
||||
lastBatteryCheck = millis();
|
||||
if (checkInternalVoltage() < Config.lowVoltageCutOff) {
|
||||
ESP.deepSleep(1800000000); // 30 min sleep (60s = 60e6)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,8 +130,7 @@ namespace BME_Utils {
|
|||
}
|
||||
|
||||
String generateTempString(const float bmeTemp) {
|
||||
String strTemp;
|
||||
strTemp = String((int)bmeTemp);
|
||||
String strTemp = String((int)bmeTemp);
|
||||
switch (strTemp.length()) {
|
||||
case 1:
|
||||
return "00" + strTemp;
|
||||
|
|
@ -145,8 +144,7 @@ namespace BME_Utils {
|
|||
}
|
||||
|
||||
String generateHumString(const float bmeHum) {
|
||||
String strHum;
|
||||
strHum = String((int)bmeHum);
|
||||
String strHum = String((int)bmeHum);
|
||||
switch (strHum.length()) {
|
||||
case 1:
|
||||
return "0" + strHum;
|
||||
|
|
|
|||
|
|
@ -37,17 +37,16 @@ namespace DIGI_Utils {
|
|||
return packetToRepeat;
|
||||
}
|
||||
|
||||
|
||||
String generateDigiRepeatedPacket(const String& packet, bool thirdParty){
|
||||
String temp, path;
|
||||
String temp;
|
||||
if (thirdParty) { // only header is used
|
||||
String header = packet.substring(0, packet.indexOf(":}"));
|
||||
const String& header = packet.substring(0, packet.indexOf(":}"));
|
||||
temp = header.substring(header.indexOf(">") + 1);
|
||||
} else {
|
||||
temp = packet.substring(packet.indexOf(">") + 1, packet.indexOf(":"));
|
||||
}
|
||||
if (temp.indexOf(",") > 2) { // checks for path
|
||||
path = temp.substring(temp.indexOf(",") + 1);
|
||||
const String& path = temp.substring(temp.indexOf(",") + 1);
|
||||
if (path.indexOf(Config.beacon.path) != -1) {
|
||||
return buildPacket(path, packet, thirdParty);
|
||||
} else {
|
||||
|
|
@ -58,61 +57,45 @@ namespace DIGI_Utils {
|
|||
}
|
||||
}
|
||||
|
||||
void processLoRaPacket(const String& packet) {
|
||||
bool queryMessage = false;
|
||||
String loraPacket, Sender, AddresseeAndMessage, Addressee;
|
||||
void processLoRaPacket(const String& packet) {
|
||||
if (packet != "") {
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
||||
bool thirdPartyPacket = false;
|
||||
String temp, Sender;
|
||||
if (packet.indexOf("}") > 0 && packet.indexOf("TCPIP") > 0) { // 3rd Party
|
||||
String noHeaderPacket = packet.substring(packet.indexOf(":}") + 2);
|
||||
Sender = noHeaderPacket.substring(0, noHeaderPacket.indexOf(">"));
|
||||
if (Sender != Config.callsign) { // avoid processing own packets
|
||||
if (STATION_Utils::check25SegBuffer(Sender, noHeaderPacket.substring(noHeaderPacket.indexOf(":") + 2))) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(noHeaderPacket, 2); // Digi
|
||||
if (noHeaderPacket.indexOf("::") > 10) { // it's a message
|
||||
AddresseeAndMessage = noHeaderPacket.substring(noHeaderPacket.indexOf("::") + 2);
|
||||
Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
if (Addressee == Config.callsign) { // it's a message for me!
|
||||
queryMessage = APRS_IS_Utils::processReceivedLoRaMessage(Sender, AddresseeAndMessage);
|
||||
}
|
||||
}
|
||||
if (!queryMessage) {
|
||||
loraPacket = generateDigiRepeatedPacket(packet.substring(3), true);
|
||||
if (loraPacket != "") {
|
||||
STATION_Utils::addToOutputPacketBuffer(loraPacket);
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
thirdPartyPacket = true;
|
||||
temp = packet.substring(packet.indexOf(":}") + 2);
|
||||
Sender = temp.substring(0, temp.indexOf(">"));
|
||||
} else {
|
||||
Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
|
||||
if (STATION_Utils::check25SegBuffer(Sender, packet.substring(packet.indexOf(":") + 2))) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 2); // Digi
|
||||
if (packet.indexOf("::") > 10) { // it's a message
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
if (Addressee == Config.callsign) { // its a message for me!
|
||||
queryMessage = APRS_IS_Utils::processReceivedLoRaMessage(Sender, AddresseeAndMessage);
|
||||
}
|
||||
}
|
||||
if (!queryMessage) {
|
||||
loraPacket = generateDigiRepeatedPacket(packet.substring(3), false);
|
||||
if (loraPacket != "") {
|
||||
STATION_Utils::addToOutputPacketBuffer(loraPacket);
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
temp = packet.substring(3);
|
||||
Sender = packet.substring(3, packet.indexOf(">"));
|
||||
}
|
||||
if (Sender != Config.callsign) { // Avoid listening to own packets
|
||||
if (!thirdPartyPacket && !Utils::checkValidCallsign(Sender)) {
|
||||
return;
|
||||
}
|
||||
if (STATION_Utils::check25SegBuffer(Sender, temp.substring(temp.indexOf(":") + 2))) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(temp, 2); // Digi
|
||||
bool queryMessage = false;
|
||||
if (temp.indexOf("::") > 10) { // it's a message
|
||||
String AddresseeAndMessage = temp.substring(temp.indexOf("::") + 2);
|
||||
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
if (Addressee == Config.callsign) { // it's a message for me!
|
||||
queryMessage = APRS_IS_Utils::processReceivedLoRaMessage(Sender, AddresseeAndMessage);
|
||||
}
|
||||
}
|
||||
if (!queryMessage) {
|
||||
String loraPacket = generateDigiRepeatedPacket(packet.substring(3), thirdPartyPacket);
|
||||
if (loraPacket != "") {
|
||||
STATION_Utils::addToOutputPacketBuffer(loraPacket);
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ namespace GPS_Utils {
|
|||
for (i = 0; i < 4; i++) {
|
||||
encodedData += helper_base91[i];
|
||||
}
|
||||
encodedData += symbol + " x" + "\x47";
|
||||
encodedData += symbol;
|
||||
encodedData += " x";
|
||||
encodedData += "\x47";
|
||||
return encodedData;
|
||||
}
|
||||
|
||||
|
|
@ -80,10 +82,10 @@ namespace GPS_Utils {
|
|||
}
|
||||
|
||||
String decodeEncodedGPS(const String& packet) {
|
||||
String GPSPacket = packet.substring(packet.indexOf(":!")+3);
|
||||
String encodedLatitude = GPSPacket.substring(0,4);
|
||||
String encodedLongtitude = GPSPacket.substring(4,8);
|
||||
String comment = GPSPacket.substring(12);
|
||||
const String& GPSPacket = packet.substring(packet.indexOf(":!")+3);
|
||||
const String& encodedLatitude = GPSPacket.substring(0,4);
|
||||
const String& encodedLongtitude = GPSPacket.substring(4,8);
|
||||
const String& comment = GPSPacket.substring(12);
|
||||
|
||||
int Y1 = int(encodedLatitude[0]);
|
||||
int Y2 = int(encodedLatitude[1]);
|
||||
|
|
@ -96,12 +98,21 @@ namespace GPS_Utils {
|
|||
int X3 = int(encodedLongtitude[2]);
|
||||
int X4 = int(encodedLongtitude[3]);
|
||||
float decodedLongitude = -180.0 + ((((X1-33) * pow(91,3)) + ((X2-33) * pow(91,2)) + ((X3-33) * 91) + X4-33) / 190463.0);
|
||||
|
||||
distance = String(calculateDistanceTo(decodedLatitude, decodedLongitude),1);
|
||||
|
||||
String decodedGPS = String(decodedLatitude,5);
|
||||
decodedGPS += "N / ";
|
||||
decodedGPS += String(decodedLongitude,5);
|
||||
decodedGPS += "E / ";
|
||||
decodedGPS += distance;
|
||||
decodedGPS += "km";
|
||||
|
||||
if (comment != "") {
|
||||
return String(decodedLatitude,5) + "N / " + String(decodedLongitude,5) + "E / " + distance + "km / " + comment;
|
||||
} else {
|
||||
return String(decodedLatitude,5) + "N / " + String(decodedLongitude,5) + "E / " + distance + "km";
|
||||
decodedGPS += " / ";
|
||||
decodedGPS += comment;
|
||||
}
|
||||
return decodedGPS;
|
||||
}
|
||||
|
||||
String getReceivedGPS(const String& packet) {
|
||||
|
|
@ -111,36 +122,43 @@ namespace GPS_Utils {
|
|||
} else if (packet.indexOf(":=") > 10) {
|
||||
infoGPS = packet.substring(packet.indexOf(":=") + 2);
|
||||
}
|
||||
String Latitude = infoGPS.substring(0,8);
|
||||
String Longitude = infoGPS.substring(9,18);
|
||||
String comment = infoGPS.substring(19);
|
||||
|
||||
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 firstLngPart = Longitude.substring(0,3);
|
||||
String secondLngPart = Longitude.substring(3,5);
|
||||
String thirdLngPart = Longitude.substring(Longitude.indexOf(".") + 1, Longitude.indexOf(".") + 3);
|
||||
const String& Latitude = infoGPS.substring(0,8);
|
||||
const String& Longitude = infoGPS.substring(9,18);
|
||||
const String& comment = infoGPS.substring(19);
|
||||
|
||||
float convertedLatitude, convertedLongitude;
|
||||
const String& firstLatPart = Latitude.substring(0,2);
|
||||
const String& secondLatPart = Latitude.substring(2,4);
|
||||
const String& thirdLatPart = Latitude.substring(Latitude.indexOf(".") + 1, Latitude.indexOf(".") + 3);
|
||||
convertedLatitude = firstLatPart.toFloat() + (secondLatPart.toFloat()/60) + (thirdLatPart.toFloat()/(60*100));
|
||||
|
||||
const String& firstLngPart = Longitude.substring(0,3);
|
||||
const String& secondLngPart = Longitude.substring(3,5);
|
||||
const String& thirdLngPart = Longitude.substring(Longitude.indexOf(".") + 1, Longitude.indexOf(".") + 3);
|
||||
convertedLongitude = firstLngPart.toFloat() + (secondLngPart.toFloat()/60) + (thirdLngPart.toFloat()/(60*100));
|
||||
|
||||
String LatSign = String(Latitude[7]);
|
||||
String LngSign = String(Longitude[8]);
|
||||
if (LatSign == "S") {
|
||||
if (String(Latitude[7]) == "S") {
|
||||
convertedLatitude = -convertedLatitude;
|
||||
}
|
||||
if (LngSign == "W") {
|
||||
if (String(Longitude[8]) == "W") {
|
||||
convertedLongitude = -convertedLongitude;
|
||||
}
|
||||
|
||||
distance = String(calculateDistanceTo(convertedLatitude, convertedLongitude),1);
|
||||
|
||||
String decodedGPS = String(convertedLatitude,5);
|
||||
decodedGPS += "N / ";
|
||||
decodedGPS += String(convertedLongitude,5);
|
||||
decodedGPS += "E / ";
|
||||
decodedGPS += distance;
|
||||
decodedGPS += "km";
|
||||
|
||||
if (comment != "") {
|
||||
return String(convertedLatitude,5) + "N / " + String(convertedLongitude,5) + "E / " + distance + "km / " + comment;
|
||||
} else {
|
||||
return String(convertedLatitude,5) + "N / " + String(convertedLongitude,5) + "E / " + distance + "km";
|
||||
decodedGPS += " / ";
|
||||
decodedGPS += comment;
|
||||
}
|
||||
}
|
||||
return decodedGPS;
|
||||
}
|
||||
|
||||
String getDistanceAndComment(const String& packet) {
|
||||
uint8_t encodedBytePosition = 0;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace QUERY_Utils {
|
|||
String process(const String& query, const String& station, const uint8_t queryOrigin) {
|
||||
String answer;
|
||||
if (query=="?APRS?" || query=="?aprs?" || query=="?Aprs?" || query=="H" || query=="h" || query=="HELP" || query=="Help" || query=="help" || query=="?") {
|
||||
answer = "?APRSV ?APRSP ?APRSL ?APRSH ?WHERE callsign";
|
||||
answer.concat("?APRSV ?APRSP ?APRSL ?APRSH ?WHERE callsign");
|
||||
} else if (query=="?APRSV" || query=="?aprsv" || query=="?Aprsv") {
|
||||
answer = "CA2RXU_LoRa_iGate 1.3 v";
|
||||
answer.concat(versionDate);
|
||||
|
|
@ -42,25 +42,33 @@ namespace QUERY_Utils {
|
|||
} else if (query.indexOf("?APRSH") == 0 || query.indexOf("?aprsh") == 0 || query.indexOf("?Aprsh") == 0) {
|
||||
// sacar callsign despues de ?APRSH
|
||||
Serial.println("escuchaste a X estacion? en las ultimas 24 o 8 horas?");
|
||||
answer = "?APRSH on development 73!";
|
||||
answer.concat("?APRSH on development 73!");
|
||||
} else if (query.indexOf("?WHERE") == 0) {
|
||||
// agregar callsign para completar donde esta X callsign --> posicion
|
||||
Serial.println("estaciones escuchadas directo (ultimos 30 min)");
|
||||
answer = "?WHERE on development 73!";
|
||||
answer.concat("?WHERE on development 73!");
|
||||
}
|
||||
String processedStation = station;
|
||||
for (int i = station.length(); i < 9; i++) {
|
||||
processedStation += ' ';
|
||||
}
|
||||
String queryAnswer = Config.callsign;
|
||||
queryAnswer += ">APLRG1,";
|
||||
if (queryOrigin == 1) { // from APRS-IS
|
||||
return Config.callsign + ">APLRG1,TCPIP,qAC::" + processedStation + ":" + answer;
|
||||
} else { // else == 0 , from LoRa
|
||||
queryAnswer += "TCPIP,qAC::";
|
||||
} else { // else == 0 , from LoRa
|
||||
if (Config.beacon.path == "") {
|
||||
return Config.callsign + ">APLRG1,RFONLY::" + processedStation + ":" + answer;
|
||||
queryAnswer += "RFONLY::";
|
||||
} else {
|
||||
return Config.callsign + ">APLRG1,RFONLY," + Config.beacon.path + "::" + processedStation + ":" + answer;
|
||||
queryAnswer += "RFONLY,";
|
||||
queryAnswer += Config.beacon.path;
|
||||
queryAnswer += "::";
|
||||
}
|
||||
}
|
||||
queryAnswer += processedStation;
|
||||
queryAnswer += ":";
|
||||
queryAnswer += answer;
|
||||
return queryAnswer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -81,9 +81,9 @@ namespace STATION_Utils {
|
|||
if (!packet25SegBuffer.empty()) {
|
||||
bool shouldBeIgnored = false;
|
||||
for (int i = 0; i < packet25SegBuffer.size(); i++) {
|
||||
String temp = packet25SegBuffer[i].substring(packet25SegBuffer[i].indexOf(",") + 1);
|
||||
String bufferStation = temp.substring(0, temp.indexOf(","));
|
||||
String bufferMessage = temp.substring(temp.indexOf(",") + 1);
|
||||
const String& temp = packet25SegBuffer[i].substring(packet25SegBuffer[i].indexOf(",") + 1);
|
||||
const String& bufferStation = temp.substring(0, temp.indexOf(","));
|
||||
const String& bufferMessage = temp.substring(temp.indexOf(",") + 1);
|
||||
if (bufferStation == station && bufferMessage == textMessage) {
|
||||
shouldBeIgnored = true;
|
||||
}
|
||||
|
|
@ -101,9 +101,9 @@ namespace STATION_Utils {
|
|||
}
|
||||
|
||||
void processOutputPacketBuffer() {
|
||||
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
||||
uint32_t lastRx = millis() - lastRxTime;
|
||||
uint32_t lastTx = millis() - lastTxTime;
|
||||
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
||||
uint32_t lastRx = millis() - lastRxTime;
|
||||
uint32_t lastTx = millis() - lastTxTime;
|
||||
if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) {
|
||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[0]);
|
||||
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||
|
|
|
|||
|
|
@ -104,9 +104,6 @@ namespace Utils {
|
|||
|
||||
void checkBeaconInterval() {
|
||||
uint32_t lastTx = millis() - lastBeaconTx;
|
||||
String beaconPacket = iGateBeaconPacket;
|
||||
String secondaryBeaconPacket = iGateLoRaBeaconPacket;
|
||||
|
||||
if (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000) {
|
||||
beaconUpdate = true;
|
||||
}
|
||||
|
|
@ -121,6 +118,8 @@ namespace Utils {
|
|||
|
||||
activeStations();
|
||||
|
||||
String beaconPacket = iGateBeaconPacket;
|
||||
String secondaryBeaconPacket = iGateLoRaBeaconPacket;
|
||||
if (Config.bme.active && wxModuleType != 0) {
|
||||
String sensorData = BME_Utils::readDataSensor();
|
||||
beaconPacket += sensorData;
|
||||
|
|
@ -129,26 +128,26 @@ namespace Utils {
|
|||
beaconPacket += ".../...g...t...r...p...P...h..b.....";
|
||||
secondaryBeaconPacket += ".../...g...t...r...p...P...h..b.....";
|
||||
}
|
||||
beaconPacket += Config.beacon.comment;
|
||||
secondaryBeaconPacket += Config.beacon.comment;
|
||||
beaconPacket += Config.beacon.comment;
|
||||
secondaryBeaconPacket += Config.beacon.comment;
|
||||
|
||||
#if defined(BATTERY_PIN) || defined(HAS_AXP192) || defined(HAS_AXP2101)
|
||||
if (Config.battery.sendInternalVoltage || Config.battery.monitorInternalVoltage) {
|
||||
float internalVoltage = BATTERY_Utils::checkInternalVoltage();
|
||||
String internalVoltageInfo = String(internalVoltage,2) + "V";
|
||||
if (Config.battery.sendInternalVoltage) {
|
||||
beaconPacket += " Batt=";
|
||||
beaconPacket += internalVoltageInfo;
|
||||
secondaryBeaconPacket += " Batt=";
|
||||
secondaryBeaconPacket += internalVoltageInfo;
|
||||
sixthLine = " (Batt=";
|
||||
sixthLine += internalVoltageInfo;
|
||||
sixthLine += ")";
|
||||
beaconPacket += " Batt=";
|
||||
beaconPacket += internalVoltageInfo;
|
||||
secondaryBeaconPacket += " Batt=";
|
||||
secondaryBeaconPacket += internalVoltageInfo;
|
||||
sixthLine = " (Batt=";
|
||||
sixthLine += internalVoltageInfo;
|
||||
sixthLine += ")";
|
||||
}
|
||||
if (Config.battery.monitorInternalVoltage && internalVoltage < Config.battery.internalSleepVoltage) {
|
||||
beaconPacket += " **IntBatWarning:SLEEP**";
|
||||
secondaryBeaconPacket += " **IntBatWarning:SLEEP**";
|
||||
shouldSleepLowVoltage = true;
|
||||
beaconPacket += " **IntBatWarning:SLEEP**";
|
||||
secondaryBeaconPacket += " **IntBatWarning:SLEEP**";
|
||||
shouldSleepLowVoltage = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -157,18 +156,18 @@ namespace Utils {
|
|||
float externalVoltage = BATTERY_Utils::checkExternalVoltage();
|
||||
String externalVoltageInfo = String(externalVoltage,2) + "V";
|
||||
if (Config.battery.sendExternalVoltage) {
|
||||
beaconPacket += " Ext=";
|
||||
beaconPacket += externalVoltageInfo;
|
||||
secondaryBeaconPacket += " Ext=";
|
||||
secondaryBeaconPacket += externalVoltageInfo;
|
||||
sixthLine = " (Ext V=";
|
||||
sixthLine += externalVoltageInfo;
|
||||
sixthLine += ")";
|
||||
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**";
|
||||
secondaryBeaconPacket += " **ExtBatWarning:SLEEP**";
|
||||
shouldSleepLowVoltage = true;
|
||||
beaconPacket += " **ExtBatWarning:SLEEP**";
|
||||
secondaryBeaconPacket += " **ExtBatWarning:SLEEP**";
|
||||
shouldSleepLowVoltage = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue