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()
830
830
#endif
831
831
832
832
#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);
834
835
#endif
835
836
}
836
837
#endif
Original file line number Diff line number Diff line change 28
28
#include < Arduino_DebugUtils.h>
29
29
#include < Arduino_Portenta_OTA.h>
30
30
31
+ #include < WiFi.h>
32
+ #include < Ethernet.h>
33
+
31
34
#include " ../watchdog/Watchdog.h"
32
35
33
36
/* *****************************************************************************
34
37
* FUNCTION DEFINITION
35
38
******************************************************************************/
36
39
37
- int portenta_h7_onOTARequest (char const * ota_url)
40
+ int portenta_h7_onOTARequest (char const * ota_url, bool use_ethernet )
38
41
{
39
42
watchdog_reset ();
40
43
@@ -63,7 +66,13 @@ int portenta_h7_onOTARequest(char const * ota_url)
63
66
watchdog_reset ();
64
67
65
68
/* 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);
67
76
DEBUG_VERBOSE (" Arduino_Portenta_OTA_QSPI::download(%s) returns %d" , ota_url, ota_portenta_qspi_download_ret_code);
68
77
69
78
watchdog_reset ();
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ int rp2040_connect_onOTARequest(char const * ota_url);
63
63
#endif
64
64
65
65
#ifdef BOARD_STM32H7
66
- int portenta_h7_onOTARequest (char const * ota_url );
66
+ int portenta_h7_onOTARequest (char const * ota_url , bool use_ethernet );
67
67
#endif
68
68
69
69
#endif /* ARDUINO_OTA_LOGIC_H_ */
You can’t perform that action at this time.
0 commit comments