- Notifications
You must be signed in to change notification settings - Fork148
Open
Labels
Description
Would be nice to refresh the pro version to include latest OSS changes.
Here is a patch: mostly for: CI, project descriptors and includes / macros.
Nothing exposed from pro internals
From d7d23e4cdbcfd3e11c4e1399416e9f34929fea67 Mon Sep 17 00:00:00 2001From: Mathieu Carbou <mathieu.carbou@gmail.com>Date: Tue, 30 Sep 2025 10:32:44 +0200Subject: [PATCH] CI--- .github/workflows/ci.yml | 199 +++++++++++++++++++------------ examples/AsyncDemo/AsyncDemo.ino | 15 ++- examples/Demo/Demo.ino | 19 +-- library.json | 4 +- platformio.ini | 101 ++++++++++++---- src/ElegantOTAPro.cpp | 4 +- src/ElegantOTAPro.h | 26 ++-- 7 files changed, 245 insertions(+), 123 deletions(-)diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 761a525..27c1b50 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -1,49 +1,84 @@-name: Arduino Library CI+name: CI on:- workflow_dispatch:- # push:- # paths-ignore:- # - "**/**.md"- # - "/keywords.txt"- # - "/library.json"- # - "/library.properties"- # - "/vue-frontend"- # - "/docs"- # pull_request:- # paths-ignore:- # - "**/**.md"- # - "/keywords.txt"- # - "/library.json"- # - "/library.properties"- # - "/vue-frontend"- # - "/docs"+ push:+ paths-ignore:+ - "**/**.md"+ - "LICENSE"+ - "keywords.txt"+ - "library.json"+ - "library.properties"+ - "portal"+ - "docs/*"+ pull_request:+ paths-ignore:+ - "**/**.md"+ - "LICENSE"+ - "keywords.txt"+ - "library.json"+ - "library.properties"+ - "portal"+ - "docs/*"++concurrency:+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ cancel-in-progress: true jobs:+ check-directives:+ name: Check Preprocessor Directives+ runs-on: ubuntu-latest+ env:+ HEADER_FILE: src/ElegantOTAPro.h+ steps:+ - name: Checkout Repository+ uses: actions/checkout@v4+ - name: Check ELEGANTOTA_USE_ASYNC_WEBSERVER+ env:+ DIRECTIVE: ELEGANTOTA_USE_ASYNC_WEBSERVER+ EXPECTED_VALUE: 0+ run: |+ if [ ! -f "$HEADER_FILE" ]; then+ echo "$HEADER_FILE not found!" && exit 1+ fi+ if ! grep -Eq "#define[[:space:]]+$DIRECTIVE[[:space:]]+$EXPECTED_VALUE([[:space:]]+|$)" "$HEADER_FILE"; then+ echo "$DIRECTIVE is not set to $EXPECTED_VALUE!" && exit 1+ fi+ echo "Preprocessor directive is correctly set to $EXPECTED_VALUE."+ arduino:- name: arduino ${{ matrix.name }}+ name: Arduino - ${{ matrix.name }}+ needs: check-directives runs-on: ubuntu-latest strategy: fail-fast: false matrix: include:- - name: package_esp32_index.json+ - name: ESP8266+ core: esp8266:esp8266+ board: esp8266:esp8266:huzzah+ index_url: https://arduino.esp8266.com/stable/package_esp8266com_index.json++ - name: ESP32 core: esp32:esp32 board: esp32:esp32:esp32 index_url: https://espressif.github.io/arduino-esp32/package_esp32_index.json- - name: package_esp32_dev_index.json++ - name: ESP32 (Dev Branch) core: esp32:esp32 board: esp32:esp32:esp32 index_url: https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json- - name: package_esp8266com_index.json- core: esp8266:esp8266- board: esp8266:esp8266:huzzah- index_url: https://arduino.esp8266.com/stable/package_esp8266com_index.json- - name: package_rp2040_index.json++ - name: Pico W | RP2040+W core: rp2040:rp2040 board: rp2040:rp2040:rpipicow index_url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json-++ - name: Pico 2W | RP2350+W+ core: rp2040:rp2040+ board: rp2040:rp2040:rpipico2w+ index_url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json+ steps: - name: Checkout uses: actions/checkout@v4@@ -62,79 +97,95 @@ jobs: - name: Install core run: arduino-cli core install --additional-urls "${{ matrix.index_url }}" ${{ matrix.core }}- - name: Install AsyncTCP- run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/AsyncTCP#v3.1.4+ - name: Install AsyncTCP (ESP32)+ if: ${{ matrix.core == 'esp32:esp32' }}+ run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/AsyncTCP#v3.4.8++ - name: Install ESPAsyncTCP (ESP8266)+ if: ${{ matrix.core == 'esp8266:esp8266' }}+ run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/ESPAsyncTCP#v2.0.0- - name: Install ESPAsyncTCP- run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/esphome-ESPAsyncTCP#v2.0.0+ - name: Install RPAsyncTCP (RP2040)+ if: ${{ matrix.core == 'rp2040:rp2040' }}+ run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ayushsharma82/RPAsyncTCP#v1.3.2 - name: Install ESPAsyncWebServer- run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/ESPAsyncWebServer#v3.0.4+ run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/ESPAsyncWebServer#v3.8.1 - name: Build Demo run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/Demo/Demo.ino" - name: Configure ElegantOTA to Async Mode- if: ${{ matrix.core != 'rp2040:rp2040' }} run: | cd src sed -i 's/ELEGANTOTA_USE_ASYNC_WEBSERVER 0/ELEGANTOTA_USE_ASYNC_WEBSERVER 1/' ElegantOTAPro.h - name: Build AsyncDemo- if: ${{ matrix.core != 'rp2040:rp2040' }} run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/AsyncDemo/AsyncDemo.ino" platformio:- name: pio ${{ matrix.name }}+ name: PlatformIO - ${{ matrix.name }} runs-on: ubuntu-latest+ needs: check-directives strategy: fail-fast: false matrix: include:- - name: esp32dev|arduino- board: esp32dev- platform: espressif32- opts: "--project-option 'lib_compat_mode = strict'"- - name: esp32dev|arduino-2+ - name: ESP8266 (Huzzah)+ env: ci-esp8266+ board: huzzah++ - name: ESP8266 (D1 Mini)+ env: ci-esp8266+ board: d1_mini++ - name: ESP32 (Arduino Core v2)+ env: ci-esp32-arduino-2 board: esp32dev- platform: espressif32@6.7.0- opts: "--project-option 'lib_compat_mode = strict'"- - name: esp32dev|arduino-3++ - name: ESP32+ env: ci-esp32 board: esp32dev- platform: espressif32- opts: "--project-option 'lib_compat_mode = strict' --project-option 'platform_packages=platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2, platform_packages=platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip'"- - name: esp32-s3-devkitc-1|arduino- board: esp32-s3-devkitc-1- platform: espressif32- opts: "--project-option 'lib_compat_mode = strict'"- - name: esp32-s3-devkitc-1|arduino-2++ - name: ESP32-S2+ env: ci-esp32+ board: esp32-s2-saola-1++ - name: ESP32-S3+ env: ci-esp32 board: esp32-s3-devkitc-1- platform: espressif32@6.7.0- opts: "--project-option 'lib_compat_mode = strict'"- - name: esp32-s3-devkitc-1|arduino-3- board: esp32-s3-devkitc-1- platform: espressif32- opts: "--project-option 'lib_compat_mode = strict' --project-option 'platform_packages=platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2, platform_packages=platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip'"- - name: huzzah|espressif8266- board: huzzah- platform: espressif8266- opts: "--project-option 'lib_compat_mode = strict'"++ - name: ESP32-C3+ env: ci-esp32+ board: esp32-c3-devkitc-02++ - name: ESP32-C6+ env: ci-esp32+ board: esp32-c6-devkitc-1++ - name: Pico W | RP2040+W+ env: ci-rp2040+ board: rpipicow+ platform: https://github.com/maxgerhardt/platform-raspberrypi.git+ opts: "--project-option 'board_build.core=earlephilhower'"++ - name: Pico 2W | RP2350+W+ env: ci-rp2350+ board: rpipico2w+ platform: https://github.com/maxgerhardt/platform-raspberrypi.git+ opts: "--project-option 'board_build.core=earlephilhower'" steps: - uses: actions/checkout@v4- - name: Set up cache- uses: actions/cache@v4- with:- path: |- ~/.platformio- ~/.cache/pip- key: ${{ matrix.name }}- - uses: actions/setup-python@v5++ - name: Setup Python+ uses: actions/setup-python@v5 with: python-version: "3.x"- - name: Install PlatformIO- run: pip install platformio- - name: Install Platform- run: platformio platform install ${{ matrix.platform }}- - run: platformio ci "examples/Demo/Demo.ino" -l '.' -b ${{ matrix.board }} ${{ matrix.opts }}- - run: PLATFORMIO_BUILD_FLAGS="-DELEGANTOTA_USE_ASYNC_WEBSERVER=1" platformio ci "examples/AsyncDemo/AsyncDemo.ino" -l '.' -b ${{ matrix.board }} ${{ matrix.opts }}+ - name: Setup PlatformIO+ run: |+ python -m pip install --upgrade pip+ pip install --upgrade platformio++ - run: PLATFORMIO_SRC_DIR=examples/Demo PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}+ - run: PLATFORMIO_BUILD_FLAGS="-DELEGANTOTA_USE_ASYNC_WEBSERVER=1" PLATFORMIO_SRC_DIR=examples/AsyncDemo PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}\ No newline at end of filediff --git a/examples/AsyncDemo/AsyncDemo.ino b/examples/AsyncDemo/AsyncDemo.inoindex a71e88a..ce86abd 100644--- a/examples/AsyncDemo/AsyncDemo.ino+++ b/examples/AsyncDemo/AsyncDemo.ino@@ -14,12 +14,20 @@ Github: https://github.com/ayushsharma82/ElegantOTA WiKi: https://docs.elegantota.pro- Works with both ESP8266 & ESP32+ Works with:+ - ESP8266+ - ESP32+ - RP2040 (with WiFi) (Example: Raspberry Pi Pico W)+ - RP2350 (with WiFi) (Example: Raspberry Pi Pico 2W)++ Important note for RP2040/RP2350 users:+ - RP2040/RP2350 requires LittleFS partition for the OTA updates to work. Without LittleFS partition, OTA updates will fail.+ Make sure to select Tools > Flash Size > "2MB (Sketch 1MB, FS 1MB)" option.+ - If using bare RP2040/RP2350, it requires a WiFi chip like Pico W/Pico 2W for ElegantOTA to work. ------------------------------- Upgrade to ElegantOTA Pro: https://elegantota.pro- */ #if defined(ESP8266)@@ -28,6 +36,9 @@ #elif defined(ESP32) #include <WiFi.h> #include <AsyncTCP.h>+#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)+ #include <WiFi.h>+ #include <RPAsyncTCP.h> #endif #include <ESPAsyncWebServer.h>diff --git a/examples/Demo/Demo.ino b/examples/Demo/Demo.inoindex 7e41bc6..d883446 100644--- a/examples/Demo/Demo.ino+++ b/examples/Demo/Demo.ino@@ -14,17 +14,16 @@ - ESP8266 - ESP32 - RP2040 (with WiFi) (Example: Raspberry Pi Pico W)+ - RP2350 (with WiFi) (Example: Raspberry Pi Pico 2W)-- Important note for RP2040 users:- - RP2040 requires LittleFS partition for the OTA updates to work. Without LittleFS partition, OTA updates will fail.+ Important note for RP2040/RP2350 users:+ - RP2040/RP2350 requires LittleFS partition for the OTA updates to work. Without LittleFS partition, OTA updates will fail. Make sure to select Tools > Flash Size > "2MB (Sketch 1MB, FS 1MB)" option.- - If using bare RP2040, it requires WiFi module like Pico W for ElegantOTA to work.+ - If using bare RP2040/RP2350, it requires a WiFi chip like Pico W/Pico 2W for ElegantOTA to work. ------------------------------- Upgrade to ElegantOTA Pro: https://elegantota.pro- */@@ -36,21 +35,23 @@ #include <WiFi.h> #include <WiFiClient.h> #include <WebServer.h>-#elif defined(TARGET_RP2040)+#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350) #include <WiFi.h>+ #include <WiFiClient.h>+ #include <WiFiServer.h> #include <WebServer.h> #endif #include <ElegantOTAPro.h>-const char* ssid = "........";-const char* password = "........";+const char* ssid = "";+const char* password = ""; #if defined(ESP8266) ESP8266WebServer server(80); #elif defined(ESP32) WebServer server(80);-#elif defined(TARGET_RP2040)+#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350) WebServer server(80); #endifdiff --git a/library.json b/library.jsonindex 8c6f0de..36fdd90 100644--- a/library.json+++ b/library.json@@ -17,9 +17,9 @@ ], "dependencies": [ {- "owner": "mathieucarbou",+ "owner": "esp32async", "name": "ESPAsyncWebServer",- "version": "^3.1.1",+ "version": "^3.8.1", "platforms": ["espressif8266", "espressif32", "raspberrypi"] } ],diff --git a/platformio.ini b/platformio.iniindex c729d85..e33489f 100644--- a/platformio.ini+++ b/platformio.ini@@ -4,44 +4,97 @@ build_flags = -Wall -Wextra -D CONFIG_ARDUHAL_LOG_COLORS -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG- -D ELEGANTOTA_USE_ASYNC_WEBSERVER=1 lib_deps =- mathieucarbou/AsyncTCP@^3.2.3- mathieucarbou/ESPAsyncWebServer@^3.1.1-lib_compat_mode = strict+ esp32async/ESPAsyncWebServer@^3.8.1 upload_protocol = esptool monitor_speed = 115200 monitor_filters = esp32_exception_decoder, log2file [platformio] lib_dir = .-; src_dir = examples/Demo-src_dir = examples/AsyncDemo+src_dir = examples/Demo+; src_dir = examples/AsyncDemo-[env:arduino]-platform = espressif32-board = esp32-s3-devkitc-1--[env:arduino-2]-platform = espressif32@6.7.0-board = esp32-s3-devkitc-1--[env:arduino-3]-platform = espressif32-platform_packages=- platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.3- platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.3/esp32-arduino-libs-3.0.3.zip+[env:esp32]+build_flags = ${env.build_flags}+platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip board = esp32-s3-devkitc-1+lib_deps =+ esp32async/AsyncTCP@^3.4.8+ ${env.lib_deps} [env:esp8266] platform = espressif8266 board = huzzah lib_deps =- mathieucarbou/ESPAsyncWebServer@^3.1.1- esphome/ESPAsyncTCP-esphome@^2.0.0+ esp32async/ESPAsyncTCP@^2.0.0+ ${env.lib_deps}++[env:picow]+platform = https://github.com/maxgerhardt/platform-raspberrypi.git+board = rpipicow+framework = arduino+board_build.core = earlephilhower+lib_deps =+ ayushsharma82/RPAsyncTCP@^1.3.2+ ${env.lib_deps}+lib_ignore =+ lwIP_ESPHost++[env:pico2w]+platform = https://github.com/maxgerhardt/platform-raspberrypi.git+board = rpipico2w+framework = arduino+board_build.core = earlephilhower+lib_deps =+ ayushsharma82/RPAsyncTCP@^1.3.2+ ${env.lib_deps}+lib_ignore =+ lwIP_ESPHost-[env:pico]+; ------------+; CI Workflows+; ------------++[env:ci-esp8266]+platform = espressif8266+board = ${sysenv.PIO_BOARD}+lib_deps =+ esp32async/ESPAsyncTCP@^2.0.0+ ${env.lib_deps}++[env:ci-esp32-arduino-2]+platform = espressif32@6.7.0+board = ${sysenv.PIO_BOARD}+lib_deps =+ esp32async/AsyncTCP@^3.4.8+ ${env.lib_deps}++[env:ci-esp32]+platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip+board = ${sysenv.PIO_BOARD}+lib_deps =+ esp32async/AsyncTCP@^3.4.8+ ${env.lib_deps}++[env:ci-rp2040] platform = https://github.com/maxgerhardt/platform-raspberrypi.git-board = pico+board = rpipicow framework = arduino-board_build.core = earlephilhower\ No newline at end of file+board_build.core = earlephilhower+lib_deps =+ ayushsharma82/RPAsyncTCP@^1.3.2+ ${env.lib_deps}+lib_ignore =+ lwIP_ESPHost++[env:ci-rp2350]+platform = https://github.com/maxgerhardt/platform-raspberrypi.git+board = rpipico2w+framework = arduino+board_build.core = earlephilhower+lib_deps =+ ayushsharma82/RPAsyncTCP@^1.3.2+ ${env.lib_deps}+lib_ignore =+ lwIP_ESPHost\ No newline at end of filediff --git a/src/ElegantOTAPro.cpp b/src/ElegantOTAPro.cppindex bcd3606..afd0416 100644--- a/src/ElegantOTAPro.cpp+++ b/src/ElegantOTAPro.cpp@@ -294,9 +294,9 @@ void ElegantOTAClass::begin(ELEGANTOTA_WEBSERVER *server, const char * username, update_size = ((size_t)&_FS_end - (size_t)&_FS_start); LittleFS.end(); } else {- FSInfo64 i;+ FSInfo i; LittleFS.begin();- LittleFS.info64(i);+ LittleFS.info(i); update_size = i.totalBytes - i.usedBytes; } // Start update processdiff --git a/src/ElegantOTAPro.h b/src/ElegantOTAPro.hindex afc5df2..3f9385d 100644--- a/src/ElegantOTAPro.h+++ b/src/ElegantOTAPro.h@@ -73,22 +73,28 @@ _____ _ _ ___ _____ _ #define ELEGANTOTA_WEBSERVER WebServer #endif #define HARDWARE "ESP32"-#elif defined(TARGET_RP2040)+#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350) #include <functional> #include "Arduino.h"+ #include "StreamString.h" #include "FS.h" #include "LittleFS.h"- #include "WiFiClient.h"- #include "WiFiServer.h"- #include "WebServer.h"- #include "WiFiUdp.h"- #include "StreamString.h" #include "Updater.h"- #define HARDWARE "RP2040"- #define ELEGANTOTA_WEBSERVER WebServer- // Throw an error if async mode is enabled #if ELEGANTOTA_USE_ASYNC_WEBSERVER == 1- #error "Async mode is not supported on RP2040. Please set ELEGANTOTA_USE_ASYNC_WEBSERVER to 0."+ #include "RPAsyncTCP.h"+ #include "ESPAsyncWebServer.h"+ #define ELEGANTOTA_WEBSERVER AsyncWebServer+ #else+ #include "WiFiClient.h"+ #include "WiFiServer.h"+ #include "WebServer.h"+ #define ELEGANTOTA_WEBSERVER WebServer+ #endif++ #if defined(TARGET_RP2040) || defined(PICO_RP2040)+ #define HARDWARE "RP2040"+ #elif defined(TARGET_RP2350) || defined(PICO_RP2350)+ #define HARDWARE "RP2350" #endif extern uint8_t _FS_start; extern uint8_t _FS_end;