shutDownBeep config option

This commit is contained in:
formtapez 2024-03-09 19:06:53 +01:00
parent 0859c00af7
commit c980f2f6dd
No known key found for this signature in database
GPG Key ID: AC38E261162AADF7
6 changed files with 11 additions and 6 deletions

View File

@ -97,7 +97,8 @@
"txBeep": false, "txBeep": false,
"messageRxBeep": false, "messageRxBeep": false,
"stationBeep": false, "stationBeep": false,
"lowBatteryBeep": false "lowBatteryBeep": false,
"shutDownBeep": false
}, },
"lora": [ "lora": [
{ {

View File

@ -70,6 +70,7 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
notification.messageRxBeep = data["notification"]["messageRxBeep"].as<bool>(); notification.messageRxBeep = data["notification"]["messageRxBeep"].as<bool>();
notification.stationBeep = data["notification"]["stationBeep"].as<bool>(); notification.stationBeep = data["notification"]["stationBeep"].as<bool>();
notification.lowBatteryBeep = data["notification"]["lowBatteryBeep"].as<bool>(); notification.lowBatteryBeep = data["notification"]["lowBatteryBeep"].as<bool>();
notification.shutDownBeep = data["notification"]["shutDownBeep"].as<bool>();
JsonArray LoraTypesArray = data["lora"]; JsonArray LoraTypesArray = data["lora"];
for (int j = 0; j < LoraTypesArray.size(); j++) { for (int j = 0; j < LoraTypesArray.size(); j++) {

View File

@ -59,6 +59,7 @@ public:
bool messageRxBeep; bool messageRxBeep;
bool stationBeep; bool stationBeep;
bool lowBatteryBeep; bool lowBatteryBeep;
bool shutDownBeep;
}; };
class LoraType { class LoraType {

View File

@ -8,8 +8,8 @@ int pauseDuration = 20;
int startUpSound[] = {440, 880, 440, 1760}; int startUpSound[] = {440, 880, 440, 1760};
int startUpSoundDuration[] = {100, 100, 100, 200}; int startUpSoundDuration[] = {100, 100, 100, 200};
//int shutDownSound[] = {1720, 880, 400}; int shutDownSound[] = {1720, 880, 400};
//int shutDownSoundDuration[] = {60, 60, 200}; int shutDownSoundDuration[] = {60, 60, 200};
extern Configuration Config; extern Configuration Config;
extern bool digirepeaterActive; extern bool digirepeaterActive;
@ -48,13 +48,13 @@ namespace NOTIFICATION_Utils {
digitalWrite(Config.notification.buzzerPinVcc, LOW); digitalWrite(Config.notification.buzzerPinVcc, LOW);
} }
/*void shutDownBeep() { void shutDownBeep() {
digitalWrite(Config.notification.buzzerPinVcc, HIGH); digitalWrite(Config.notification.buzzerPinVcc, HIGH);
for (int i = 0; i < sizeof(shutDownSound) / sizeof(shutDownSound[0]); i++) { for (int i = 0; i < sizeof(shutDownSound) / sizeof(shutDownSound[0]); i++) {
playTone(shutDownSound[i], shutDownSoundDuration[i]); playTone(shutDownSound[i], shutDownSoundDuration[i]);
} }
digitalWrite(Config.notification.buzzerPinVcc, LOW); digitalWrite(Config.notification.buzzerPinVcc, LOW);
}*/ }
void lowBatteryBeep() { void lowBatteryBeep() {
digitalWrite(Config.notification.buzzerPinVcc, HIGH); digitalWrite(Config.notification.buzzerPinVcc, HIGH);

View File

@ -9,7 +9,7 @@ namespace NOTIFICATION_Utils {
void beaconTxBeep(); void beaconTxBeep();
void messageBeep(); void messageBeep();
void stationHeardBeep(); void stationHeardBeep();
//void shutDownBeep(); void shutDownBeep();
void lowBatteryBeep(); void lowBatteryBeep();
void start(); void start();

View File

@ -1,5 +1,6 @@
#include "configuration.h" #include "configuration.h"
#include "power_utils.h" #include "power_utils.h"
#include "notification_utils.h"
#include "pins_config.h" #include "pins_config.h"
#include "logger.h" #include "logger.h"
@ -344,6 +345,7 @@ namespace POWER_Utils {
void shutdown() { void shutdown() {
#if defined(HAS_AXP192) || defined(HAS_AXP2101) #if defined(HAS_AXP192) || defined(HAS_AXP2101)
if (Config.notification.shutDownBeep) NOTIFICATION_Utils::shutDownBeep();
PMU.shutdown(); PMU.shutdown();
#endif #endif
} }