Skip to content

UNO R4 WiFi OTA: adapt code to handle new and old return values from OTAUpdate core library #427

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/utility/ota/OTA-unor4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ static int unor4_codeFlashClose(flash_lp_instance_ctrl_t * ctrl)

int unor4_onOTARequest(char const * ota_url)
{
OTAUpdate::Error ota_err = OTAUpdate::Error::None;
int ota_err = static_cast<int>(OTAUpdate::Error::None);
OTAUpdate ota;

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

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

/* Verify update integrity */
if ((ota_err = ota.verify()) != OTAUpdate::Error::None)
if ((ota_err = static_cast<int>(ota.verify())) != static_cast<int>(OTAUpdate::Error::None))
{
DEBUG_ERROR("OTAUpdate::verify() failed with %d", static_cast<int>(ota_err));
return static_cast<int>(ota_err);
DEBUG_ERROR("OTAUpdate::verify() failed with %d", ota_err);
return ota_err;
}

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

/* Flash new firmware */
if ((ota_err = ota.update("/update.bin")) != OTAUpdate::Error::None)
if ((ota_err = static_cast<int>(ota.update("/update.bin"))) != static_cast<int>(OTAUpdate::Error::None))
{
DEBUG_ERROR("OTAUpdate::update() failed with %d", static_cast<int>(ota_err));
return static_cast<int>(ota_err);
DEBUG_ERROR("OTAUpdate::update() failed with %d", ota_err);
return ota_err;
}

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