From 4378a9c2a24e9d9c646afff8024e0fc11cfba8d4 Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 16 Oct 2023 13:03:57 +0200 Subject: [PATCH] Add offset to UNO WiFi R4 OTA error codes --- src/utility/ota/OTA-unor4.cpp | 8 ++++---- src/utility/ota/OTA.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/utility/ota/OTA-unor4.cpp b/src/utility/ota/OTA-unor4.cpp index 34c417b0..ed8334a2 100644 --- a/src/utility/ota/OTA-unor4.cpp +++ b/src/utility/ota/OTA-unor4.cpp @@ -99,7 +99,7 @@ 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(ota_err)); - return static_cast(ota_err); + return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast(ota_err)); } /* Download the OTA file from the web storage location. */ @@ -107,7 +107,7 @@ int unor4_onOTARequest(char const * ota_url) 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(ota_download)); @@ -115,7 +115,7 @@ int unor4_onOTARequest(char const * ota_url) if ((ota_err = ota.verify()) != OTAUpdate::Error::None) { DEBUG_ERROR("OTAUpdate::verify() failed with %d", static_cast(ota_err)); - return static_cast(ota_err); + return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast(ota_err)); } /* Store update size and write OTA magin number */ @@ -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(ota_err)); - return static_cast(ota_err); + return (UNO_WIFI_R4_OTA_ERROR_BASE + static_cast(ota_err)); } return static_cast(OTAUpdate::Error::None); diff --git a/src/utility/ota/OTA.h b/src/utility/ota/OTA.h index 8451e2e7..735300f9 100644 --- a/src/utility/ota/OTA.h +++ b/src/utility/ota/OTA.h @@ -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