File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -830,7 +830,8 @@ void ArduinoIoTCloudTCP::onOTARequest()
830830#endif
831831
832832#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
833- _ota_error = portenta_h7_onOTARequest (_ota_url.c_str ());
833+ bool const use_ethernet = _connection->getInterface () == NetworkAdapter::ETHERNET ? true : false ;
834+ _ota_error = portenta_h7_onOTARequest (_ota_url.c_str (), use_ethernet);
834835#endif
835836}
836837#endif
Original file line number Diff line number Diff line change 2626#include < Arduino_DebugUtils.h>
2727#include < Arduino_Portenta_OTA.h>
2828
29+ #include < WiFi.h>
30+ #include < Ethernet.h>
31+
2932#include " ../watchdog/Watchdog.h"
3033
3134/* *****************************************************************************
3235 * FUNCTION DEFINITION
3336 ******************************************************************************/
3437
35- int portenta_h7_onOTARequest (char const * ota_url)
38+ int portenta_h7_onOTARequest (char const * ota_url, bool use_ethernet )
3639{
3740 watchdog_reset ();
3841
@@ -61,7 +64,13 @@ int portenta_h7_onOTARequest(char const * ota_url)
6164 watchdog_reset ();
6265
6366 /* Download the OTA file from the web storage location. */
64- int const ota_portenta_qspi_download_ret_code = ota_portenta_qspi.download (ota_url, true /* is_https */ );
67+ MbedSocketClass * download_socket = static_cast <MbedSocketClass*>(&WiFi);
68+ #if defined (ARDUINO_PORTENTA_H7_M7)
69+ if (use_ethernet) {
70+ download_socket = static_cast <MbedSocketClass*>(&Ethernet);
71+ }
72+ #endif
73+ int const ota_portenta_qspi_download_ret_code = ota_portenta_qspi.download (ota_url, true /* is_https */ , download_socket);
6574 DEBUG_VERBOSE (" Arduino_Portenta_OTA_QSPI::download(%s) returns %d" , ota_url, ota_portenta_qspi_download_ret_code);
6675
6776 watchdog_reset ();
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ int rp2040_connect_onOTARequest(char const * ota_url);
6363#endif
6464
6565#if defined(ARDUINO_PORTENTA_H7_M7 ) || defined(ARDUINO_NICLA_VISION )
66- int portenta_h7_onOTARequest (char const * ota_url );
66+ int portenta_h7_onOTARequest (char const * ota_url , bool use_ethernet );
6767#endif
6868
6969#endif /* ARDUINO_OTA_LOGIC_H_ */
You can’t perform that action at this time.
0 commit comments