added flashlight led
This commit is contained in:
parent
da7b55b6dd
commit
50617a81c6
|
|
@ -53,6 +53,7 @@ ____________________________________________________
|
|||
____________________________________________________
|
||||
## Timeline (Versions):
|
||||
|
||||
- 2023.12.27 Added Led-Flashlight like Baofeng UV5R led.
|
||||
- 2023.12.27 Added LoRa APRS Packet Decoder to Stations Menu.
|
||||
- 2023.12.26 Added BME680 (to the already BME/BMP280) support for Wx Telemetry Tx.
|
||||
- 2023.12.22 Added APRSThrusday on Messages Menu to parcitipate from this exercise (https://aprsph.net/aprsthursday/)
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ void setup() {
|
|||
}
|
||||
|
||||
powerManagement.lowerCpuFrequency();
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Smart Beacon is: %s", utils::getSmartBeaconState());
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Smart Beacon is: %s", Utils::getSmartBeaconState());
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Setup Done!");
|
||||
menuDisplay = 0;
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ void loop() {
|
|||
userButton.tick();
|
||||
#endif
|
||||
}
|
||||
utils::checkDisplayEcoMode();
|
||||
Utils::checkDisplayEcoMode();
|
||||
|
||||
if (keyboardConnected) {
|
||||
KEYBOARD_Utils::read();
|
||||
|
|
@ -185,6 +185,7 @@ void loop() {
|
|||
|
||||
MSG_Utils::checkReceivedMessage(LoRa_Utils::receivePacket());
|
||||
MSG_Utils::ledNotification();
|
||||
Utils::checkFlashlight();
|
||||
STATION_Utils::checkListenedTrackersByTimeAndDelete();
|
||||
if (Config.bluetoothType==0) {
|
||||
BLE_Utils::sendToLoRa();
|
||||
|
|
@ -195,7 +196,7 @@ void loop() {
|
|||
int currentSpeed = (int) gps.speed.kmph();
|
||||
|
||||
if (gps_loc_update) {
|
||||
utils::checkStatus();
|
||||
Utils::checkStatus();
|
||||
STATION_Utils::checkTelemetryTx();
|
||||
}
|
||||
lastTx = millis() - lastTxTime;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ extern int messagesIterator;
|
|||
extern bool messageLed;
|
||||
extern String messageCallsign;
|
||||
extern String messageText;
|
||||
extern bool flashlight;
|
||||
extern bool digirepeaterActive;
|
||||
extern bool sosActive;
|
||||
|
||||
|
|
@ -72,10 +73,10 @@ namespace KEYBOARD_Utils {
|
|||
if (menuDisplay < 30) {
|
||||
menuDisplay = 31;
|
||||
}
|
||||
}else if (menuDisplay >= 60 && menuDisplay <= 61) {
|
||||
}else if (menuDisplay >= 60 && menuDisplay <= 62) {
|
||||
menuDisplay--;
|
||||
if (menuDisplay < 60) {
|
||||
menuDisplay = 61;
|
||||
menuDisplay = 62;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -150,9 +151,9 @@ namespace KEYBOARD_Utils {
|
|||
menuDisplay = 4;
|
||||
}
|
||||
|
||||
else if (menuDisplay >= 60 && menuDisplay <= 61) {
|
||||
else if (menuDisplay >= 60 && menuDisplay <= 62) {
|
||||
menuDisplay++;
|
||||
if (menuDisplay > 61) {
|
||||
if (menuDisplay > 62) {
|
||||
menuDisplay = 60;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,7 +171,7 @@ namespace KEYBOARD_Utils {
|
|||
} else if (menuDisplay==1300) {
|
||||
messageText = "";
|
||||
menuDisplay = 130;
|
||||
} else if ((menuDisplay>=10 && menuDisplay<=13) || (menuDisplay>=20 && menuDisplay<=29) || (menuDisplay==120) || (menuDisplay>=130 && menuDisplay<=132) || (menuDisplay>=200 && menuDisplay<=290) || (menuDisplay>=60 && menuDisplay<=61) || (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<=132) || (menuDisplay>=200 && menuDisplay<=290) || (menuDisplay>=60 && menuDisplay<=62) || (menuDisplay>=30 && menuDisplay<=31) || (menuDisplay>=300 && menuDisplay<=310) || (menuDisplay==40)) {
|
||||
menuDisplay = int(menuDisplay/10);
|
||||
}
|
||||
/* winlinkMailNumber = "";*/
|
||||
|
|
@ -248,22 +249,34 @@ namespace KEYBOARD_Utils {
|
|||
else if (menuDisplay == 6) {
|
||||
menuDisplay = 60;
|
||||
} else if (menuDisplay == 60) {
|
||||
if (Config.notification.ledFlashlight) {
|
||||
if (flashlight) {
|
||||
show_display("__EXTRAS__", ""," Flashlight"," Status --> OFF","", 2000);
|
||||
flashlight = false;
|
||||
} else {
|
||||
show_display("__EXTRAS__", ""," Flashlight"," Status --> ON","", 2000);
|
||||
flashlight = true;
|
||||
}
|
||||
} else {
|
||||
show_display("__EXTRAS__", ""," Flashlight","NOT ACTIVE IN CONFIG!","", 2000);
|
||||
}
|
||||
} else if (menuDisplay == 61) {
|
||||
if (digirepeaterActive) {
|
||||
show_display("EMERGENCY_", ""," DigiRepeater"," Status --> OFF","", 2000); /////////////////////////
|
||||
show_display("__EXTRAS__", ""," DigiRepeater"," Status --> OFF","", 2000);
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "DigiRepeater OFF");
|
||||
digirepeaterActive = false;
|
||||
} else {
|
||||
show_display("EMERGENCY_", ""," DigiRepeater"," Status --> ON","", 2000); /////////////////////////
|
||||
show_display("__EXTRAS__", ""," DigiRepeater"," Status --> ON","", 2000);
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "DigiRepeater ON");
|
||||
digirepeaterActive = true;
|
||||
}
|
||||
} else if (menuDisplay == 61) {
|
||||
} else if (menuDisplay == 62) {
|
||||
if (sosActive) {
|
||||
show_display("EMERGENCY_", ""," S.O.S."," Status --> OFF","", 2000);
|
||||
show_display("__EXTRAS__", ""," S.O.S."," Status --> OFF","", 2000);
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode OFF");
|
||||
sosActive = false;
|
||||
} else {
|
||||
show_display("EMERGENCY_", ""," S.O.S."," Status --> ON","", 2000);
|
||||
show_display("__EXTRAS__", ""," S.O.S."," Status --> ON","", 2000);
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode ON");
|
||||
sosActive = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ extern int lowBatteryPercent;
|
|||
extern bool keyDetected;
|
||||
extern String messageCallsign;
|
||||
extern String messageText;
|
||||
extern bool flashlight;
|
||||
extern bool digirepeaterActive;
|
||||
extern bool sosActive;
|
||||
extern bool bluetoothActive;
|
||||
|
|
@ -74,7 +75,7 @@ namespace MENU_Utils {
|
|||
}
|
||||
switch (menuDisplay) { // Graphic Menu is in here!!!!
|
||||
case 1: // 1. Messages
|
||||
show_display("__MENU____"," 6.Emergency", "> 1.Messages", " 2.Configuration", " 3.Stations", lastLine);
|
||||
show_display("__MENU____"," 6.Extras", "> 1.Messages", " 2.Configuration", " 3.Stations", lastLine);
|
||||
break;
|
||||
case 2: // 2. Configuration
|
||||
show_display("__MENU____", " 1.Messages", "> 2.Configuration", " 3.Stations", " 4.Weather Report", lastLine);
|
||||
|
|
@ -83,13 +84,13 @@ namespace MENU_Utils {
|
|||
show_display("__MENU____", " 2.Configuration", "> 3.Stations", " 4.Weather Report", " 5.Winlink/Mail", lastLine);
|
||||
break;
|
||||
case 4: //4. Weather
|
||||
show_display("__MENU____", " 3.Stations", "> 4.Weather Report", " 5.Winlink/Mail", " 6.Emergency", lastLine);
|
||||
show_display("__MENU____", " 3.Stations", "> 4.Weather Report", " 5.Winlink/Mail", " 6.Extras", lastLine);
|
||||
break;
|
||||
case 5: //5. Winlink
|
||||
show_display("__MENU____", " 4.Weather Report", "> 5.Winlink/Mail", " 6.Emergency", " 1.Messages", lastLine);
|
||||
show_display("__MENU____", " 4.Weather Report", "> 5.Winlink/Mail", " 6.Extras", " 1.Messages", lastLine);
|
||||
break;
|
||||
case 6: //6. Emergency
|
||||
show_display("__MENU____", " 5.Winlink/Mail", "> 6.Emergency", " 1.Messages", " 2.Configuration", lastLine);
|
||||
case 6: //6. Extras
|
||||
show_display("__MENU____", " 5.Winlink/Mail", "> 6.Extras", " 1.Messages", " 2.Configuration", lastLine);
|
||||
break;
|
||||
|
||||
|
||||
|
|
@ -296,11 +297,14 @@ namespace MENU_Utils {
|
|||
// waiting for Weather Report
|
||||
break;
|
||||
|
||||
case 60: // 6. Emergency ---> Digirepeater
|
||||
show_display("EMERGENCY_", "", "> DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
||||
case 60: // 6. Extras ---> Flashlight
|
||||
show_display("__EXTRAS__", "> Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
||||
break;
|
||||
case 61: // 6. Emergency ---> S.O.S.
|
||||
show_display("EMERGENCY_", "", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", "> S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
||||
case 61: // 6. Extras ---> Digirepeater
|
||||
show_display("__EXTRAS__", " Flashlight (" + checkProcessActive(flashlight) + ")", "> DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
||||
break;
|
||||
case 62: // 6. Extras ---> S.O.S.
|
||||
show_display("__EXTRAS__", " Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", "> S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
||||
break;
|
||||
|
||||
case 0: ///////////// MAIN MENU //////////////
|
||||
|
|
@ -327,11 +331,11 @@ namespace MENU_Utils {
|
|||
fourthRowMainMenu = "";
|
||||
} else {
|
||||
const auto time_now = now();
|
||||
secondRowMainMenu = utils::createDateString(time_now) + " " + utils::createTimeString(time_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);
|
||||
} else {
|
||||
thirdRowMainMenu = String(utils::getMaidenheadLocator(gps.location.lat(), gps.location.lng(), 8));
|
||||
thirdRowMainMenu = String(Utils::getMaidenheadLocator(gps.location.lat(), gps.location.lng(), 8));
|
||||
}
|
||||
|
||||
for(int i = thirdRowMainMenu.length(); i < 18; i++) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include "gps_utils.h"
|
||||
#include "display.h"
|
||||
#include "logger.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern Beacon *currentBeacon;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ extern uint32_t displayTime;
|
|||
extern bool displayState;
|
||||
extern int menuDisplay;
|
||||
extern String versionDate;
|
||||
extern bool flashlight;
|
||||
|
||||
namespace utils {
|
||||
namespace Utils {
|
||||
|
||||
static char locator[11];
|
||||
// The letterize and getMaidenheadLocator functions are Copyright (c) 2021 Mateusz Salwach - MIT License
|
||||
|
|
@ -99,4 +100,12 @@ namespace utils {
|
|||
return "Off";
|
||||
}
|
||||
|
||||
void checkFlashlight() {
|
||||
if (flashlight && !digitalRead(Config.notification.ledFlashlightPin)) {
|
||||
digitalWrite(Config.notification.ledFlashlightPin, HIGH);
|
||||
} else if (!flashlight && digitalRead(Config.notification.ledFlashlightPin)) {
|
||||
digitalWrite(Config.notification.ledFlashlightPin, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#include <Arduino.h>
|
||||
#include <TimeLib.h>
|
||||
|
||||
namespace utils {
|
||||
namespace Utils {
|
||||
|
||||
char *getMaidenheadLocator(double lat, double lon, int size);
|
||||
String createDateString(time_t t);
|
||||
|
|
@ -12,6 +12,8 @@ namespace utils {
|
|||
void checkStatus();
|
||||
void checkDisplayEcoMode();
|
||||
String getSmartBeaconState();
|
||||
void checkFlashlight();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue