Encoded Telemetry Battery Voltage fix

This commit is contained in:
richonguzman 2024-09-18 23:04:00 -03:00
parent 0bfe9364f8
commit a0b391e0eb
3 changed files with 29 additions and 32 deletions

View File

@ -49,7 +49,7 @@ ____________________________________________________
____________________________________________________ ____________________________________________________
## Timeline (Versions): ## Timeline (Versions):
- 2024.09.17 Battery Info now as Encoded Telemetry in GPS Beacon. - 2024.09.17 Battery Voltage now as Encoded Telemetry in GPS Beacon.
- 2024.08.26 New reformating of code ahead of WebInstaller: SmartBeacon change. - 2024.08.26 New reformating of code ahead of WebInstaller: SmartBeacon change.
- 2024.08.16 BLE support for Android devices (not APRSDroid yet). - 2024.08.16 BLE support for Android devices (not APRSDroid yet).
- 2024.08.12 Added support for EByte E220 400M30S 1Watt LoRa module for DIY ESP32 Tracker (LLCC68 supports spreading factor only in range of 5 - 11!) - 2024.08.12 Added support for EByte E220 400M30S 1Watt LoRa module for DIY ESP32 Tracker (LLCC68 supports spreading factor only in range of 5 - 11!)

View File

@ -47,7 +47,7 @@ TinyGPSPlus gps;
OneButton userButton = OneButton(BUTTON_PIN, true, true); OneButton userButton = OneButton(BUTTON_PIN, true, true);
#endif #endif
String versionDate = "2024.09.17"; String versionDate = "2024.09.18";
uint8_t myBeaconsIndex = 0; uint8_t myBeaconsIndex = 0;
int myBeaconsSize = Config.beacons.size(); int myBeaconsSize = Config.beacons.size();

View File

@ -41,7 +41,7 @@ extern bool gpsShouldSleep;
bool sendStandingUpdate = false; bool sendStandingUpdate = false;
uint8_t updateCounter = Config.sendCommentAfterXBeacons; uint8_t updateCounter = 100;
bool sendStartTelemetry = true; bool sendStartTelemetry = true;
@ -238,39 +238,36 @@ namespace STATION_Utils {
sendCommentAfterXBeacons = Config.sendCommentAfterXBeacons; sendCommentAfterXBeacons = Config.sendCommentAfterXBeacons;
} }
String batteryVoltage = POWER_Utils::getBatteryInfoVoltage(); String batteryVoltage = POWER_Utils::getBatteryInfoVoltage();
if (Config.battery.sendVoltage) { if (Config.battery.sendVoltage && !Config.battery.voltageAsTelemetry) {
if (Config.battery.voltageAsTelemetry) { String batteryChargeCurrent = POWER_Utils::getBatteryInfoCurrent();
comment += BATTERY_Utils::generateEncodedTelemetry(batteryVoltage.toFloat()); #ifdef HAS_AXP192
} else { comment += " Bat=";
String batteryChargeCurrent = POWER_Utils::getBatteryInfoCurrent(); comment += batteryVoltage;
#ifdef HAS_AXP192 comment += "V (";
comment += " Bat="; comment += batteryChargeCurrent;
comment += batteryVoltage; comment += "mA)";
comment += "V ("; #endif
comment += batteryChargeCurrent; #ifdef HAS_AXP2101
comment += "mA)"; comment += " Bat=";
#endif comment += String(batteryVoltage.toFloat(),2);
#ifdef HAS_AXP2101 comment += "V (";
comment += " Bat="; comment += batteryChargeCurrent;
comment += String(batteryVoltage.toFloat(),2); comment += "%)";
comment += "V ("; #endif
comment += batteryChargeCurrent; #if defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS)
comment += "%)"; comment += " Bat=";
#endif comment += String(batteryVoltage.toFloat(),2);
#if defined(HELTEC_V3_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS) comment += "V";
comment += " Bat="; #endif
comment += String(batteryVoltage.toFloat(),2);
comment += "V";
#endif
}
} }
if (comment != "") { if (comment != "" || (Config.battery.sendVoltage && Config.battery.voltageAsTelemetry)) {
updateCounter++; updateCounter++;
if (updateCounter >= sendCommentAfterXBeacons) { if (updateCounter >= sendCommentAfterXBeacons) {
packet += comment; if (comment != "") packet += comment;
if (Config.battery.sendVoltage && Config.battery.voltageAsTelemetry) packet += BATTERY_Utils::generateEncodedTelemetry(batteryVoltage.toFloat());
updateCounter = 0; updateCounter = 0;
} }
} }
#ifdef HAS_TFT #ifdef HAS_TFT
cleanTFT(); cleanTFT();
#endif #endif