File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 3030
3131#include < esp_ota_ops.h>
3232
33+ /* *****************************************************************************
34+ * DEFINES
35+ ******************************************************************************/
36+
37+ #define ESP32_OTA_ERROR_BASE (-300 )
38+
3339/* *****************************************************************************
3440 * FUNCTION DEFINITION
3541 ******************************************************************************/
@@ -43,23 +49,23 @@ int esp32_onOTARequest(char const * ota_url)
4349 if ((ota_err = ota.begin ()) != Arduino_ESP32_OTA::Error::None)
4450 {
4551 DEBUG_ERROR (" Arduino_ESP32_OTA::begin() failed with %d" , static_cast <int >(ota_err));
46- return static_cast <int >(ota_err);
52+ return (ESP32_OTA_ERROR_BASE + static_cast <int >(ota_err) );
4753 }
4854
4955 /* Download the OTA file from the web storage location. */
5056 int const ota_download = ota.download (ota_url);
5157 if (ota_download <= 0 )
5258 {
5359 DEBUG_ERROR (" Arduino_ESP_OTA::download() failed with %d" , ota_download);
54- return ota_download;
60+ return (ESP32_OTA_ERROR_BASE + ota_download) ;
5561 }
5662 DEBUG_VERBOSE (" Arduino_ESP_OTA::download() %d bytes downloaded" , static_cast <int >(ota_download));
5763
5864 /* Verify update integrity and apply */
5965 if ((ota_err = ota.update ()) != Arduino_ESP32_OTA::Error::None)
6066 {
6167 DEBUG_ERROR (" Arduino_ESP_OTA::update() failed with %d" , static_cast <int >(ota_err));
62- return static_cast <int >(ota_err);
68+ return (ESP32_OTA_ERROR_BASE + static_cast <int >(ota_err) );
6369 }
6470
6571 /* Perform the reset to reboot */
You can’t perform that action at this time.
0 commit comments