Skip to content

Commit

Permalink
Add offset to ESP32 OTA error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam committed Oct 16, 2023
1 parent 6a9acc2 commit 5840e10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utility/ota/OTA-esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ int esp32_onOTARequest(char const * ota_url)
if ((ota_err = ota.begin()) != Arduino_ESP32_OTA::Error::None)
{
DEBUG_ERROR("Arduino_ESP32_OTA::begin() failed with %d", static_cast<int>(ota_err));
return static_cast<int>(ota_err);
return (ESP32_OTA_ERROR_BASE + static_cast<int>(ota_err));
}

/* Download the OTA file from the web storage location. */
int const ota_download = ota.download(ota_url);
if (ota_download <= 0)
{
DEBUG_ERROR("Arduino_ESP_OTA::download() failed with %d", ota_download);
return ota_download;
return (ESP32_OTA_ERROR_BASE + ota_download);
}
DEBUG_VERBOSE("Arduino_ESP_OTA::download() %d bytes downloaded", static_cast<int>(ota_download));

/* Verify update integrity and apply */
if ((ota_err = ota.update()) != Arduino_ESP32_OTA::Error::None)
{
DEBUG_ERROR("Arduino_ESP_OTA::update() failed with %d", static_cast<int>(ota_err));
return static_cast<int>(ota_err);
return (ESP32_OTA_ERROR_BASE + static_cast<int>(ota_err));
}

/* Perform the reset to reboot */
Expand Down
1 change: 1 addition & 0 deletions src/utility/ota/OTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
******************************************************************************/

#define RP2040_OTA_ERROR_BASE (-100)
#define ESP32_OTA_ERROR_BASE (-300)

/******************************************************************************
* TYPEDEF
Expand Down

0 comments on commit 5840e10

Please sign in to comment.