29
29
#include " fsp_common_api.h"
30
30
#include " r_flash_lp.h"
31
31
#include " WiFiS3.h"
32
+ #include " OTA.h"
32
33
33
34
/* *****************************************************************************
34
35
* DEFINES
@@ -99,23 +100,23 @@ int unor4_onOTARequest(char const * ota_url)
99
100
if ((ota_err = ota.begin (" /update.bin" )) != OTAUpdate::Error::None)
100
101
{
101
102
DEBUG_ERROR (" OTAUpdate::begin() failed with %d" , static_cast <int >(ota_err));
102
- return static_cast <int >(ota_err);
103
+ return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast <int >(ota_err) );
103
104
}
104
105
105
106
/* Download the OTA file from the web storage location. */
106
107
int const ota_download = ota.download (ota_url," /update.bin" );
107
108
if (ota_download <= 0 )
108
109
{
109
110
DEBUG_ERROR (" OTAUpdate::download() failed with %d" , ota_download);
110
- return ota_download;
111
+ return (UNO_WIFI_R4_OTA_ERROR_BASE + ota_download) ;
111
112
}
112
113
DEBUG_VERBOSE (" OTAUpdate::download() %d bytes downloaded" , static_cast <int >(ota_download));
113
114
114
115
/* Verify update integrity */
115
116
if ((ota_err = ota.verify ()) != OTAUpdate::Error::None)
116
117
{
117
118
DEBUG_ERROR (" OTAUpdate::verify() failed with %d" , static_cast <int >(ota_err));
118
- return static_cast <int >(ota_err);
119
+ return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast <int >(ota_err) );
119
120
}
120
121
121
122
/* Store update size and write OTA magin number */
@@ -125,7 +126,7 @@ int unor4_onOTARequest(char const * ota_url)
125
126
if ((ota_err = ota.update (" /update.bin" )) != OTAUpdate::Error::None)
126
127
{
127
128
DEBUG_ERROR (" OTAUpdate::update() failed with %d" , static_cast <int >(ota_err));
128
- return static_cast <int >(ota_err);
129
+ return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast <int >(ota_err) );
129
130
}
130
131
131
132
return static_cast <int >(OTAUpdate::Error::None);
0 commit comments