ota battery check modified
This commit is contained in:
parent
b22fd808b8
commit
8125662753
@ -49,4 +49,9 @@ uint16_t read_voltage() {
|
||||
return voltage;
|
||||
}
|
||||
|
||||
bool batt_sufficient() {
|
||||
uint16_t volts = read_voltage();
|
||||
return (( volts < 1000 ) || (volts > OTA_MIN_BATT)); // no battery or battery sufficient
|
||||
}
|
||||
|
||||
#endif // HAS_BATTERY_PROBE
|
@ -9,5 +9,6 @@
|
||||
|
||||
uint16_t read_voltage(void);
|
||||
void calibrate_voltage(void);
|
||||
bool batt_sufficient(void);
|
||||
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@ void start_ota_update() {
|
||||
|
||||
// check battery status if we can before doing ota
|
||||
#ifdef HAS_BATTERY_PROBE
|
||||
if (batt_voltage < OTA_MIN_BATT) {
|
||||
if (!batt_sufficient()) {
|
||||
ESP_LOGW(TAG, "Battery voltage %dmV too low for OTA", batt_voltage);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user