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):
- 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.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!)

View File

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

View File

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