From 50bbcf6c47ec515ebfb232673879b96d435b9a03 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Sat, 23 Sep 2023 10:39:44 -0300 Subject: [PATCH] lowBatteryBeep update --- src/LoRa_APRS_Tracker.cpp | 2 +- src/menu_utils.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index 9adc5fc..f623702 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -55,7 +55,7 @@ bool bluetoothConnected = false; bool messageLed = false; uint32_t messageLedTime = millis(); -int batteryPercent = 21; +int lowBatteryPercent = 21; uint32_t lastTx = 0.0; uint32_t txInterval = 60000L; diff --git a/src/menu_utils.cpp b/src/menu_utils.cpp index e149bb9..fd64818 100644 --- a/src/menu_utils.cpp +++ b/src/menu_utils.cpp @@ -21,7 +21,7 @@ extern std::vector loadedAPRSMessages; extern int messagesIterator; extern uint32_t menuTime; extern bool symbolAvailable; -extern int batteryPercent; +extern int lowBatteryPercent; namespace MENU_Utils { @@ -148,18 +148,15 @@ namespace MENU_Utils { } #endif #ifdef TTGO_T_Beam_V1_2 - if (Config.notification.lowBatteryBeep && !powerManagement.isChargeing() && batteryCharge.toInt() < batteryPercent) { - Serial.println(batteryPercent); - Serial.println(batteryCharge.toInt()); - Serial.println("--"); - batteryPercent = batteryCharge.toInt(); + if (Config.notification.lowBatteryBeep && !powerManagement.isChargeing() && batteryCharge.toInt() < lowBatteryPercent) { + lowBatteryPercent = batteryCharge.toInt(); NOTIFICATION_Utils::lowBatteryBeep(); if (batteryCharge.toInt() < 6) { NOTIFICATION_Utils::lowBatteryBeep(); } } if (powerManagement.isChargeing()) { - batteryPercent = 21; + lowBatteryPercent = 21; } batteryVoltage = batteryVoltage.toFloat()/1000; if (powerManagement.isChargeing() && batteryCharge!="100") {