diff --git a/data/tracker_config.json b/data/tracker_config.json index 13137f8..72314ce 100644 --- a/data/tracker_config.json +++ b/data/tracker_config.json @@ -97,7 +97,8 @@ "txBeep": false, "messageRxBeep": false, "stationBeep": false, - "lowBatteryBeep": false + "lowBatteryBeep": false, + "shutDownBeep": false }, "lora": [ { diff --git a/src/configuration.cpp b/src/configuration.cpp index dd4b92d..61d7c84 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -70,6 +70,7 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) { notification.messageRxBeep = data["notification"]["messageRxBeep"].as(); notification.stationBeep = data["notification"]["stationBeep"].as(); notification.lowBatteryBeep = data["notification"]["lowBatteryBeep"].as(); + notification.shutDownBeep = data["notification"]["shutDownBeep"].as(); JsonArray LoraTypesArray = data["lora"]; for (int j = 0; j < LoraTypesArray.size(); j++) { diff --git a/src/configuration.h b/src/configuration.h index dd10710..b4f8b19 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -59,6 +59,7 @@ public: bool messageRxBeep; bool stationBeep; bool lowBatteryBeep; + bool shutDownBeep; }; class LoraType { diff --git a/src/notification_utils.cpp b/src/notification_utils.cpp index d6bd047..c77336e 100644 --- a/src/notification_utils.cpp +++ b/src/notification_utils.cpp @@ -8,8 +8,8 @@ int pauseDuration = 20; int startUpSound[] = {440, 880, 440, 1760}; int startUpSoundDuration[] = {100, 100, 100, 200}; -//int shutDownSound[] = {1720, 880, 400}; -//int shutDownSoundDuration[] = {60, 60, 200}; +int shutDownSound[] = {1720, 880, 400}; +int shutDownSoundDuration[] = {60, 60, 200}; extern Configuration Config; extern bool digirepeaterActive; @@ -48,13 +48,13 @@ namespace NOTIFICATION_Utils { digitalWrite(Config.notification.buzzerPinVcc, LOW); } - /*void shutDownBeep() { + void shutDownBeep() { digitalWrite(Config.notification.buzzerPinVcc, HIGH); for (int i = 0; i < sizeof(shutDownSound) / sizeof(shutDownSound[0]); i++) { playTone(shutDownSound[i], shutDownSoundDuration[i]); } digitalWrite(Config.notification.buzzerPinVcc, LOW); - }*/ + } void lowBatteryBeep() { digitalWrite(Config.notification.buzzerPinVcc, HIGH); diff --git a/src/notification_utils.h b/src/notification_utils.h index 3b54a5c..52c6dfd 100644 --- a/src/notification_utils.h +++ b/src/notification_utils.h @@ -9,7 +9,7 @@ namespace NOTIFICATION_Utils { void beaconTxBeep(); void messageBeep(); void stationHeardBeep(); - //void shutDownBeep(); + void shutDownBeep(); void lowBatteryBeep(); void start(); diff --git a/src/power_utils.cpp b/src/power_utils.cpp index ee5bc5d..66aeb91 100644 --- a/src/power_utils.cpp +++ b/src/power_utils.cpp @@ -1,5 +1,6 @@ #include "configuration.h" #include "power_utils.h" +#include "notification_utils.h" #include "pins_config.h" #include "logger.h" @@ -344,6 +345,7 @@ namespace POWER_Utils { void shutdown() { #if defined(HAS_AXP192) || defined(HAS_AXP2101) + if (Config.notification.shutDownBeep) NOTIFICATION_Utils::shutDownBeep(); PMU.shutdown(); #endif }