Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Async on RP2040 #170

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,31 @@ jobs:
- name: Install core
run: arduino-cli core install --additional-urls "${{ matrix.index_url }}" ${{ matrix.core }}

- name: Install AsyncTCP
- 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/mathieucarbou/AsyncTCP#v3.1.4

- name: Install ESPAsyncTCP
- name: Install AsyncTCP (RP2040)
if: ${{ matrix.core == 'rp2040:rp2040' }}
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/khoih-prog/AsyncTCP_RP2040W#v1.2.0

- 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/mathieucarbou/esphome-ESPAsyncTCP#v2.0.0

- name: Install ESPAsyncWebServer
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/ESPAsyncWebServer#v2.10.4
- name: Install ESPAsyncWebServer (ESP32/ESP8266)
if: ${{ matrix.core == 'esp32:esp32' || matrix.core == 'esp8266:esp8266' || matrix.core == 'rp2040:rp2040' }}
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/ESPAsyncWebServer#v2.10.8

- 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' }}
- name: Configure Async Mode
run: |
cd src
sed -i 's/ELEGANTOTA_USE_ASYNC_WEBSERVER 0/ELEGANTOTA_USE_ASYNC_WEBSERVER 1/' ElegantOTA.h

- name: Build AsyncDemo
if: ${{ matrix.core != 'rp2040:rp2040' }}
- name: Build Async Demo
run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/AsyncDemo/AsyncDemo.ino"

platformio:
Expand Down Expand Up @@ -134,6 +139,6 @@ jobs:
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 }}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"owner": "mathieucarbou",
"name": "ESP Async WebServer",
"version": "^2.10.4",
"platforms": ["espressif8266", "espressif32"]
"platforms": ["espressif8266", "espressif32", "raspberrypi"]
}
],
"version": "3.1.2",
Expand Down
18 changes: 10 additions & 8 deletions src/ElegantOTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@ _____ _ _ ___ _____ _
#include "Arduino.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 "AsyncTCP_RP2040W.h"
#include "ESPAsyncWebServer.h"
#define ELEGANTOTA_WEBSERVER AsyncWebServer
#else
#include "WiFiClient.h"
#include "WiFiServer.h"
#include "WebServer.h"
#include "WiFiUdp.h"
#define ELEGANTOTA_WEBSERVER WebServer
#endif
#define HARDWARE "RP2040"
extern uint8_t _FS_start;
extern uint8_t _FS_end;
#endif
Expand Down
Loading