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