battery check before ota
This commit is contained in:
parent
25d307e820
commit
d4d6a7ea07
@ -42,6 +42,14 @@ inline String getHeaderValue(String header, String headerName) {
|
|||||||
|
|
||||||
void start_ota_update() {
|
void start_ota_update() {
|
||||||
|
|
||||||
|
// check battery status if we can before doing ota
|
||||||
|
#ifdef HAS_BATTERY_PROBE
|
||||||
|
if (batt_voltage < OTA_MIN_BATT) {
|
||||||
|
ESP_LOGW(TAG, "Battery voltage %dmV too low for OTA", batt_voltage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// turn on LED
|
// turn on LED
|
||||||
#if (HAS_LED != NOT_A_PIN)
|
#if (HAS_LED != NOT_A_PIN)
|
||||||
#ifdef LED_ACTIVE_LOW
|
#ifdef LED_ACTIVE_LOW
|
||||||
@ -107,7 +115,6 @@ void start_ota_update() {
|
|||||||
|
|
||||||
} // start_ota_update
|
} // start_ota_update
|
||||||
|
|
||||||
|
|
||||||
void do_ota_update() {
|
void do_ota_update() {
|
||||||
char buf[17];
|
char buf[17];
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
// OTA settings
|
// OTA settings
|
||||||
#define WIFI_MAX_TRY 20 // maximum number of wifi connect attempts for OTA update [default = 20]
|
#define WIFI_MAX_TRY 20 // maximum number of wifi connect attempts for OTA update [default = 20]
|
||||||
#define FLASH_MAX_TRY 3 // maximum number of attempts for writing update binary to flash [default = 3]
|
#define FLASH_MAX_TRY 3 // maximum number of attempts for writing update binary to flash [default = 3]
|
||||||
|
#define OTA_MIN_BATT 3700 // minimum battery level vor OTA [millivolt]
|
||||||
|
|
||||||
// LMIC settings
|
// LMIC settings
|
||||||
// define hardware independent LMIC settings here, settings of standard library in /lmic/config.h will be ignored
|
// define hardware independent LMIC settings here, settings of standard library in /lmic/config.h will be ignored
|
||||||
|
Loading…
Reference in New Issue
Block a user