BatteryMonitor added
This commit is contained in:
parent
cd8d288ccc
commit
33f3a9db6c
|
|
@ -480,8 +480,8 @@
|
|||
placeholder="0.0"
|
||||
class="form-control"
|
||||
step="0.1"
|
||||
min="-5.0"
|
||||
max="5.0"
|
||||
min="-5"
|
||||
max="5"
|
||||
/>
|
||||
<span class="input-group-text"
|
||||
>Celsius</span
|
||||
|
|
@ -647,7 +647,7 @@
|
|||
value="2.9"
|
||||
step="0.1"
|
||||
min="2.5"
|
||||
max="4.5"
|
||||
max="3.7"
|
||||
/>
|
||||
<span class="input-group-text"
|
||||
>Volts</span
|
||||
|
|
|
|||
|
|
@ -59,8 +59,4 @@ namespace BATTERY_Utils {
|
|||
}
|
||||
}
|
||||
|
||||
void checkLowVoltageAndSleep(float voltage) {
|
||||
if (voltage <= 3.0) POWER_Utils::shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,8 +8,7 @@ namespace BATTERY_Utils {
|
|||
|
||||
String generateEncodedTelemetry(float voltage);
|
||||
String getPercentVoltageBattery(float voltage);
|
||||
void checkLowVoltageAndSleep(float voltage);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -239,8 +239,14 @@ namespace STATION_Utils {
|
|||
sendCommentAfterXBeacons = Config.sendCommentAfterXBeacons;
|
||||
}
|
||||
String batteryVoltage = POWER_Utils::getBatteryInfoVoltage();
|
||||
#if defined(BATTERY_PIN) && !defined(HAS_AXP192) && !defined(HAS_AXP2101)
|
||||
BATTERY_Utils::checkLowVoltageAndSleep(batteryVoltage.toFloat());
|
||||
bool shouldSleepLowVoltage = false;
|
||||
#if defined(BATTERY_PIN) || defined(HAS_AXP192) || defined(HAS_AXP2101)
|
||||
if (Config.battery.monitorVoltage && batteryVoltage.toFloat() < Config.battery.sleepVoltage) {
|
||||
shouldSleepLowVoltage = true;
|
||||
}
|
||||
//
|
||||
//BATTERY_Utils::checkLowVoltageAndSleep(batteryVoltage.toFloat());
|
||||
//
|
||||
#endif
|
||||
if (Config.battery.sendVoltage && !Config.battery.voltageAsTelemetry) {
|
||||
String batteryChargeCurrent = POWER_Utils::getBatteryInfoCurrent();
|
||||
|
|
@ -264,12 +270,16 @@ namespace STATION_Utils {
|
|||
comment += "%";
|
||||
#endif
|
||||
}
|
||||
if (comment != "" || (Config.battery.sendVoltage && Config.battery.voltageAsTelemetry)) {
|
||||
updateCounter++;
|
||||
if (updateCounter >= sendCommentAfterXBeacons) {
|
||||
if (comment != "") packet += comment;
|
||||
if (Config.battery.sendVoltage && Config.battery.voltageAsTelemetry) packet += BATTERY_Utils::generateEncodedTelemetry(batteryVoltage.toFloat());
|
||||
updateCounter = 0;
|
||||
if (shouldSleepLowVoltage) {
|
||||
packet += " **LowVoltagePowerOff**";
|
||||
} else {
|
||||
if (comment != "" || (Config.battery.sendVoltage && Config.battery.voltageAsTelemetry)) {
|
||||
updateCounter++;
|
||||
if (updateCounter >= sendCommentAfterXBeacons) {
|
||||
if (comment != "") packet += comment;
|
||||
if (Config.battery.sendVoltage && Config.battery.voltageAsTelemetry) packet += BATTERY_Utils::generateEncodedTelemetry(batteryVoltage.toFloat());
|
||||
updateCounter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAS_TFT
|
||||
|
|
@ -277,6 +287,11 @@ namespace STATION_Utils {
|
|||
#endif
|
||||
displayShow("<<< TX >>>", "", packet,100);
|
||||
LoRa_Utils::sendNewPacket(packet);
|
||||
|
||||
if (shouldSleepLowVoltage) {
|
||||
delay(3000);
|
||||
POWER_Utils::shutdown();
|
||||
}
|
||||
|
||||
if (smartBeaconActive) {
|
||||
lastTxLat = gps.location.lat();
|
||||
|
|
@ -292,11 +307,6 @@ namespace STATION_Utils {
|
|||
if (currentBeacon->gpsEcoMode) {
|
||||
gpsShouldSleep = true;
|
||||
}
|
||||
#if !defined(HAS_AXP192) && !defined(HAS_AXP2101) && defined(BATTERY_PIN)
|
||||
if (batteryVoltage.toFloat() < 3.0) {
|
||||
POWER_Utils::shutdown();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void checkTelemetryTx() {
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ namespace WEB_Utils {
|
|||
|
||||
// WiFi AP
|
||||
Config.wifiAP.password = request->getParam("wifiAP.password", true)->value();
|
||||
Config.wifiAP.active = true;//false; // when Configuration is finished Tracker returns to normal mode.
|
||||
Config.wifiAP.active = false; // when Configuration is finished Tracker returns to normal mode.
|
||||
|
||||
Config.writeFile();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue