menu update

This commit is contained in:
richonguzman 2023-11-11 12:17:09 -03:00
parent def2345b70
commit b4ee49c731
5 changed files with 72 additions and 36 deletions

View File

@ -33,7 +33,7 @@ TinyGPSPlus gps;
BluetoothSerial SerialBT;
OneButton userButton = OneButton(BUTTON_PIN, true, true);
String versionDate = "2023.11.07";
String versionDate = "2023.11.11";
int myBeaconsIndex = 0;
int myBeaconsSize = Config.beacons.size();
@ -55,6 +55,7 @@ bool sendStandingUpdate = false;
bool statusState = true;
uint32_t statusTime = millis();
bool bluetoothConnected = false;
bool bluetoothActive = Config.bluetooth;
bool messageLed = false;
uint32_t messageLedTime = millis();

View File

@ -13,6 +13,7 @@ extern BluetoothSerial SerialBT;
extern logging::Logger logger;
extern TinyGPSPlus gps;
extern bool bluetoothConnected;
extern bool bluetoothActive;
namespace BLUETOOTH_Utils {
String serialReceived;
@ -20,7 +21,7 @@ namespace BLUETOOTH_Utils {
bool useKiss = false;
void setup() {
if (!Config.bluetooth) {
if (!bluetoothActive) {
btStop();
esp_bt_controller_disable();
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "BT controller disabled");
@ -136,7 +137,7 @@ namespace BLUETOOTH_Utils {
}
void sendPacket(const String& packet) {
if (Config.bluetooth && !packet.isEmpty()) {
if (bluetoothActive && !packet.isEmpty()) {
if (useKiss) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BT RX Kiss", "%s", serialReceived.c_str());

View File

@ -47,10 +47,10 @@ namespace KEYBOARD_Utils {
if (menuDisplay < 10) {
menuDisplay = 12;
}
} else if (menuDisplay >= 20 && menuDisplay <= 25) {
} else if (menuDisplay >= 20 && menuDisplay <= 26) {
menuDisplay--;
if (menuDisplay < 20) {
menuDisplay = 25;
menuDisplay = 26;
}
} else if (menuDisplay >= 210 && menuDisplay <= 211) {
menuDisplay--;
@ -106,9 +106,9 @@ namespace KEYBOARD_Utils {
menuDisplay = 11;
}
else if (menuDisplay >= 20 && menuDisplay <= 25) {
else if (menuDisplay >= 20 && menuDisplay <= 26) {
menuDisplay++;
if (menuDisplay > 25) {
if (menuDisplay > 26) {
menuDisplay = 20;
}
} else if (menuDisplay >= 210 && menuDisplay <= 211) {
@ -201,11 +201,11 @@ namespace KEYBOARD_Utils {
show_display("_SCREEN___", "", "SCREEN BRIGHTNESS MIN", 1000);
screenBrightness = 1;
}
} else if (menuDisplay == 220) {
show_display("_STATUS___", "", "WRITE STATUS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
} else if (menuDisplay == 221) {
show_display("_STATUS___", "", "SELECT STATUS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
} else if (menuDisplay == 230) {
show_display("_STATUS___", "", "WRITE STATUS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
} else if (menuDisplay == 231) {
show_display("_STATUS___", "", "SELECT STATUS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
} else if (menuDisplay == 240) {
show_display("_NOTIFIC__", "", "NOTIFICATIONS","STILL IN DEVELOPMENT!", 2000); /////////////////////////
}

View File

@ -27,11 +27,30 @@ extern String messageCallsign;
extern String messageText;
extern bool digirepeaterActive;
extern bool sosActive;
extern bool bluetoothActive;
extern bool displayEcoMode;
extern bool screenBrightness;
String digi, sos;
//String digi, sos, bt;
namespace MENU_Utils {
String checkProcessActive(bool process) {
if (process) {
return "ON";
} else {
return "OFF";
}
}
String checkScreenBrightness(int bright) {
if (bright == 255) {
return "MAX";
} else {
return "MIN";
}
}
void showOnScreen() {
String lastLine;
uint32_t lastMenuTime = millis() - menuTime;
@ -106,57 +125,70 @@ namespace MENU_Utils {
show_display("DELETE_MSG", "", " DELETE ALL?", "", "", " Confirm = LP or '>'");
break;
case 20: // 2.Configuration ---> Callsign
show_display("_CONFIG___", " Power Off", "> Callsign Change"," Display", " Status",lastLine);
show_display("_CONFIG___", " Power Off", "> Callsign Change"," Display", " Bluetooth (" + checkProcessActive(bluetoothActive) + ")",lastLine);
break;
case 21: // 2.Configuration ---> Display
show_display("_CONFIG___", " Callsign Change", "> Display", " Status", " Notifications",lastLine);
show_display("_CONFIG___", " Callsign Change", "> Display", " Bluetooth (" + checkProcessActive(bluetoothActive) + ")", " Status",lastLine);
break;
case 22: // 2.Configuration ---> Status
show_display("_CONFIG___", " Display", "> Status", " Notifications", " Reboot", lastLine);
case 22: // 2.Configuration ---> Bluetooth
show_display("_CONFIG___", " Display", "> Bluetooth (" + checkProcessActive(bluetoothActive) + ")", " Status", " Notifications", lastLine);
break;
case 23: // 2.Configuration ---> Notifications
show_display("_CONFIG___", " Status","> Notifications", " Reboot", " Power Off",lastLine);
case 23: // 2.Configuration ---> Status
show_display("_CONFIG___", " Bluetooth (" + checkProcessActive(bluetoothActive) + ")", "> Status"," Notifications", " Reboot",lastLine);
break;
case 24: // 2.Configuration ---> Reboot
case 24: // 2.Configuration ---> Notifications
show_display("_CONFIG___", " Status", "> Notifications", " Reboot", " Power Off",lastLine);
break;
case 25: // 2.Configuration ---> Reboot
show_display("_CONFIG___", " Notifications", "> Reboot", " Power Off", " Callsign Change",lastLine);
break;
case 25: // 2.Configuration ---> Power Off
case 26: // 2.Configuration ---> Power Off
show_display("_CONFIG___", " Reboot", "> Power Off", " Callsign Change", " Display",lastLine);
break;
case 200: // 2.Configuration ---> Callsign
show_display("_CALLSIGN_", ""," Confirm Change?","","","<Back Enter=Confirm");
break;
case 210: // 2.Configuration ---> Display ---> ECO Mode
show_display("_DISPLAY__", "", "> ECO Mode"," Brightness","",lastLine);
show_display("_DISPLAY__", "", "> ECO Mode (" + checkProcessActive(displayEcoMode) + ")"," Brightness (" + checkScreenBrightness(screenBrightness) + ")","",lastLine);
break;
case 211: // 2.Configuration ---> Display ---> Brightness
show_display("_DISPLAY__", "", " ECO Mode","> Brightness","",lastLine);
show_display("_DISPLAY__", "", " ECO Mode (" + checkProcessActive(displayEcoMode) + ")","> Brightness (" + checkScreenBrightness(screenBrightness) + ")","",lastLine);
break;
case 220: // 2.Configuration ---> Status
case 220:
if (bluetoothActive) {
bluetoothActive = false;
show_display("BLUETOOTH", "", " Bluetooth --> OFF", 1000);
} else {
bluetoothActive = true;
show_display("BLUETOOTH", "", " Bluetooth --> ON", 1000);
}
menuDisplay = 22;
break;
case 230: // 2.Configuration ---> Status
show_display("_STATUS___", "", "> Write"," Select","",lastLine);
break;
case 221: // 2.Configuration ---> Status
case 231: // 2.Configuration ---> Status
show_display("_STATUS___", "", " Write","> Select","",lastLine);
break;
case 230: // 2.Configuration ---> Notifications
case 240: // 2.Configuration ---> Notifications
show_display("_NOTIFIC__", "> Turn Off Sound/Led","","","",lastLine);
break;
case 240: // 2.Configuration ---> Reboot
case 250: // 2.Configuration ---> Reboot
if (keyDetected) {
show_display("_REBOOT?__", "","Confirm Reboot...","","","<Back Enter=Confirm");
} else {
show_display("_REBOOT?__", "no Keyboard Detected"," Use RST Button to","Reboot Tracker","",lastLine);
}
break;
case 250: // 2.Configuration ---> Power Off
case 260: // 2.Configuration ---> Power Off
if (keyDetected) {
show_display("POWER_OFF?", "","Confirm Power Off...","","","<Back Enter=Confirm");
} else {
@ -175,7 +207,7 @@ namespace MENU_Utils {
break;
case 60: // 6. Emergency ---> Digirepeater
if (digirepeaterActive) {
/*if (digirepeaterActive) {
digi = "ON";
} else {
digi = "OFF";
@ -184,11 +216,11 @@ namespace MENU_Utils {
sos = "ON";
} else {
sos = "OFF";
}
show_display("EMERGENCY_", "", "> DigiRepeater (" + digi + ")", " S.O.S. (" + sos + ")","",lastLine);
}*/
show_display("EMERGENCY_", "", "> DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
break;
case 61: // 6. Emergency ---> S.O.S.
if (digirepeaterActive) {
/*if (digirepeaterActive) {
digi = "ON";
} else {
digi = "OFF";
@ -197,8 +229,8 @@ namespace MENU_Utils {
sos = "ON";
} else {
sos = "OFF";
}
show_display("EMERGENCY_", "", " DigiRepeater (" + digi + ")", "> S.O.S. (" + sos + ")","",lastLine);
}*/
show_display("EMERGENCY_", "", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", "> S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
break;
case 0: ///////////// MAIN MENU //////////////

View File

@ -5,7 +5,9 @@
namespace MENU_Utils {
void showOnScreen();
String checkProcessActive(bool process);
String checkScreenBrightness(int bright);
void showOnScreen();
}