added flashlight led
This commit is contained in:
parent
da7b55b6dd
commit
50617a81c6
|
|
@ -53,6 +53,7 @@ ____________________________________________________
|
||||||
____________________________________________________
|
____________________________________________________
|
||||||
## Timeline (Versions):
|
## 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.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.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/)
|
- 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();
|
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!");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Setup Done!");
|
||||||
menuDisplay = 0;
|
menuDisplay = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ void loop() {
|
||||||
userButton.tick();
|
userButton.tick();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
utils::checkDisplayEcoMode();
|
Utils::checkDisplayEcoMode();
|
||||||
|
|
||||||
if (keyboardConnected) {
|
if (keyboardConnected) {
|
||||||
KEYBOARD_Utils::read();
|
KEYBOARD_Utils::read();
|
||||||
|
|
@ -185,6 +185,7 @@ void loop() {
|
||||||
|
|
||||||
MSG_Utils::checkReceivedMessage(LoRa_Utils::receivePacket());
|
MSG_Utils::checkReceivedMessage(LoRa_Utils::receivePacket());
|
||||||
MSG_Utils::ledNotification();
|
MSG_Utils::ledNotification();
|
||||||
|
Utils::checkFlashlight();
|
||||||
STATION_Utils::checkListenedTrackersByTimeAndDelete();
|
STATION_Utils::checkListenedTrackersByTimeAndDelete();
|
||||||
if (Config.bluetoothType==0) {
|
if (Config.bluetoothType==0) {
|
||||||
BLE_Utils::sendToLoRa();
|
BLE_Utils::sendToLoRa();
|
||||||
|
|
@ -195,7 +196,7 @@ void loop() {
|
||||||
int currentSpeed = (int) gps.speed.kmph();
|
int currentSpeed = (int) gps.speed.kmph();
|
||||||
|
|
||||||
if (gps_loc_update) {
|
if (gps_loc_update) {
|
||||||
utils::checkStatus();
|
Utils::checkStatus();
|
||||||
STATION_Utils::checkTelemetryTx();
|
STATION_Utils::checkTelemetryTx();
|
||||||
}
|
}
|
||||||
lastTx = millis() - lastTxTime;
|
lastTx = millis() - lastTxTime;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ extern int messagesIterator;
|
||||||
extern bool messageLed;
|
extern bool messageLed;
|
||||||
extern String messageCallsign;
|
extern String messageCallsign;
|
||||||
extern String messageText;
|
extern String messageText;
|
||||||
|
extern bool flashlight;
|
||||||
extern bool digirepeaterActive;
|
extern bool digirepeaterActive;
|
||||||
extern bool sosActive;
|
extern bool sosActive;
|
||||||
|
|
||||||
|
|
@ -72,10 +73,10 @@ namespace KEYBOARD_Utils {
|
||||||
if (menuDisplay < 30) {
|
if (menuDisplay < 30) {
|
||||||
menuDisplay = 31;
|
menuDisplay = 31;
|
||||||
}
|
}
|
||||||
}else if (menuDisplay >= 60 && menuDisplay <= 61) {
|
}else if (menuDisplay >= 60 && menuDisplay <= 62) {
|
||||||
menuDisplay--;
|
menuDisplay--;
|
||||||
if (menuDisplay < 60) {
|
if (menuDisplay < 60) {
|
||||||
menuDisplay = 61;
|
menuDisplay = 62;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -150,9 +151,9 @@ namespace KEYBOARD_Utils {
|
||||||
menuDisplay = 4;
|
menuDisplay = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (menuDisplay >= 60 && menuDisplay <= 61) {
|
else if (menuDisplay >= 60 && menuDisplay <= 62) {
|
||||||
menuDisplay++;
|
menuDisplay++;
|
||||||
if (menuDisplay > 61) {
|
if (menuDisplay > 62) {
|
||||||
menuDisplay = 60;
|
menuDisplay = 60;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +171,7 @@ namespace KEYBOARD_Utils {
|
||||||
} else if (menuDisplay==1300) {
|
} else if (menuDisplay==1300) {
|
||||||
messageText = "";
|
messageText = "";
|
||||||
menuDisplay = 130;
|
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);
|
menuDisplay = int(menuDisplay/10);
|
||||||
}
|
}
|
||||||
/* winlinkMailNumber = "";*/
|
/* winlinkMailNumber = "";*/
|
||||||
|
|
@ -248,22 +249,34 @@ namespace KEYBOARD_Utils {
|
||||||
else if (menuDisplay == 6) {
|
else if (menuDisplay == 6) {
|
||||||
menuDisplay = 60;
|
menuDisplay = 60;
|
||||||
} else if (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) {
|
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");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "DigiRepeater OFF");
|
||||||
digirepeaterActive = false;
|
digirepeaterActive = false;
|
||||||
} else {
|
} 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");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "DigiRepeater ON");
|
||||||
digirepeaterActive = true;
|
digirepeaterActive = true;
|
||||||
}
|
}
|
||||||
} else if (menuDisplay == 61) {
|
} else if (menuDisplay == 62) {
|
||||||
if (sosActive) {
|
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");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode OFF");
|
||||||
sosActive = false;
|
sosActive = false;
|
||||||
} else {
|
} 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");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "%s", "S.O.S Mode ON");
|
||||||
sosActive = true;
|
sosActive = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ extern int lowBatteryPercent;
|
||||||
extern bool keyDetected;
|
extern bool keyDetected;
|
||||||
extern String messageCallsign;
|
extern String messageCallsign;
|
||||||
extern String messageText;
|
extern String messageText;
|
||||||
|
extern bool flashlight;
|
||||||
extern bool digirepeaterActive;
|
extern bool digirepeaterActive;
|
||||||
extern bool sosActive;
|
extern bool sosActive;
|
||||||
extern bool bluetoothActive;
|
extern bool bluetoothActive;
|
||||||
|
|
@ -74,7 +75,7 @@ namespace MENU_Utils {
|
||||||
}
|
}
|
||||||
switch (menuDisplay) { // Graphic Menu is in here!!!!
|
switch (menuDisplay) { // Graphic Menu is in here!!!!
|
||||||
case 1: // 1. Messages
|
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;
|
break;
|
||||||
case 2: // 2. Configuration
|
case 2: // 2. Configuration
|
||||||
show_display("__MENU____", " 1.Messages", "> 2.Configuration", " 3.Stations", " 4.Weather Report", lastLine);
|
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);
|
show_display("__MENU____", " 2.Configuration", "> 3.Stations", " 4.Weather Report", " 5.Winlink/Mail", lastLine);
|
||||||
break;
|
break;
|
||||||
case 4: //4. Weather
|
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;
|
break;
|
||||||
case 5: //5. Winlink
|
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;
|
break;
|
||||||
case 6: //6. Emergency
|
case 6: //6. Extras
|
||||||
show_display("__MENU____", " 5.Winlink/Mail", "> 6.Emergency", " 1.Messages", " 2.Configuration", lastLine);
|
show_display("__MENU____", " 5.Winlink/Mail", "> 6.Extras", " 1.Messages", " 2.Configuration", lastLine);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -296,11 +297,14 @@ namespace MENU_Utils {
|
||||||
// waiting for Weather Report
|
// waiting for Weather Report
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 60: // 6. Emergency ---> Digirepeater
|
case 60: // 6. Extras ---> Flashlight
|
||||||
show_display("EMERGENCY_", "", "> DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
show_display("__EXTRAS__", "> Flashlight (" + checkProcessActive(flashlight) + ")", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", " S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
||||||
break;
|
break;
|
||||||
case 61: // 6. Emergency ---> S.O.S.
|
case 61: // 6. Extras ---> Digirepeater
|
||||||
show_display("EMERGENCY_", "", " DigiRepeater (" + checkProcessActive(digirepeaterActive) + ")", "> S.O.S. (" + checkProcessActive(sosActive) + ")","",lastLine);
|
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;
|
break;
|
||||||
|
|
||||||
case 0: ///////////// MAIN MENU //////////////
|
case 0: ///////////// MAIN MENU //////////////
|
||||||
|
|
@ -327,11 +331,11 @@ namespace MENU_Utils {
|
||||||
fourthRowMainMenu = "";
|
fourthRowMainMenu = "";
|
||||||
} else {
|
} else {
|
||||||
const auto time_now = now();
|
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) {
|
if (time_now % 10 < 5) {
|
||||||
thirdRowMainMenu = String(gps.location.lat(), 4) + " " + String(gps.location.lng(), 4);
|
thirdRowMainMenu = String(gps.location.lat(), 4) + " " + String(gps.location.lng(), 4);
|
||||||
} else {
|
} 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++) {
|
for(int i = thirdRowMainMenu.length(); i < 18; i++) {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
#include "gps_utils.h"
|
#include "gps_utils.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
extern Beacon *currentBeacon;
|
extern Beacon *currentBeacon;
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,9 @@ extern uint32_t displayTime;
|
||||||
extern bool displayState;
|
extern bool displayState;
|
||||||
extern int menuDisplay;
|
extern int menuDisplay;
|
||||||
extern String versionDate;
|
extern String versionDate;
|
||||||
|
extern bool flashlight;
|
||||||
|
|
||||||
namespace utils {
|
namespace Utils {
|
||||||
|
|
||||||
static char locator[11];
|
static char locator[11];
|
||||||
// The letterize and getMaidenheadLocator functions are Copyright (c) 2021 Mateusz Salwach - MIT License
|
// The letterize and getMaidenheadLocator functions are Copyright (c) 2021 Mateusz Salwach - MIT License
|
||||||
|
|
@ -99,4 +100,12 @@ namespace utils {
|
||||||
return "Off";
|
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 <Arduino.h>
|
||||||
#include <TimeLib.h>
|
#include <TimeLib.h>
|
||||||
|
|
||||||
namespace utils {
|
namespace Utils {
|
||||||
|
|
||||||
char *getMaidenheadLocator(double lat, double lon, int size);
|
char *getMaidenheadLocator(double lat, double lon, int size);
|
||||||
String createDateString(time_t t);
|
String createDateString(time_t t);
|
||||||
|
|
@ -12,6 +12,8 @@ namespace utils {
|
||||||
void checkStatus();
|
void checkStatus();
|
||||||
void checkDisplayEcoMode();
|
void checkDisplayEcoMode();
|
||||||
String getSmartBeaconState();
|
String getSmartBeaconState();
|
||||||
|
void checkFlashlight();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue