Skip to content

Commit 5d206df

Browse files
committed
Add offset to UNO WiFi R4 OTA error codes
1 parent 5840e10 commit 5d206df

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,23 @@ int unor4_onOTARequest(char const * ota_url)
9999
if ((ota_err = ota.begin("/update.bin")) != OTAUpdate::Error::None)
100100
{
101101
DEBUG_ERROR("OTAUpdate::begin() failed with %d", static_cast<int>(ota_err));
102-
return static_cast<int>(ota_err);
102+
return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast<int>(ota_err));
103103
}
104104

105105
/* Download the OTA file from the web storage location. */
106106
int const ota_download = ota.download(ota_url,"/update.bin");
107107
if (ota_download <= 0)
108108
{
109109
DEBUG_ERROR("OTAUpdate::download() failed with %d", ota_download);
110-
return ota_download;
110+
return (UNO_WIFI_R4_OTA_ERROR_BASE + ota_download);
111111
}
112112
DEBUG_VERBOSE("OTAUpdate::download() %d bytes downloaded", static_cast<int>(ota_download));
113113

114114
/* Verify update integrity */
115115
if ((ota_err = ota.verify()) != OTAUpdate::Error::None)
116116
{
117117
DEBUG_ERROR("OTAUpdate::verify() failed with %d", static_cast<int>(ota_err));
118-
return static_cast<int>(ota_err);
118+
return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast<int>(ota_err));
119119
}
120120

121121
/* Store update size and write OTA magin number */
@@ -125,7 +125,7 @@ int unor4_onOTARequest(char const * ota_url)
125125
if ((ota_err = ota.update("/update.bin")) != OTAUpdate::Error::None)
126126
{
127127
DEBUG_ERROR("OTAUpdate::update() failed with %d", static_cast<int>(ota_err));
128-
return static_cast<int>(ota_err);
128+
return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast<int>(ota_err));
129129
}
130130

131131
return static_cast<int>(OTAUpdate::Error::None);

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
* DEFINES
3333
******************************************************************************/
3434

35-
#define RP2040_OTA_ERROR_BASE (-100)
36-
#define ESP32_OTA_ERROR_BASE (-300)
35+
#define RP2040_OTA_ERROR_BASE (-100)
36+
#define ESP32_OTA_ERROR_BASE (-300)
37+
#define UNO_WIFI_R4_OTA_ERROR_BASE (-400)
3738

3839
/******************************************************************************
3940
* TYPEDEF

0 commit comments

Comments
 (0)