From 24c33dea6c37a13a446b2e9bdad64c499cf3a0bc Mon Sep 17 00:00:00 2001
From: Andrea Gilardoni <a.gilardoni@arduino.cc>
Date: Mon, 15 Jan 2024 17:04:41 +0100
Subject: [PATCH] changing download to downloadAndDecompress for mbed core

---
 src/utility/ota/OTA-portenta-h7.cpp | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/utility/ota/OTA-portenta-h7.cpp b/src/utility/ota/OTA-portenta-h7.cpp
index bd95f6a6b..1d7ecf3a7 100644
--- a/src/utility/ota/OTA-portenta-h7.cpp
+++ b/src/utility/ota/OTA-portenta-h7.cpp
@@ -80,22 +80,11 @@ int portenta_h7_onOTARequest(char const * ota_url, NetworkAdapter iface)
     download_socket = static_cast<MbedSocketClass*>(&Ethernet);
   }
 #endif
-  int const ota_portenta_qspi_download_ret_code = ota_portenta_qspi.download(ota_url, true /* is_https */, download_socket);
+  int const ota_portenta_qspi_download_ret_code = ota_portenta_qspi.downloadAndDecompress(ota_url, true /* is_https */, download_socket);
   DEBUG_VERBOSE("Arduino_Portenta_OTA_QSPI::download(%s) returns %d", ota_url, ota_portenta_qspi_download_ret_code);
 
   watchdog_reset();
 
-  /* Decompress the LZSS compressed OTA file. */
-  int const ota_portenta_qspi_decompress_ret_code = ota_portenta_qspi.decompress();
-  DEBUG_VERBOSE("Arduino_Portenta_OTA_QSPI::decompress() returns %d", ota_portenta_qspi_decompress_ret_code);
-  if (ota_portenta_qspi_decompress_ret_code < 0)
-  {
-    DEBUG_ERROR("Arduino_Portenta_OTA_QSPI::decompress() failed with %d", ota_portenta_qspi_decompress_ret_code);
-    return ota_portenta_qspi_decompress_ret_code;
-  }
-
-  watchdog_reset();
-
   /* Schedule the firmware update. */
   if((ota_portenta_err = ota_portenta_qspi.update()) != Arduino_Portenta_OTA::Error::None) {
     DEBUG_ERROR("Arduino_Portenta_OTA_QSPI::update() failed with %d", static_cast<int>(ota_portenta_err));