Skip to content

Commit

Permalink
Enable Async on RP2040
Browse files Browse the repository at this point in the history
  • Loading branch information
DoomHammer committed Mar 27, 2024
1 parent d4f6bcd commit de42ccc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
@@ -1,6 +1,6 @@
name: Arduino Library CI

on:
on:
push:
paths-ignore:
- '**/**.md'
Expand All @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-python@v1
with:
python-version: '3.x'

- uses: actions/checkout@v2

- uses: actions/checkout@v2
Expand All @@ -41,19 +41,20 @@ jobs:

- name: Install test dependencies
run: arduino-cli lib install --git-url https://github.com/me-no-dev/ESPAsyncWebServer --git-url https://github.com/me-no-dev/ESPAsyncTCP --git-url https://github.com/me-no-dev/AsyncTCP

- name: Skip SyncDemo Example
run: |
cd examples
cd Demo
touch .esp32.test.skip
touch .esp8266.test.skip
touch .picow_rp2040.test.skip
- name: Configure ElegantOTA to Async Mode
run: |
cd src
sed -i 's/ELEGANTOTA_USE_ASYNC_WEBSERVER 0/ELEGANTOTA_USE_ASYNC_WEBSERVER 1/' ElegantOTA.h
- name: Test Async Demo
run: python3 ci/build_platform.py esp8266 esp32

Expand All @@ -63,7 +64,7 @@ jobs:
- uses: actions/setup-python@v1
with:
python-version: '3.x'

- uses: actions/checkout@v2

- uses: actions/checkout@v2
Expand All @@ -80,6 +81,7 @@ jobs:
cd AsyncDemo
touch .esp32.test.skip
touch .esp8266.test.skip
touch .picow_rp2040.test.skip
- name: Test Sync Demo
run: python3 ci/build_platform.py esp8266 esp32 picow_rp2040
Empty file.
14 changes: 14 additions & 0 deletions library.json
Expand Up @@ -15,6 +15,20 @@
"maintainer": true
}
],
"dependencies":
[
{
"owner": "esphome",
"name": "ESPAsyncWebServer-esphome",
"version": "^3.0.0",
"platforms": ["espressif8266", "espressif32"]
},
{
"name": "ESPAsyncWebServer",
"version": "https://github.com/doomhammer/ESPAsyncWebServer#more-rp2040-fixes",
"platforms": ["raspberrypi"]
}
],
"version": "3.1.1",
"frameworks": "arduino",
"platforms": ["espressif8266", "espressif32", "raspberrypi"]
Expand Down
18 changes: 10 additions & 8 deletions src/ElegantOTA.h
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

0 comments on commit de42ccc

Please sign in to comment.