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#ifdef BOARD_STM32H7
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 2828#include < Arduino_DebugUtils.h>
2929#include < Arduino_Portenta_OTA.h>
3030
31+ #include < WiFi.h>
32+ #include < Ethernet.h>
33+
3134#include " ../watchdog/Watchdog.h"
3235
3336/* *****************************************************************************
3437 * FUNCTION DEFINITION
3538 ******************************************************************************/
3639
37- int portenta_h7_onOTARequest (char const * ota_url)
40+ int portenta_h7_onOTARequest (char const * ota_url, bool use_ethernet )
3841{
3942 watchdog_reset ();
4043
@@ -63,7 +66,13 @@ int portenta_h7_onOTARequest(char const * ota_url)
6366 watchdog_reset ();
6467
6568 /* Download the OTA file from the web storage location. */
66- int const ota_portenta_qspi_download_ret_code = ota_portenta_qspi.download (ota_url, true /* is_https */ );
69+ MbedSocketClass * download_socket = static_cast <MbedSocketClass*>(&WiFi);
70+ #if defined (ARDUINO_PORTENTA_H7_M7)
71+ if (use_ethernet) {
72+ download_socket = static_cast <MbedSocketClass*>(&Ethernet);
73+ }
74+ #endif
75+ int const ota_portenta_qspi_download_ret_code = ota_portenta_qspi.download (ota_url, true /* is_https */ , download_socket);
6776 DEBUG_VERBOSE (" Arduino_Portenta_OTA_QSPI::download(%s) returns %d" , ota_url, ota_portenta_qspi_download_ret_code);
6877
6978 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#ifdef BOARD_STM32H7
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