Skip to content

Commit 5840e10

Browse files
committed
Add offset to ESP32 OTA error codes
1 parent 6a9acc2 commit 5840e10

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: src/utility/ota/OTA-esp32.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ int esp32_onOTARequest(char const * ota_url)
4343
if ((ota_err = ota.begin()) != Arduino_ESP32_OTA::Error::None)
4444
{
4545
DEBUG_ERROR("Arduino_ESP32_OTA::begin() failed with %d", static_cast<int>(ota_err));
46-
return static_cast<int>(ota_err);
46+
return (ESP32_OTA_ERROR_BASE + static_cast<int>(ota_err));
4747
}
4848

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

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

6565
/* Perform the reset to reboot */

Diff for: src/utility/ota/OTA.h

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
******************************************************************************/
3434

3535
#define RP2040_OTA_ERROR_BASE (-100)
36+
#define ESP32_OTA_ERROR_BASE (-300)
3637

3738
/******************************************************************************
3839
* TYPEDEF

0 commit comments

Comments
 (0)