Comment added in Menu as 6Extras

This commit is contained in:
richonguzman 2024-02-16 14:38:21 -03:00
parent e0caff64c1
commit 3fbdacf6b2
2 changed files with 54 additions and 10 deletions

View File

@ -1,6 +1,8 @@
#include <TinyGPS++.h>
#include <logger.h> #include <logger.h>
#include <Wire.h> #include <Wire.h>
#include "keyboard_utils.h" #include "keyboard_utils.h"
#include "APRSPacketLib.h"
#include "winlink_utils.h" #include "winlink_utils.h"
#include "station_utils.h" #include "station_utils.h"
#include "configuration.h" #include "configuration.h"
@ -12,6 +14,8 @@
#define CARDKB_ADDR 0x5F // CARDKB from m5stack.com #define CARDKB_ADDR 0x5F // CARDKB from m5stack.com
extern Configuration Config; extern Configuration Config;
extern Beacon *currentBeacon;
extern TinyGPSPlus gps;
extern logging::Logger logger; extern logging::Logger logger;
extern bool sendUpdate; extern bool sendUpdate;
extern int menuDisplay; extern int menuDisplay;
@ -31,6 +35,7 @@ extern int messagesIterator;
extern bool messageLed; extern bool messageLed;
extern String messageCallsign; extern String messageCallsign;
extern String messageText; extern String messageText;
extern bool sendStandingUpdate;
extern bool flashlight; extern bool flashlight;
extern bool digirepeaterActive; extern bool digirepeaterActive;
extern bool sosActive; extern bool sosActive;
@ -113,10 +118,10 @@ namespace KEYBOARD_Utils {
} }
} }
else if (menuDisplay >= 60 && menuDisplay <= 62) { else if (menuDisplay >= 60 && menuDisplay <= 63) {
menuDisplay--; menuDisplay--;
if (menuDisplay < 60) { if (menuDisplay < 60) {
menuDisplay = 62; menuDisplay = 63;
} }
} }
} }
@ -232,9 +237,9 @@ namespace KEYBOARD_Utils {
} }
} }
else if (menuDisplay >= 60 && menuDisplay <= 62) { else if (menuDisplay >= 60 && menuDisplay <= 63) {
menuDisplay++; menuDisplay++;
if (menuDisplay > 62) { if (menuDisplay > 63) {
menuDisplay = 60; menuDisplay = 60;
} }
} }
@ -255,7 +260,7 @@ namespace KEYBOARD_Utils {
} else if (menuDisplay == 1300 || menuDisplay == 1310) { } else if (menuDisplay == 1300 || menuDisplay == 1310) {
messageText = ""; messageText = "";
menuDisplay = menuDisplay/10; menuDisplay = menuDisplay/10;
} else if ((menuDisplay>=10 && menuDisplay<=13) || (menuDisplay>=20 && menuDisplay<=29) || (menuDisplay == 120) || (menuDisplay>=130 && menuDisplay<=133) || (menuDisplay>=50 && menuDisplay<=52) || (menuDisplay>=200 && menuDisplay<=290) || (menuDisplay>=60 && menuDisplay<=62) || (menuDisplay>=30 && menuDisplay<=31) || (menuDisplay>=300 && menuDisplay<=310) || (menuDisplay == 40)) { } else if ((menuDisplay>=10 && menuDisplay<=13) || (menuDisplay>=20 && menuDisplay<=29) || (menuDisplay == 120) || (menuDisplay>=130 && menuDisplay<=133) || (menuDisplay>=50 && menuDisplay<=52) || (menuDisplay>=200 && menuDisplay<=290) || (menuDisplay>=60 && menuDisplay<=63) || (menuDisplay>=30 && menuDisplay<=31) || (menuDisplay>=300 && menuDisplay<=310) || (menuDisplay == 40)) {
menuDisplay = int(menuDisplay/10); menuDisplay = int(menuDisplay/10);
} else if (menuDisplay == 5000 || menuDisplay == 5010 || menuDisplay == 5020 || menuDisplay == 5030 || menuDisplay == 5040 || menuDisplay == 5050 || menuDisplay == 5060 || menuDisplay == 5070 || menuDisplay == 5080) { } else if (menuDisplay == 5000 || menuDisplay == 5010 || menuDisplay == 5020 || menuDisplay == 5030 || menuDisplay == 5040 || menuDisplay == 5050 || menuDisplay == 5060 || menuDisplay == 5070 || menuDisplay == 5080) {
menuDisplay = 5; menuDisplay = 5;
@ -279,6 +284,9 @@ namespace KEYBOARD_Utils {
} else { } else {
menuDisplay = 50110; menuDisplay = 50110;
} }
} else if (menuDisplay == 630) {
messageText = "";
menuDisplay = 63;
} }
} }
@ -464,7 +472,9 @@ namespace KEYBOARD_Utils {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode ON"); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode ON");
sosActive = true; sosActive = true;
} }
} } else if (menuDisplay == 63) {
menuDisplay = 630;
}
} }
void processPressedKey(char key) { void processPressedKey(char key) {
@ -512,7 +522,7 @@ namespace KEYBOARD_Utils {
} }
if (key >= 32 && key <= 126) { if (key >= 32 && key <= 126) {
messageText += key; messageText += key;
} else if (key == 13) { // Return Pressed: SENDING MESSAGE } else if (key == 13 && messageText.length() > 0) { // Return Pressed: SENDING MESSAGE
messageText.trim(); messageText.trim();
if (messageText.length() > 67){ if (messageText.length() > 67){
messageText = messageText.substring(0,67); messageText = messageText.substring(0,67);
@ -685,6 +695,26 @@ namespace KEYBOARD_Utils {
} else if (key == 180) { } else if (key == 180) {
winlinkBody = ""; winlinkBody = "";
} }
} else if (menuDisplay == 630 && key != 180) {
if (messageText.length() == 1) {
messageText.trim();
}
if (key >= 32 && key <= 126) {
messageText += key;
} else if (key == 13 && messageText.length() > 0) {
messageText.trim();
if (messageText.length() > 67){
messageText = messageText.substring(0,67);
}
String packet = APRSPacketLib::generateGPSBeaconPacket(currentBeacon->callsign, "APLRT1", Config.path, currentBeacon->overlay, APRSPacketLib::encondeGPS(gps.location.lat(),gps.location.lng(), gps.course.deg(), gps.speed.knots(), currentBeacon->symbol, Config.sendAltitude, gps.altitude.feet(), sendStandingUpdate, "GPS"));
packet += messageText;
show_display("<<< TX >>>", "", packet,100);
LoRa_Utils::sendNewPacket(packet);
messageText = "";
menuDisplay = 63;
} else if (key == 8) {
messageText = messageText.substring(0, messageText.length()-1);
}
} }
else if (key == 181) { // Arrow Up else if (key == 181) { // Arrow Up

View File

@ -445,13 +445,27 @@ namespace MENU_Utils {
////////// //////////
case 60: // 6. Extras ---> Flashlight case 60: // 6. Extras ---> Flashlight
show_display("__EXTRAS__", "> Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine); show_display("__EXTRAS__", "> Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")"," Send GPS + Comment",lastLine);
break; break;
case 61: // 6. Extras ---> Digirepeater case 61: // 6. Extras ---> Digirepeater
show_display("__EXTRAS__", " Flashlight (" + checkProcessActive(flashlight) + ")", "> DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine); show_display("__EXTRAS__", " Flashlight (" + checkProcessActive(flashlight) + ")", "> DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")"," Send GPS + Comment",lastLine);
break; break;
case 62: // 6. Extras ---> S.O.S. case 62: // 6. Extras ---> S.O.S.
show_display("__EXTRAS__", " Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", "> S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine); show_display("__EXTRAS__", " Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", "> S.O.S. (" + checkProcessActive(sosActive) + ")"," Send GPS + Comment",lastLine);
break;
case 63: // 6. Extras ---> Extra Comment.
show_display("__EXTRAS__", " Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","> Send GPS + Comment",lastLine);
break;
case 630:
if (messageText.length() <= 67) {
if (messageText.length() < 10) {
show_display("_COMMENT_>", "Send this Comment in","the next GPS Beacon :", messageText, "", "<Back (0" + String(messageText.length()) + ") Enter>");
} else {
show_display("_COMMENT_>", "Send this Comment in","the next GPS Beacon :", messageText, "", "<Back (" + String(messageText.length()) + ") Enter>");
}
} else {
show_display("_COMMENT_>", " Comment is to long! ", " -> " + messageText, "", "", "<Back (" + String(messageText.length()) + ")");
}
break; break;
////////// //////////