Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add offset to UNO WiFi R4 OTA error codes #391

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 6 additions & 4 deletions src/utility/ota/OTA-unor4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#define OTA_MAGIC (*((volatile uint16_t *) &R_SYSTEM->VBTBKR[4]))
#define OTA_SIZE (*((volatile uint32_t *) &R_SYSTEM->VBTBKR[6]))

#define UNO_WIFI_R4_OTA_ERROR_BASE (-400)

/******************************************************************************
* FUNCTION DEFINITION
******************************************************************************/
Expand Down Expand Up @@ -99,23 +101,23 @@ int unor4_onOTARequest(char const * ota_url)
if ((ota_err = ota.begin("/update.bin")) != OTAUpdate::Error::None)
{
DEBUG_ERROR("OTAUpdate::begin() failed with %d", static_cast<int>(ota_err));
return static_cast<int>(ota_err);
return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast<int>(ota_err));
}

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

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

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

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