OTA battery check
This commit is contained in:
parent
8ae5b6e970
commit
b0fa5e9021
@ -50,8 +50,13 @@ uint16_t read_voltage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool batt_sufficient() {
|
bool batt_sufficient() {
|
||||||
|
#ifdef HAS_BATTERY_PROBE
|
||||||
uint16_t volts = read_voltage();
|
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
|
#endif // HAS_BATTERY_PROBE
|
12
src/ota.cpp
12
src/ota.cpp
@ -40,15 +40,11 @@ inline String getHeaderValue(String header, String headerName) {
|
|||||||
|
|
||||||
void start_ota_update() {
|
void start_ota_update() {
|
||||||
|
|
||||||
/*
|
|
||||||
// check battery status if we can before doing ota
|
// check battery status if we can before doing ota
|
||||||
#ifdef HAS_BATTERY_PROBE
|
if (!batt_sufficient()) {
|
||||||
if (!batt_sufficient()) {
|
ESP_LOGE(TAG, "Battery voltage %dmV too low for OTA", batt_voltage);
|
||||||
ESP_LOGW(TAG, "Battery voltage %dmV too low for OTA", batt_voltage);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
switch_LED(LED_ON);
|
switch_LED(LED_ON);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
#define USE_OTA 1 // Comment out to disable OTA update
|
#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 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_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]
|
#define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds]
|
||||||
|
|
||||||
// LMIC settings
|
// LMIC settings
|
||||||
|
Loading…
Reference in New Issue
Block a user