Add ESP8266 OTA upload fallback to .gz

This commit is contained in:
Theo Arends 2021-02-12 13:19:50 +01:00
parent 38ca370956
commit 4fd4d73602
2 changed files with 13 additions and 0 deletions

View File

@ -1077,6 +1077,15 @@ void Every250mSeconds(void)
snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("%s-" D_JSON_MINIMAL "%s"), TasmotaGlobal.mqtt_data, ota_url_type); // Minimal filename must be filename-minimal
}
#endif // FIRMWARE_MINIMAL
#ifdef ESP8266
if (ota_retry_counter < OTA_ATTEMPTS / 2) {
if (!strcasecmp_P(TasmotaGlobal.mqtt_data, PSTR(".gz"))) {
ota_retry_counter = 1;
} else {
strcat_P(TasmotaGlobal.mqtt_data, PSTR(".gz"));
}
}
#endif // ESP8266
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "%s"), TasmotaGlobal.mqtt_data);
WiFiClient OTAclient;
ota_result = (HTTP_UPDATE_FAILED != ESPhttpUpdate.update(OTAclient, TasmotaGlobal.mqtt_data));

View File

@ -147,7 +147,11 @@ const uint32_t BOOT_LOOP_TIME = 10; // Number of seconds to stop detecti
const uint32_t POWER_CYCLE_TIME = 8; // Number of seconds to reset power cycle boot loops
const uint16_t SYSLOG_TIMER = 600; // Seconds to restore syslog_level
const uint16_t SERIALLOG_TIMER = 600; // Seconds to disable SerialLog
#ifdef ESP8266
const uint8_t OTA_ATTEMPTS = 10; // Number of times to try fetching the new firmware
#else
const uint8_t OTA_ATTEMPTS = 5; // Number of times to try fetching the new firmware
#endif // ESP8266
const uint16_t INPUT_BUFFER_SIZE = 520; // Max number of characters in serial command buffer
const uint16_t FLOATSZ = 16; // Max number of characters in float result from dtostrfd (max 32)