File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 30
30
31
31
#include < esp_ota_ops.h>
32
32
33
+ /* *****************************************************************************
34
+ * DEFINES
35
+ ******************************************************************************/
36
+
37
+ #define ESP32_OTA_ERROR_BASE (-300 )
38
+
33
39
/* *****************************************************************************
34
40
* FUNCTION DEFINITION
35
41
******************************************************************************/
@@ -43,23 +49,23 @@ int esp32_onOTARequest(char const * ota_url)
43
49
if ((ota_err = ota.begin ()) != Arduino_ESP32_OTA::Error::None)
44
50
{
45
51
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) );
47
53
}
48
54
49
55
/* Download the OTA file from the web storage location. */
50
56
int const ota_download = ota.download (ota_url);
51
57
if (ota_download <= 0 )
52
58
{
53
59
DEBUG_ERROR (" Arduino_ESP_OTA::download() failed with %d" , ota_download);
54
- return ota_download;
60
+ return (ESP32_OTA_ERROR_BASE + ota_download) ;
55
61
}
56
62
DEBUG_VERBOSE (" Arduino_ESP_OTA::download() %d bytes downloaded" , static_cast <int >(ota_download));
57
63
58
64
/* Verify update integrity and apply */
59
65
if ((ota_err = ota.update ()) != Arduino_ESP32_OTA::Error::None)
60
66
{
61
67
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) );
63
69
}
64
70
65
71
/* Perform the reset to reboot */
You can’t perform that action at this time.
0 commit comments