1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-02 10:02:23 +01:00

Reduce static RAM usage (#2140)

This commit is contained in:
Oxan van Leeuwen
2021-08-23 10:43:54 +02:00
committed by GitHub
parent 2f33cd2db5
commit d71996e58d
6 changed files with 113 additions and 82 deletions

View File

@@ -178,28 +178,29 @@ void OTAComponent::handle_() {
#endif
if (!Update.begin(ota_size, U_FLASH)) {
uint8_t error = Update.getError();
StreamString ss;
Update.printError(ss);
#ifdef ARDUINO_ARCH_ESP8266
if (ss.indexOf("Invalid bootstrapping") != -1) {
if (error == UPDATE_ERROR_BOOTSTRAP) {
error_code = OTA_RESPONSE_ERROR_INVALID_BOOTSTRAPPING;
goto error;
}
if (ss.indexOf("new Flash config wrong") != -1 || ss.indexOf("new Flash config wsong") != -1) {
if (error == UPDATE_ERROR_NEW_FLASH_CONFIG) {
error_code = OTA_RESPONSE_ERROR_WRONG_NEW_FLASH_CONFIG;
goto error;
}
if (ss.indexOf("Flash config wrong real") != -1 || ss.indexOf("Flash config wsong real") != -1) {
if (error == UPDATE_ERROR_FLASH_CONFIG) {
error_code = OTA_RESPONSE_ERROR_WRONG_CURRENT_FLASH_CONFIG;
goto error;
}
if (ss.indexOf("Not Enough Space") != -1) {
if (error == UPDATE_ERROR_SPACE) {
error_code = OTA_RESPONSE_ERROR_ESP8266_NOT_ENOUGH_SPACE;
goto error;
}
#endif
#ifdef ARDUINO_ARCH_ESP32
if (ss.indexOf("Bad Size Given") != -1) {
if (error == UPDATE_ERROR_SIZE) {
error_code = OTA_RESPONSE_ERROR_ESP32_NOT_ENOUGH_SPACE;
goto error;
}