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