diff --git a/src/battery.cpp b/src/battery.cpp index 0e894965..367a4678 100644 --- a/src/battery.cpp +++ b/src/battery.cpp @@ -50,8 +50,13 @@ uint16_t read_voltage() { } bool batt_sufficient() { +#ifdef HAS_BATTERY_PROBE uint16_t volts = read_voltage(); - return (( volts < 1000 ) || (volts > OTA_MIN_BATT)); // no battery or battery sufficient + return ((volts < 1000) || + (volts > OTA_MIN_BATT)); // no battery or battery sufficient +#else + return true; +#endif } #endif // HAS_BATTERY_PROBE \ No newline at end of file diff --git a/src/ota.cpp b/src/ota.cpp index 434bfaa5..ae9dab05 100644 --- a/src/ota.cpp +++ b/src/ota.cpp @@ -40,15 +40,11 @@ inline String getHeaderValue(String header, String headerName) { void start_ota_update() { - /* // check battery status if we can before doing ota - #ifdef HAS_BATTERY_PROBE - if (!batt_sufficient()) { - ESP_LOGW(TAG, "Battery voltage %dmV too low for OTA", batt_voltage); - return; - } - #endif - */ + if (!batt_sufficient()) { + ESP_LOGE(TAG, "Battery voltage %dmV too low for OTA", batt_voltage); + return; + } switch_LED(LED_ON); diff --git a/src/paxcounter.conf b/src/paxcounter.conf index a4bb32ad..62995494 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -69,7 +69,7 @@ #define USE_OTA 1 // Comment out to disable OTA update #define WIFI_MAX_TRY 5 // maximum number of wifi connect attempts for OTA update [default = 20] #define OTA_MAX_TRY 5 // maximum number of attempts for OTA download and write to flash [default = 3] -#define OTA_MIN_BATT 3700 // minimum battery level for OTA [millivolt] +#define OTA_MIN_BATT 3600 // minimum battery level for OTA [millivolt] #define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds] // LMIC settings