more string cleaning
This commit is contained in:
parent
95a8796a80
commit
6cd38c8204
|
|
@ -36,7 +36,9 @@ namespace APRSPacketLib {
|
|||
convDeg = abs(degrees.toFloat()) - abs(int(degrees.toFloat()));
|
||||
convDeg2 = (convDeg * 60)/100;
|
||||
convDeg3 = String(convDeg2,6);
|
||||
latitude += convDeg3.substring(convDeg3.indexOf(".") + 1, convDeg3.indexOf(".") + 3) + "." + convDeg3.substring(convDeg3.indexOf(".") + 3, convDeg3.indexOf(".") + 5);
|
||||
latitude += convDeg3.substring(convDeg3.indexOf(".") + 1, convDeg3.indexOf(".") + 3);
|
||||
latitude += ".";
|
||||
latitude += convDeg3.substring(convDeg3.indexOf(".") + 3, convDeg3.indexOf(".") + 5);
|
||||
latitude += north_south;
|
||||
return latitude;
|
||||
}
|
||||
|
|
@ -61,7 +63,9 @@ namespace APRSPacketLib {
|
|||
convDeg = abs(degrees.toFloat()) - abs(int(degrees.toFloat()));
|
||||
convDeg2 = (convDeg * 60)/100;
|
||||
convDeg3 = String(convDeg2,6);
|
||||
longitude += convDeg3.substring(convDeg3.indexOf(".") + 1, convDeg3.indexOf(".") + 3) + "." + convDeg3.substring(convDeg3.indexOf(".") + 3, convDeg3.indexOf(".") + 5);
|
||||
longitude += convDeg3.substring(convDeg3.indexOf(".") + 1, convDeg3.indexOf(".") + 3);
|
||||
longitude += ".";
|
||||
longitude += convDeg3.substring(convDeg3.indexOf(".") + 3, convDeg3.indexOf(".") + 5);
|
||||
longitude += east_west;
|
||||
return longitude;
|
||||
}
|
||||
|
|
@ -213,18 +217,25 @@ namespace APRSPacketLib {
|
|||
miceInfoFieldArray[13] = 0x00; // por repetidor?
|
||||
String miceInformationField = (char*)miceInfoFieldArray;
|
||||
|
||||
String miceAPRSPacket = callsign + ">" + miceDestination;
|
||||
String miceAPRSPacket = callsign;
|
||||
miceAPRSPacket += ">";
|
||||
miceAPRSPacket += miceDestination;
|
||||
if (path != "") {
|
||||
miceAPRSPacket += "," + path;
|
||||
miceAPRSPacket += ",";
|
||||
miceAPRSPacket += path;
|
||||
}
|
||||
miceAPRSPacket += ":" + miceInformationField;
|
||||
miceAPRSPacket += ":";
|
||||
miceAPRSPacket += miceInformationField;
|
||||
return miceAPRSPacket;
|
||||
}
|
||||
|
||||
String generateBasePacket(const String& callsign, const String& tocall, const String& path) {
|
||||
String packet = callsign + ">" + tocall;
|
||||
String packet = callsign;
|
||||
packet += ">";
|
||||
packet += tocall;
|
||||
if (path != "") {
|
||||
packet += "," + path;
|
||||
packet += ",";
|
||||
packet += path;
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
|
|
@ -245,6 +256,7 @@ namespace APRSPacketLib {
|
|||
|
||||
String generateDigiRepeatedPacket(APRSPacket packet, const String& callsign) {
|
||||
if (packet.path.indexOf("WIDE1-") >= 0) {
|
||||
|
||||
String hop = packet.path.substring(packet.path.indexOf("WIDE1-") + 6, packet.path.indexOf("WIDE1-") + 7);
|
||||
if (hop.toInt() >= 1 && hop.toInt() <= 7) {
|
||||
if (hop.toInt() == 1) {
|
||||
|
|
@ -252,7 +264,13 @@ namespace APRSPacketLib {
|
|||
} else {
|
||||
packet.path.replace("WIDE1-" + hop , callsign + "*,WIDE1-" + String(hop.toInt() - 1));
|
||||
}
|
||||
String repeatedPacket = packet.sender + ">" + packet.tocall + "," + packet.path;
|
||||
|
||||
String repeatedPacket = packet.sender;
|
||||
repeatedPacket += ">";
|
||||
repeatedPacket += packet.tocall;
|
||||
repeatedPacket += ",";
|
||||
repeatedPacket += packet.path;
|
||||
|
||||
switch (packet.type) {
|
||||
case 0: // gps
|
||||
repeatedPacket += ":!";
|
||||
|
|
@ -261,7 +279,9 @@ namespace APRSPacketLib {
|
|||
for(int i = packet.addressee.length(); i < 9; i++) {
|
||||
packet.addressee += ' ';
|
||||
}
|
||||
repeatedPacket += "::" + packet.addressee + ":";
|
||||
repeatedPacket += "::";
|
||||
repeatedPacket += packet.addressee;
|
||||
repeatedPacket += ":";
|
||||
break;
|
||||
case 2: // status
|
||||
repeatedPacket += ":>";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ namespace AX25_Utils {
|
|||
}
|
||||
byte ssid = (frame[6]>>1) & 0x0f;
|
||||
if (String(ssid) != "0") {
|
||||
packet += "-" + String(ssid);
|
||||
packet += "-";
|
||||
packet += String(ssid);
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
|
|
@ -53,10 +54,12 @@ namespace AX25_Utils {
|
|||
packetToLoRa = decodeFrame(decodedFrame.sender) + ">" + decodeFrame(decodedFrame.tocall);
|
||||
|
||||
if (decodedFrame.path1[0] != 0) {
|
||||
packetToLoRa += "," + decodeFrame(decodedFrame.path1);
|
||||
packetToLoRa += ",";
|
||||
packetToLoRa += decodeFrame(decodedFrame.path1);
|
||||
}
|
||||
if (decodedFrame.path2[0] != 0) {
|
||||
packetToLoRa += "," + decodeFrame(decodedFrame.path2);
|
||||
packetToLoRa += ",";
|
||||
packetToLoRa += decodeFrame(decodedFrame.path2);
|
||||
}
|
||||
packetToLoRa += ":";
|
||||
packetToLoRa += decodedFrame.payload;
|
||||
|
|
|
|||
|
|
@ -268,14 +268,30 @@ namespace BME_Utils {
|
|||
presStr = generatePresString(newPress + (Config.bme.heightCorrection/CORRECTION_FACTOR), type);
|
||||
if (type == 1) {
|
||||
if (wxModuleType == 1 || wxModuleType == 3) {
|
||||
wx = tempStr + "C " + humStr + "% " + presStr + "hPa";
|
||||
wx = tempStr;
|
||||
wx += "C ";
|
||||
wx += humStr;
|
||||
wx += "% ";
|
||||
wx += presStr;
|
||||
wx += "hPa";
|
||||
} else if (wxModuleType == 2) {
|
||||
wx = "T: " + tempStr + "C " + "P: " + presStr + "hPa";
|
||||
wx = "T: ";
|
||||
wx += tempStr;
|
||||
wx += "C P: ";
|
||||
wx += presStr;
|
||||
wx += "hPa";
|
||||
}
|
||||
} else {
|
||||
wx = ".../...g...t" + tempStr + "r...p...P...h" + humStr + "b" + presStr;
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,15 @@ namespace LoRa_Utils {
|
|||
case 1: loraCountryFreq = "POLAND"; break;
|
||||
case 2: loraCountryFreq = "UK"; break;
|
||||
}
|
||||
String currentLoRainfo = "LoRa " + loraCountryFreq + " / Freq: " + String(currentLoRaType->frequency) + " / SF:" + String(currentLoRaType->spreadingFactor) + " / CR: " + String(currentLoRaType->codingRate4);
|
||||
String currentLoRainfo = "LoRa ";
|
||||
currentLoRainfo += loraCountryFreq;
|
||||
currentLoRainfo += " / Freq: ";
|
||||
currentLoRainfo += String(currentLoRaType->frequency);
|
||||
currentLoRainfo += " / SF:";
|
||||
currentLoRainfo += String(currentLoRaType->spreadingFactor);
|
||||
currentLoRainfo += " / CR: ";
|
||||
currentLoRainfo += String(currentLoRaType->codingRate4);
|
||||
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "LoRa", currentLoRainfo.c_str());
|
||||
show_display("LORA FREQ>", "", "CHANGED TO: " + loraCountryFreq, "", "", "", 2000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,10 +314,11 @@ namespace MENU_Utils {
|
|||
double courseTo = TinyGPSPlus::courseTo(gps.location.lat(), gps.location.lng(), lastReceivedPacket.latitude, lastReceivedPacket.longitude);
|
||||
|
||||
if (lastReceivedPacket.path.length()>14) {
|
||||
pathDec = "P:" + lastReceivedPacket.path;
|
||||
pathDec = "P:";
|
||||
} else {
|
||||
pathDec = "PATH: " +lastReceivedPacket.path;
|
||||
pathDec = "PATH: ";
|
||||
}
|
||||
pathDec += lastReceivedPacket.path;
|
||||
|
||||
show_display(firstLineDecoder, "GPS " + String(lastReceivedPacket.latitude,2) + " " + String(lastReceivedPacket.longitude,2), courseSpeedAltitude, "D:" + String(distanceKm) + "km " + String(courseTo,0), pathDec, "< RSSI:" + String(lastReceivedPacket.rssi) + " SNR:" + String(lastReceivedPacket.snr));
|
||||
} else if (lastReceivedPacket.type==1) { // message
|
||||
|
|
@ -525,7 +526,9 @@ namespace MENU_Utils {
|
|||
const auto time_now = now();
|
||||
secondRowMainMenu = Utils::createDateString(time_now) + " " + Utils::createTimeString(time_now);
|
||||
if (time_now % 10 < 5) {
|
||||
thirdRowMainMenu = String(gps.location.lat(), 4) + " " + String(gps.location.lng(), 4);
|
||||
thirdRowMainMenu = String(gps.location.lat(), 4);
|
||||
thirdRowMainMenu += " ";
|
||||
thirdRowMainMenu += String(gps.location.lng(), 4);
|
||||
} else {
|
||||
thirdRowMainMenu = String(Utils::getMaidenheadLocator(gps.location.lat(), gps.location.lng(), 8));
|
||||
thirdRowMainMenu += " LoRa[";
|
||||
|
|
@ -548,11 +551,9 @@ namespace MENU_Utils {
|
|||
hdopState = "+";
|
||||
}
|
||||
|
||||
if (gps.satellites.value() > 9) {
|
||||
thirdRowMainMenu += String(gps.satellites.value()) + hdopState;
|
||||
} else {
|
||||
thirdRowMainMenu += " " + String(gps.satellites.value()) + hdopState;
|
||||
}
|
||||
if (gps.satellites.value() <= 9) thirdRowMainMenu += " ";
|
||||
thirdRowMainMenu += String(gps.satellites.value());
|
||||
thirdRowMainMenu += hdopState;
|
||||
|
||||
String fourthRowAlt = String(gps.altitude.meters(),0);
|
||||
fourthRowAlt.trim();
|
||||
|
|
@ -573,43 +574,54 @@ namespace MENU_Utils {
|
|||
fourthRowCourse = "0" + fourthRowCourse;
|
||||
}
|
||||
}
|
||||
if (Config.bme.active) {
|
||||
if (time_now % 10 < 5) {
|
||||
fourthRowMainMenu = "A=" + fourthRowAlt + "m " + fourthRowSpeed + "km/h " + fourthRowCourse;
|
||||
} else {
|
||||
if (wxModuleType != 0) {
|
||||
fourthRowMainMenu = "A=";
|
||||
fourthRowMainMenu += fourthRowAlt;
|
||||
fourthRowMainMenu += "m ";
|
||||
fourthRowMainMenu += fourthRowSpeed;
|
||||
fourthRowMainMenu += "km/h ";
|
||||
fourthRowMainMenu += fourthRowCourse;
|
||||
if (Config.bme.active && (time_now % 10 < 5) && wxModuleType != 0) {
|
||||
fourthRowMainMenu = BME_Utils::readDataSensor(1);
|
||||
} else {
|
||||
fourthRowMainMenu = "A=" + fourthRowAlt + "m " + fourthRowSpeed + "km/h " + fourthRowCourse;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fourthRowMainMenu = "A=" + fourthRowAlt + "m " + fourthRowSpeed + "km/h " + fourthRowCourse;
|
||||
}
|
||||
if (MSG_Utils::getNumWLNKMails() > 0) {
|
||||
fourthRowMainMenu = "** WLNK MAIL: " + String(MSG_Utils::getNumWLNKMails()) + " **";
|
||||
fourthRowMainMenu = "** WLNK MAIL: ";
|
||||
fourthRowMainMenu += String(MSG_Utils::getNumWLNKMails());
|
||||
fourthRowMainMenu += " **";
|
||||
}
|
||||
if (MSG_Utils::getNumAPRSMessages() > 0) {
|
||||
fourthRowMainMenu = "*** MESSAGES: " + String(MSG_Utils::getNumAPRSMessages()) + " ***";
|
||||
fourthRowMainMenu = "*** MESSAGES: ";
|
||||
fourthRowMainMenu += String(MSG_Utils::getNumAPRSMessages());
|
||||
fourthRowMainMenu += " ***";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
fifthRowMainMenu = "LAST Rx = " + MSG_Utils::getLastHeardTracker();
|
||||
fifthRowMainMenu = "LAST Rx = ";
|
||||
fifthRowMainMenu += MSG_Utils::getLastHeardTracker();
|
||||
|
||||
if (POWER_Utils::getBatteryInfoIsConnected()) {
|
||||
String batteryVoltage = POWER_Utils::getBatteryInfoVoltage();
|
||||
String batteryCharge = POWER_Utils::getBatteryInfoCurrent();
|
||||
#if defined(TTGO_T_Beam_V0_7) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS)
|
||||
sixthRowMainMenu = "Bat: " + batteryVoltage + "V";
|
||||
sixthRowMainMenu = "Bat: ";
|
||||
sixthRowMainMenu += batteryVoltage;
|
||||
sixthRowMainMenu += "V";
|
||||
#endif
|
||||
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
||||
if (batteryCharge.toInt() == 0) {
|
||||
sixthRowMainMenu = "Battery Charged " + batteryVoltage + "V";
|
||||
sixthRowMainMenu = "Battery Charged ";
|
||||
sixthRowMainMenu += batteryVoltage;
|
||||
sixthRowMainMenu += "V";
|
||||
} else if (batteryCharge.toInt() > 0) {
|
||||
sixthRowMainMenu = "Bat: " + batteryVoltage + "V (charging)";
|
||||
sixthRowMainMenu = "Bat: ";
|
||||
sixthRowMainMenu += batteryVoltage;
|
||||
sixthRowMainMenu += "V (charging)";
|
||||
} else {
|
||||
sixthRowMainMenu = "Battery " + batteryVoltage + "V " + batteryCharge + "mA";
|
||||
sixthRowMainMenu = "Battery ";
|
||||
sixthRowMainMenu += batteryVoltage;
|
||||
sixthRowMainMenu += "V ";
|
||||
sixthRowMainMenu += batteryCharge;
|
||||
sixthRowMainMenu += "mA";
|
||||
}
|
||||
#endif
|
||||
#if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_S3_SUPREME_V3)
|
||||
|
|
@ -625,11 +637,19 @@ namespace MENU_Utils {
|
|||
}
|
||||
batteryVoltage = batteryVoltage.toFloat()/1000;
|
||||
if (POWER_Utils::isCharging() && batteryCharge!="100") {
|
||||
sixthRowMainMenu = "Bat: " + String(batteryVoltage) + "V (charging)";
|
||||
sixthRowMainMenu = "Bat: ";
|
||||
sixthRowMainMenu += String(batteryVoltage);
|
||||
sixthRowMainMenu += "V (charging)";
|
||||
} else if (!POWER_Utils::isCharging() && batteryCharge=="100") {
|
||||
sixthRowMainMenu = "Battery Charged " + String(batteryVoltage) + "V";
|
||||
sixthRowMainMenu = "Battery Charged ";
|
||||
sixthRowMainMenu += String(batteryVoltage);
|
||||
sixthRowMainMenu += "V";
|
||||
} else {
|
||||
sixthRowMainMenu = "Battery " + String(batteryVoltage) + "V " + batteryCharge + "%";
|
||||
sixthRowMainMenu = "Battery ";
|
||||
sixthRowMainMenu += String(batteryVoltage);
|
||||
sixthRowMainMenu += "V ";
|
||||
sixthRowMainMenu += batteryCharge;
|
||||
sixthRowMainMenu += "%";
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -432,7 +432,8 @@ namespace MSG_Utils {
|
|||
}
|
||||
}
|
||||
if (lastReceivedPacket.message.indexOf("{") >= 0) {
|
||||
String ackMessage = "ack" + lastReceivedPacket.message.substring(lastReceivedPacket.message.indexOf("{") + 1);
|
||||
String ackMessage = "ack";
|
||||
ackMessage += lastReceivedPacket.message.substring(lastReceivedPacket.message.indexOf("{") + 1);
|
||||
ackMessage.trim();
|
||||
MSG_Utils::addToOutputBuffer(0, lastReceivedPacket.sender, ackMessage);
|
||||
lastMsgRxTime = millis();
|
||||
|
|
@ -464,8 +465,19 @@ namespace MSG_Utils {
|
|||
String windCleaning = humCleaning.substring(humCleaning.indexOf(",")+1);
|
||||
String windDegrees = windCleaning.substring(windCleaning.indexOf(",")+1,windCleaning.indexOf("\n"));
|
||||
|
||||
String fifthLineWR = temperature + "C " + pressure + "hPa " + humidity +"%";
|
||||
String sixthLineWR = "(wind " + windSpeed + "m/s " + windDegrees + "deg)";
|
||||
String fifthLineWR = temperature;
|
||||
fifthLineWR += "C ";
|
||||
fifthLineWR += pressure;
|
||||
fifthLineWR += "hPa ";
|
||||
fifthLineWR += humidity;
|
||||
fifthLineWR += "%";
|
||||
|
||||
String sixthLineWR = "(wind ";
|
||||
sixthLineWR += windSpeed;
|
||||
sixthLineWR += "m/s ";
|
||||
sixthLineWR += windDegrees;
|
||||
sixthLineWR += "deg)";
|
||||
|
||||
show_display("<WEATHER>", "From --> " + lastReceivedPacket.sender, place, summary, fifthLineWR, sixthLineWR);
|
||||
menuDisplay = 40;
|
||||
menuTime = millis();
|
||||
|
|
|
|||
|
|
@ -420,13 +420,23 @@ namespace STATION_Utils {
|
|||
String batteryVoltage = POWER_Utils::getBatteryInfoVoltage();
|
||||
String batteryChargeCurrent = POWER_Utils::getBatteryInfoCurrent();
|
||||
#if defined(TTGO_T_Beam_V1_0) || defined(TTGO_T_Beam_V1_0_SX1268)
|
||||
comment += " Bat=" + batteryVoltage + "V (" + batteryChargeCurrent + "mA)";
|
||||
comment += " Bat=";
|
||||
comment += batteryVoltage;
|
||||
comment += "V (";
|
||||
comment += batteryChargeCurrent;
|
||||
comment += "mA)";
|
||||
#endif
|
||||
#if defined(TTGO_T_Beam_V1_2) || defined(TTGO_T_Beam_V1_2_SX1262) || defined(TTGO_T_Beam_S3_SUPREME_V3)
|
||||
comment += " Bat=" + String(batteryVoltage.toFloat()/1000,2) + "V (" + batteryChargeCurrent + "%)";
|
||||
comment += " Bat=";
|
||||
comment += String(batteryVoltage.toFloat()/1000,2);
|
||||
comment += "V (";
|
||||
comment += batteryChargeCurrent;
|
||||
cooment += "%)";
|
||||
#endif
|
||||
#if defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER)
|
||||
comment += " Bat=" + String(batteryVoltage.toFloat(),2) + "V";
|
||||
comment += " Bat=";
|
||||
comment += String(batteryVoltage.toFloat(),2);
|
||||
comment += "V";
|
||||
#endif
|
||||
}
|
||||
if (comment != "") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue