From 54f326db2bc181518ff151f41ebbbdaf06072c6f Mon Sep 17 00:00:00 2001 From: richonguzman Date: Tue, 30 May 2023 17:25:35 -0400 Subject: [PATCH] comment fix and altitude --- data/tracker_config.json | 6 ++--- src/LoRa_APRS_Tracker.cpp | 53 ++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/data/tracker_config.json b/data/tracker_config.json index 2ae7c26..917e28a 100644 --- a/data/tracker_config.json +++ b/data/tracker_config.json @@ -3,7 +3,7 @@ { "callsign": "NOCALL-7", "symbol": "[", - "comment": "github.com/richonguzman/LoRa_APRS_Tracker", + "comment": "https://github.com/richonguzman/LoRa_APRS_Tracker", "smart_beacon": { "active": true, "slowRate": 120, @@ -22,7 +22,7 @@ { "callsign": "NOCALL-8", "symbol": "b", - "comment": "github.com/richonguzman/LoRa_APRS_Tracker", + "comment": "https://github.com/richonguzman/LoRa_APRS_Tracker", "smart_beacon": { "active": true, "slowRate": 120, @@ -42,7 +42,7 @@ { "callsign": "NOCALL-9", "symbol": ">", - "comment": "github.com/richonguzman/LoRa_APRS_Tracker", + "comment": "https://github.com/richonguzman/LoRa_APRS_Tracker", "smart_beacon": { "active": true, "slowRate": 120, diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index 3ef90ce..1bc7208 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -905,6 +905,10 @@ void loop() { infoField += "\x47"; } + if (currentBeacon->comment != "") { + infoField += currentBeacon->comment; + } + msg.getBody()->setData(infoField); String data = msg.encode(); logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "Loop", "%s", data.c_str()); @@ -969,41 +973,26 @@ void loop() { thirdRowMainMenu += " " + String(gps.satellites.value()) + hdopState; } - double infoAMSL = gps.altitude.meters(); - String fourthRowAlt; - if (infoAMSL >= 1000) { - fourthRowAlt = String(infoAMSL,0); - } else if (infoAMSL >= 100 && infoAMSL < 1000) { - fourthRowAlt = "0" + String(infoAMSL,0); - } else if (infoAMSL >= 10 && infoAMSL < 100) { - fourthRowAlt = "00" + String(infoAMSL,0); - } else if (infoAMSL < 10) { - fourthRowAlt = "000" + String(infoAMSL,0); + String fourthRowAlt = String(gps.altitude.meters(),0); + fourthRowAlt.trim(); + for (int a=fourthRowAlt.length();a<4;a++) { + fourthRowAlt = "0" + fourthRowAlt; } - double infoSpeed = gps.speed.kmph(); - String fourthRowSpeed, tempSpeed; - tempSpeed = String(infoSpeed,0); - tempSpeed.trim(); - if (infoSpeed >= 100) { - fourthRowSpeed = tempSpeed; - } else if (infoSpeed >= 10 && infoSpeed < 100) { - fourthRowSpeed = " " + tempSpeed; - } else if (infoSpeed < 10) { - fourthRowSpeed = " " + tempSpeed; + String fourthRowSpeed = String(gps.speed.kmph(),0); + fourthRowSpeed.trim(); + for (int b=fourthRowSpeed.length(); b<3;b++) { + fourthRowSpeed = " " + fourthRowSpeed; } - double infoCourse = gps.course.deg(); - String fourthRowCourse, tempCourse; - tempCourse = String(infoCourse,0); - tempCourse.trim(); - if (infoCourse >= 100) { - fourthRowCourse = tempCourse; - } else if (infoCourse >= 10 && infoCourse < 100) { - fourthRowCourse = "0" + tempCourse; - } else if (infoCourse < 10) { - fourthRowCourse = "00" + tempCourse; + String fourthRowCourse = String(gps.course.deg(),0); + if (fourthRowSpeed == " 0") { + fourthRowCourse = "---"; + } else { + fourthRowCourse.trim(); + for(int c=fourthRowCourse.length();c<3;c++) { + fourthRowCourse = "0" + fourthRowCourse; + } } - - fourthRowMainMenu = "A=" + fourthRowAlt + "m " + fourthRowSpeed + "km/h " + fourthRowCourse; // AMSL = above mean sea level + fourthRowMainMenu = "A=" + fourthRowAlt + "m " + fourthRowSpeed + "km/h " + fourthRowCourse; if (numAPRSMessages > 0){ fourthRowMainMenu = "*** MESSAGES: " + String(numAPRSMessages) + " ***"; }