From 5282558da8e18fda884634ec5806a4ab03b3fc54 Mon Sep 17 00:00:00 2001 From: Juraj Andrassy Date: Sat, 21 Oct 2023 07:21:13 +0200 Subject: [PATCH] support all network interfaces of the Pico Core (RP2040) --- README.md | 1 + src/ArduinoOTA.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e8bd713..4bdfb7e 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ The library is a modification of the Arduino WiFi101OTA library. * WiFiS3 library of Arduino Uno R4 WiFi * WiFiEspAT - esp8266 or ESP32 as network adapter with AT firmware * EthernetENC - shields and modules with ENC28j60 chip +* WiFi library of the Pico Core including its Ethernet network interfaces EthernetENC library doesn't support UDP multicast for MDNS, so Arduino IDE will not show the network upload port. diff --git a/src/ArduinoOTA.h b/src/ArduinoOTA.h index 3b35bcd..5a88899 100644 --- a/src/ArduinoOTA.h +++ b/src/ArduinoOTA.h @@ -64,7 +64,7 @@ class ArduinoOTAClass : public WiFiOTAClass { void end() { #if defined(_WIFI_ESP_AT_H_)|| defined(WiFiS3_h) || defined(ESP32) || defined(UIPETHERNET_H) server.end(); -#elif defined(ESP8266) +#elif defined(ESP8266) || (defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED)) server.stop(); #else //#warning "The networking library doesn't have a function to stop the server" @@ -128,7 +128,7 @@ ArduinoOTAMdnsClass ArduinoOTA; #elif defined(UIPETHERNET_H) // no UDP multicast implementation yet ArduinoOTAClass ArduinoOTA; -#elif defined(WiFiNINA_h) || defined(WIFI_H) || defined(WiFiS3_h) || defined(ESP8266) || defined(ESP32) || defined(ARDUINO_RASPBERRY_PI_PICO_W) // NINA, WiFi101 and Espressif WiFi +#elif defined(WiFiNINA_h) || defined(WIFI_H) || defined(WiFiS3_h) || defined(ESP8266) || defined(ESP32) // NINA, WiFi101 and Espressif WiFi #ifdef NO_OTA_PORT ArduinoOTAClass ArduinoOTA; #else @@ -145,6 +145,14 @@ ArduinoOTAClass ArduinoOTA; #elif defined(_WIFISPI_H_INCLUDED) // no UDP multicast implementation ArduinoOTAClass ArduinoOTA; +#elif defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED) +#ifdef NO_OTA_PORT +ArduinoOTAClass ArduinoOTA; +#else +#include +ArduinoOTAMdnsClass ArduinoOTA; +#endif + #else #warning "Network library not included or not supported" #endif