Skip to content

Commit eece612

Browse files
committed
UNO R4 WiFi OTA: adapt code to handle new and old return values from OTAUpdate core library
1 parent c2a9992 commit eece612

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/utility/ota/OTA-unor4.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ static int unor4_codeFlashClose(flash_lp_instance_ctrl_t * ctrl)
9292

9393
int unor4_onOTARequest(char const * ota_url)
9494
{
95-
OTAUpdate::Error ota_err = OTAUpdate::Error::None;
95+
int ota_err = static_cast<int>(OTAUpdate::Error::None);
9696
OTAUpdate ota;
9797

9898
/* Initialize the board for OTA handling. */
99-
if ((ota_err = ota.begin("/update.bin")) != OTAUpdate::Error::None)
99+
if ((ota_err = static_cast<int>(ota.begin("/update.bin"))) != static_cast<int>(OTAUpdate::Error::None))
100100
{
101-
DEBUG_ERROR("OTAUpdate::begin() failed with %d", static_cast<int>(ota_err));
102-
return static_cast<int>(ota_err);
101+
DEBUG_ERROR("OTAUpdate::begin() failed with %d", ota_err);
102+
return ota_err;
103103
}
104104

105105
/* Download the OTA file from the web storage location. */
@@ -109,23 +109,23 @@ int unor4_onOTARequest(char const * ota_url)
109109
DEBUG_ERROR("OTAUpdate::download() failed with %d", ota_download);
110110
return ota_download;
111111
}
112-
DEBUG_VERBOSE("OTAUpdate::download() %d bytes downloaded", static_cast<int>(ota_download));
112+
DEBUG_VERBOSE("OTAUpdate::download() %d bytes downloaded", ota_download);
113113

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

121121
/* Store update size and write OTA magin number */
122122
unor4_setOTASize(ota_download);
123123

124124
/* Flash new firmware */
125-
if ((ota_err = ota.update("/update.bin")) != OTAUpdate::Error::None)
125+
if ((ota_err = static_cast<int>(ota.update("/update.bin"))) != static_cast<int>(OTAUpdate::Error::None))
126126
{
127-
DEBUG_ERROR("OTAUpdate::update() failed with %d", static_cast<int>(ota_err));
128-
return static_cast<int>(ota_err);
127+
DEBUG_ERROR("OTAUpdate::update() failed with %d", ota_err);
128+
return ota_err;
129129
}
130130

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

0 commit comments

Comments
 (0)