more string cleaning

This commit is contained in:
richonguzman 2024-05-30 21:08:35 -04:00
parent 95a8796a80
commit 6cd38c8204
8 changed files with 227 additions and 138 deletions

View File

@ -33,10 +33,12 @@ namespace APRSPacketLib {
north_south = "N";
latitude += degrees.substring(0, degrees.indexOf("."));
}
convDeg = abs(degrees.toFloat()) - abs(int(degrees.toFloat()));
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;
}
@ -58,10 +60,12 @@ namespace APRSPacketLib {
east_west = "E";
longitude += degrees.substring(0, degrees.indexOf("."));
}
convDeg = abs(degrees.toFloat()) - abs(int(degrees.toFloat()));
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;
}
@ -71,12 +75,12 @@ namespace APRSPacketLib {
alt_m = 0;
}
uint32_t altoff;
altoff=alt_m + 10000;
buf[0]=(altoff/8281) + 33;
altoff=altoff%8281;
buf[1]=(altoff/91) + 33;
buf[2]=(altoff%91) + 33;
buf[3]='}';
altoff = alt_m + 10000;
buf[0] = (altoff/8281) + 33;
altoff = altoff%8281;
buf[1] = (altoff/91) + 33;
buf[2] = (altoff%91) + 33;
buf[3] = '}';
}
void encodeMiceCourseSpeed(uint8_t *buf, uint32_t speed_kt, uint32_t course_deg) {
@ -98,11 +102,11 @@ namespace APRSPacketLib {
course_deg = 0;
}
uint32_t course_hun = course_deg/100;
DC28 = (speed_kt-ten * 10) * 10 + course_hun + 32;
buf[1] = DC28;
DC28 = (speed_kt-ten * 10) * 10 + course_hun + 32;
buf[1] = DC28;
SE28 = (course_deg - course_hun * 100) + 28;
buf[2] = SE28;
SE28 = (course_deg - course_hun * 100) + 28;
buf[2] = SE28;
}
void encodeMiceLongitude(uint8_t *buf, gpsLongitudeStruct *lon) {
@ -129,8 +133,8 @@ namespace APRSPacketLib {
buf[1] = m28;
uint32_t h28;
h28 = 28 + lon->minuteHundredths;
buf[2] = h28;
h28 = 28 + lon->minuteHundredths;
buf[2] = h28;
}
void encodeMiceDestinationField(const String& msgType, uint8_t *buf, const gpsLatitudeStruct *lat, const gpsLongitudeStruct *lon) {
@ -152,7 +156,7 @@ namespace APRSPacketLib {
}
buf[3] = (lat->minutes - temp * 10 + 0x30) + (lat->north ? 0x20 : 0); // North validation
temp = lat->minuteHundredths/10; // minute hundredths
temp = lat->minuteHundredths/10; // minute hundredths
buf[4] = (temp + 0x30) + ((lon->degrees >= 100 || lon->degrees <= 9) ? 0x20 : 0); // Longitude Offset
buf[5] = (lat->minuteHundredths - temp * 10 + 0x30) + (!lon->east ? 0x20 : 0); // West validation
}
@ -177,10 +181,10 @@ namespace APRSPacketLib {
gpsLongitudeStruct miceLongitudeStruct;
String lng = gpsDecimalToDegreesLongitude(longitude);
char longitudeArray[10];
strncpy(longitudeArray,lng.c_str(),9);
strncpy(longitudeArray,lng.c_str(), 9);
miceLongitudeStruct.degrees = 100 * (longitudeArray[0] - '0') + 10 * (longitudeArray[1] - '0') + longitudeArray[2] - '0';
miceLongitudeStruct.minutes = 10 * (longitudeArray[3] - '0') + longitudeArray[4] - '0';
miceLongitudeStruct.minuteHundredths = 10 * (longitudeArray[6] - '0') + longitudeArray[7] - '0';
miceLongitudeStruct.minutes = 10 * (longitudeArray[3] - '0') + longitudeArray[4] - '0';
miceLongitudeStruct.minuteHundredths = 10 * (longitudeArray[6] - '0') + longitudeArray[7] - '0';
if (longitudeArray[8] == 'E') {
miceLongitudeStruct.east = 1;
} else {
@ -190,8 +194,8 @@ namespace APRSPacketLib {
}
String generateMiceGPSBeacon(const String& miceMsgType, const String& callsign, const String& symbol, const String& overlay, const String& path, float latitude, float longitude, float course, float speed, int altitude) {
gpsLatitudeStruct latitudeStruct = gpsDecimalToDegreesMiceLatitude(latitude);
gpsLongitudeStruct longitudeStruct = gpsDecimalToDegreesMiceLongitude(longitude);
gpsLatitudeStruct latitudeStruct = gpsDecimalToDegreesMiceLatitude(latitude);
gpsLongitudeStruct longitudeStruct = gpsDecimalToDegreesMiceLongitude(longitude);
uint8_t miceDestinationArray[7];
encodeMiceDestinationField(miceMsgType, &miceDestinationArray[0], &latitudeStruct, &longitudeStruct);
@ -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 += ":>";
@ -446,7 +466,7 @@ namespace APRSPacketLib {
}
String decodeMiceSymbol(const String& informationField) {
return informationField.substring(6, 7);
return informationField.substring(6,7);
}
String decodeMiceOverlay(const String& informationField) {
@ -493,11 +513,11 @@ namespace APRSPacketLib {
}
float gpsDegreesToDecimalLatitude(const String& degreesLatitude) {
int degrees = degreesLatitude.substring(0, 2).toInt();
int minute = degreesLatitude.substring(2, 4).toInt();
int minuteHundredths = degreesLatitude.substring(5, 7).toInt();
String northSouth = degreesLatitude.substring(7);
float decimalLatitude = degrees + (minute/60.0) + (minuteHundredths/10000.0);
int degrees = degreesLatitude.substring(0, 2).toInt();
int minute = degreesLatitude.substring(2, 4).toInt();
int minuteHundredths = degreesLatitude.substring(5, 7).toInt();
String northSouth = degreesLatitude.substring(7);
float decimalLatitude = degrees + (minute/60.0) + (minuteHundredths/10000.0);
if (northSouth == "N") {
return decimalLatitude;
} else {
@ -506,11 +526,11 @@ namespace APRSPacketLib {
}
float gpsDegreesToDecimalLongitude(const String& degreesLongitude) {
int degrees = degreesLongitude.substring(0, 3).toInt();
int minute = degreesLongitude.substring(3, 5).toInt();
int minuteHundredths = degreesLongitude.substring(6, 8).toInt();
String westEast = degreesLongitude.substring(8);
float decimalLongitude = degrees + (minute/60.0) + (minuteHundredths/10000.0);
int degrees = degreesLongitude.substring(0, 3).toInt();
int minute = degreesLongitude.substring(3, 5).toInt();
int minuteHundredths = degreesLongitude.substring(6, 8).toInt();
String westEast = degreesLongitude.substring(8);
float decimalLongitude = degrees + (minute/60.0) + (minuteHundredths/10000.0);
if (westEast == "W") {
return -decimalLongitude;
} else {
@ -591,11 +611,11 @@ namespace APRSPacketLib {
aprsPacket.sender = receivedPacket.substring(0, receivedPacket.indexOf(">"));
String temp0 = receivedPacket.substring(receivedPacket.indexOf(">") + 1, receivedPacket.indexOf(":"));
if (temp0.indexOf(",") > 2) {
aprsPacket.tocall = temp0.substring(0, temp0.indexOf(","));
aprsPacket.path = temp0.substring(temp0.indexOf(",") + 1, temp0.indexOf(":"));
aprsPacket.tocall = temp0.substring(0, temp0.indexOf(","));
aprsPacket.path = temp0.substring(temp0.indexOf(",") + 1, temp0.indexOf(":"));
} else {
aprsPacket.tocall = temp0;
aprsPacket.path = "";
aprsPacket.tocall = temp0;
aprsPacket.path = "";
}
if (receivedPacket.indexOf(":!") > 10 || receivedPacket.indexOf(":=") > 10 ) {
aprsPacket.type = 0;

View File

@ -39,45 +39,45 @@ struct gpsLongitudeStruct {
namespace APRSPacketLib {
String doubleToString(double n, int ndec);
String gpsDecimalToDegreesLatitude(double lat);
String gpsDecimalToDegreesLongitude(double lon);
String doubleToString(double n, int ndec);
String gpsDecimalToDegreesLatitude(double lat);
String gpsDecimalToDegreesLongitude(double lon);
void encodeMiceAltitude(uint8_t *buf, uint32_t alt_m);
void encodeMiceCourseSpeed(uint8_t *buf, uint32_t speed_kt, uint32_t course_deg);
void encodeMiceLongitude(uint8_t *buf, gpsLongitudeStruct *lon);
void encodeMiceDestinationField(const String& msgType, uint8_t *buf, const gpsLatitudeStruct *lat, const gpsLongitudeStruct *lon);
void encodeMiceAltitude(uint8_t *buf, uint32_t alt_m);
void encodeMiceCourseSpeed(uint8_t *buf, uint32_t speed_kt, uint32_t course_deg);
void encodeMiceLongitude(uint8_t *buf, gpsLongitudeStruct *lon);
void encodeMiceDestinationField(const String& msgType, uint8_t *buf, const gpsLatitudeStruct *lat, const gpsLongitudeStruct *lon);
gpsLatitudeStruct gpsDecimalToDegreesMiceLatitude(float latitude);
gpsLongitudeStruct gpsDecimalToDegreesMiceLongitude(float longitude);
String generateMiceGPSBeacon(const String& miceMsgType, const String& callsign, const String& symbol, const String& overlay, const String& path, float latitude, float longitude, float course, float speed, int altitude);
String generateMiceGPSBeacon(const String& miceMsgType, const String& callsign, const String& symbol, const String& overlay, const String& path, float latitude, float longitude, float course, float speed, int altitude);
String generateBasePacket(const String& callsign, const String& tocall, const String& path);
String generateStatusPacket(const String& callsign, const String& tocall, const String& path, const String& status);
String generateMessagePacket(const String& callsign, const String& tocall, const String& path, const String& addressee, const String& message);
String generateDigiRepeatedPacket(APRSPacket packet, const String &callsign);
String generateBasePacket(const String& callsign, const String& tocall, const String& path);
String generateStatusPacket(const String& callsign, const String& tocall, const String& path, const String& status);
String generateMessagePacket(const String& callsign, const String& tocall, const String& path, const String& addressee, const String& message);
String generateDigiRepeatedPacket(APRSPacket packet, const String &callsign);
char *ax25_base91enc(char *s, uint8_t n, uint32_t v);
String encodeGPS(float latitude, float longitude, float course, float speed, const String& symbol, bool sendAltitude, int altitude, bool sendStandingUpdate, const String& packetType);
String generateGPSBeaconPacket(const String& callsign, const String& tocall, const String& path, const String& overlay, const String& gpsData);
char *ax25_base91enc(char *s, uint8_t n, uint32_t v);
String encodeGPS(float latitude, float longitude, float course, float speed, const String& symbol, bool sendAltitude, int altitude, bool sendStandingUpdate, const String& packetType);
String generateGPSBeaconPacket(const String& callsign, const String& tocall, const String& path, const String& overlay, const String& gpsData);
float decodeEncodedLatitude(const String& receivedPacket);
float decodeEncodedLongitude(const String& receivedPacket);
float decodeLatitude(const String& receivedPacket);
float decodeLongitude(const String& receivedPacket);
int decodeSpeed(const String& speed);
int decodeAltitude(const String& altitude);
float decodeEncodedLatitude(const String& receivedPacket);
float decodeEncodedLongitude(const String& receivedPacket);
float decodeLatitude(const String& receivedPacket);
float decodeLongitude(const String& receivedPacket);
int decodeSpeed(const String& speed);
int decodeAltitude(const String& altitude);
String decodeMiceMsgType(const String& tocall);
String decodeMiceSymbol(const String& informationField);
String decodeMiceOverlay(const String& informationField);
int decodeMiceSpeed(const String& informationField);
int decodeMiceCourse(const String& informationField);
int decodeMiceAltitude(const String& informationField);
float gpsDegreesToDecimalLatitude(const String& degreesLatitude);
float gpsDegreesToDecimalLongitude(const String& degreesLongitude);
float decodeMiceLatitude(const String& destinationField);
float decodeMiceLongitude(const String& destinationField, const String& informationField);
String decodeMiceMsgType(const String& tocall);
String decodeMiceSymbol(const String& informationField);
String decodeMiceOverlay(const String& informationField);
int decodeMiceSpeed(const String& informationField);
int decodeMiceCourse(const String& informationField);
int decodeMiceAltitude(const String& informationField);
float gpsDegreesToDecimalLatitude(const String& degreesLatitude);
float gpsDegreesToDecimalLongitude(const String& degreesLongitude);
float decodeMiceLatitude(const String& destinationField);
float decodeMiceLongitude(const String& destinationField, const String& informationField);
APRSPacket processReceivedPacket(const String& receivedPacket, int rssi, float snr, int freqError);

View File

@ -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;
}
@ -32,17 +33,17 @@ namespace AX25_Utils {
payloadFrameStart = i+1;
}
}
decodedFrame->tocall = frame.substring(2, 9); // Extract destination address
decodedFrame->sender = frame.substring(9, 16); // Extract source address
decodedFrame->tocall = frame.substring(2, 9); // Extract destination address
decodedFrame->sender = frame.substring(9, 16); // Extract source address
if (payloadFrameStart >= 21) { // is there path1?
decodedFrame->path1 = frame.substring(16, 23);
}
if (payloadFrameStart >= 28) { // is there path2?
decodedFrame->path2 = frame.substring(23, 30);
}
decodedFrame->control = frame.substring(payloadFrameStart-1, payloadFrameStart); // Extract control information // 0x03
decodedFrame->pid = frame.substring(payloadFrameStart, payloadFrameStart + 1); // Extract pid information // 0xF0
decodedFrame->payload = frame.substring(payloadFrameStart + 1, frameSize - 1); // Extract payload
decodedFrame->control = frame.substring(payloadFrameStart-1, payloadFrameStart); // Extract control information // 0x03
decodedFrame->pid = frame.substring(payloadFrameStart, payloadFrameStart + 1); // Extract pid information // 0xF0
decodedFrame->payload = frame.substring(payloadFrameStart + 1, frameSize - 1); // Extract payload
return true;
}
@ -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;
@ -118,19 +121,19 @@ namespace AX25_Utils {
}
String LoRaPacketToAX25Frame(const String& packet) {
String encodedPacket = "";
String tocall = "";
String sender = packet.substring(0, packet.indexOf(">"));
bool lastAddress = false;
String payload = packet.substring(packet.indexOf(":") + 1);
String temp = packet.substring(packet.indexOf(">") + 1, packet.indexOf(":"));
String encodedPacket = "";
String tocall = "";
String sender = packet.substring(0, packet.indexOf(">"));
bool lastAddress = false;
String payload = packet.substring(packet.indexOf(":") + 1);
String temp = packet.substring(packet.indexOf(">") + 1, packet.indexOf(":"));
if (temp.indexOf(",")>0) {
tocall = temp.substring(0, temp.indexOf(","));
temp = temp.substring(temp.indexOf(",") + 1);
tocall = temp.substring(0, temp.indexOf(","));
temp = temp.substring(temp.indexOf(",") + 1);
} else {
tocall = temp;
temp = "";
tocall = temp;
temp = "";
lastAddress = true;
}
encodedPacket = encodeAX25Address(tocall, 1, false);
@ -140,11 +143,11 @@ namespace AX25_Utils {
int repeatedPath = 0;
String address = "";
if (temp.indexOf(",") > 0) {
address = temp.substring(0, temp.indexOf(","));
temp = temp.substring(temp.indexOf(",") + 1);
address = temp.substring(0, temp.indexOf(","));
temp = temp.substring(temp.indexOf(",") + 1);
} else {
address = temp;
temp = "";
address = temp;
temp = "";
lastAddress = true;
}
if (address.indexOf("*") > 0) {

View File

@ -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;

View File

@ -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);
}

View File

@ -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 = BME_Utils::readDataSensor(1);
} else {
fourthRowMainMenu = "A=" + fourthRowAlt + "m " + fourthRowSpeed + "km/h " + fourthRowCourse;
}
}
} else {
fourthRowMainMenu = "A=" + fourthRowAlt + "m " + fourthRowSpeed + "km/h " + fourthRowCourse;
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);
}
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 {

View File

@ -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();

View File

@ -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 != "") {