From 2fa922c75f2cdaea104c6dc6a7662a3a6b27ce8b Mon Sep 17 00:00:00 2001 From: richonguzman Date: Tue, 7 May 2024 14:20:19 -0400 Subject: [PATCH] Heltec Battery Readings update --- README.md | 1 + src/LoRa_APRS_Tracker.cpp | 4 +++- src/power_utils.cpp | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 67cf551..9f56357 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ ____________________________________________________ ____________________________________________________ ## Timeline (Versions): +- 2024.05.07 HELTEC V3 and Wireless Tracker Battery Measurments at 30seg to avoid accelerated discharge. - 2024.05.06 New Output Buffer for Messages with retry posibilities. - 2024.04.25 Added Lilygo TTGO T-Deck (add Neo6Mv2 GPS) support. - 2024.04.12 Added HELTEC Wireless Tracker support. diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index 0785b25..4e1dbb7 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -48,7 +48,7 @@ BluetoothSerial SerialBT; OneButton userButton = OneButton(BUTTON_PIN, true, true); #endif -String versionDate = "2024.05.06"; +String versionDate = "2024.05.07"; uint8_t myBeaconsIndex = 0; int myBeaconsSize = Config.beacons.size(); @@ -133,6 +133,8 @@ String winlinkAlias = ""; String winlinkAliasComplete = ""; bool winlinkCommentState = false; +uint32_t batteryMeasurmentTime = 0; + APRSPacket lastReceivedPacket; logging::Logger logger; diff --git a/src/power_utils.cpp b/src/power_utils.cpp index 756ea1d..58611a6 100644 --- a/src/power_utils.cpp +++ b/src/power_utils.cpp @@ -32,6 +32,7 @@ XPowersAXP2101 PMU; extern Configuration Config; extern logging::Logger logger; extern bool disableGPS; +extern uint32_t batteryMeasurmentTime; bool pmuInterrupt; float lora32BatReadingCorr = 6.5; // % of correction to higher value to reflect the real battery voltage (adjust this to your needs) @@ -63,6 +64,7 @@ namespace POWER_Utils { #ifdef HELTEC_V3_GPS digitalWrite(ADC_CTRL, HIGH); #endif + batteryMeasurmentTime = millis(); #endif double voltage = (adc_value * 3.3 ) / 4095.0; #if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(OE5HWN_MeshCom) @@ -163,7 +165,11 @@ namespace POWER_Utils { } void batteryManager() { + #ifdef ADC_CTRL + if(batteryMeasurmentTime == 0 || (millis() - batteryMeasurmentTime) > 30 * 1000) obtainBatteryInfo(); + #else obtainBatteryInfo(); + #endif #if defined(HAS_AXP192) || defined(HAS_AXP2101) handleChargingLed(); #endif