ota battery check modified

This commit is contained in:
Klaus K Wilting 2018-09-27 21:13:18 +02:00
parent b22fd808b8
commit 8125662753
4 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -9,5 +9,6 @@
uint16_t read_voltage(void);
void calibrate_voltage(void);
bool batt_sufficient(void);
#endif

View File

@ -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;
}

View File

@ -5,6 +5,7 @@
#include "globals.h"
#include "update.h"
#include "battery.h"
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <BintrayClient.h>