Skip to content

Commit

Permalink
Add offset to UNO WiFi R4 OTA error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam committed Oct 16, 2023
1 parent 5840e10 commit 4378a9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/utility/ota/OTA-unor4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,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 +125,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
5 changes: 3 additions & 2 deletions src/utility/ota/OTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
* DEFINES
******************************************************************************/

#define RP2040_OTA_ERROR_BASE (-100)
#define ESP32_OTA_ERROR_BASE (-300)
#define RP2040_OTA_ERROR_BASE (-100)
#define ESP32_OTA_ERROR_BASE (-300)
#define UNO_WIFI_R4_OTA_ERROR_BASE (-400)

/******************************************************************************
* TYPEDEF
Expand Down

0 comments on commit 4378a9c

Please sign in to comment.