18 Ревизии 104feb9981 ... 3145252bce

Автор SHA1 Съобщение Дата
  Ayush Sharma 3145252bce v2.1.1 преди 3 месеца
  Ayush Sharma 550d0dc54c chore: bump version преди 3 месеца
  Ayush Sharma a5eb74e39e Revert "fix: consecutive whitespace characters not displaying on web - closes #112" преди 3 месеца
  Ayush Sharma 5b385aae9f v2.1.0 преди 3 месеца
  Ayush Sharma 96bc09f413 fix: consecutive whitespace characters not displaying on web - closes #112 преди 3 месеца
  Ayush Sharma bbbdc0dd5c fix: ifdef condition преди 3 месеца
  Ayush Sharma 052481e8c8 fix: string.clear error for arduino-pico sdk преди 3 месеца
  Ayush Sharma 72b37bc8d8 fix: examples for arduino-pico преди 3 месеца
  Ayush Sharma 8be00282e1 fix: add high perf flag in ci преди 3 месеца
  Ayush Sharma 29f6b26c04 fix: update ci преди 3 месеца
  Ayush Sharma 7286da780e feat: add support for arduino-pico sdk преди 3 месеца
  Ayush Sharma fbb03b1fc2 chore: remove funding urls преди 3 месеца
  Ayush Sharma 57abf71a0f fix: reformat readme markdown преди 3 месеца
  Ayush Sharma 91ed6a4623 fix: update stale.yml преди 3 месеца
  Ayush Sharma e9e131f7d6 Merge pull request #108 from JorritPosthuma/master преди 3 месеца
  github-actions[bot] bc48892888 @JorritPosthuma has signed the CLA in ayushsharma82/WebSerial#108 преди 7 месеца
  Jorrit Posthuma 72083e890b Add getConnectionCount function преди 7 месеца
  github-actions[bot] 20151273af Creating file for storing CLA Signatures преди 7 месеца

+ 0 - 3
.github/FUNDING.yml

@@ -1,3 +0,0 @@
-# These are supported funding model platforms
-
-custom: [ 'https://www.buymeacoffee.com/6QGVpSj', 'https://www.paypal.me/ayushsharma82' ]

+ 12 - 0
.github/cla-signatures/cla.json

@@ -0,0 +1,12 @@
+{
+  "signedContributors": [
+    {
+      "name": "JorritPosthuma",
+      "id": 412253,
+      "comment_id": 2495621851,
+      "created_at": "2024-11-23T18:59:09Z",
+      "repoId": 191947254,
+      "pullRequestNo": 108
+    }
+  ]
+}

+ 93 - 61
.github/workflows/ci.yml

@@ -4,43 +4,55 @@ on:
   push:
     paths-ignore:
       - "**/**.md"
-      - "/keywords.txt"
-      - "/library.json"
-      - "/library.properties"
-      - "/docs"
+      - "LICENSE"
+      - "keywords.txt"
+      - "library.json"
+      - "library.properties"
+      - "portal"
+      - "docs/*"
   pull_request:
     paths-ignore:
       - "**/**.md"
-      - "/keywords.txt"
-      - "/library.json"
-      - "/library.properties"
-      - "/docs"
-
-concurrency:
-  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
-  cancel-in-progress: true
-       
+      - "LICENSE"
+      - "keywords.txt"
+      - "library.json"
+      - "library.properties"
+      - "portal"
+      - "docs/*"
+
 jobs:
   arduino:
-    name: arduino ${{ matrix.name }}
+    name: Arduino - ${{ matrix.name }}
     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: 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
@@ -59,14 +71,20 @@ 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.2.6
+      - 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.3.7
 
-      - 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 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 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.3.17
+        run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/ESPAsyncWebServer#v3.7.3
 
       - name: Build Demo
         run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/Demo/Demo.ino"
@@ -74,70 +92,84 @@ jobs:
       - name: Build Demo_AP
         run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/Demo_AP/Demo_AP.ino"
 
-      - name: Build Logging
-        run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/Logging/Logging.ino"
-
       - name: Build HighPerf
         run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/HighPerf/HighPerf.ino"
 
+      - name: Build Logging
+        run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/Logging/Logging.ino"
+
   platformio:
-    name: "pio:${{ matrix.env }}:${{ matrix.board }}"
+    name: PlatformIO - ${{ matrix.name }}
     runs-on: ubuntu-latest
     strategy:
       fail-fast: false
       matrix:
         include:
-          - env: ci-arduino-2
-            board: esp32dev
-          - env: ci-arduino-2
-            board: esp32-s3-devkitc-1
+          - name: ESP8266 (Huzzah)
+            env: ci-esp8266
+            board: huzzah
+          
+          - name: ESP8266 (D1 Mini)
+            env: ci-esp8266
+            board: d1_mini
 
-          - env: ci-arduino-3
+          - name: ESP32 (Arduino Core v2)
+            env: ci-esp32-arduino-2
             board: esp32dev
-          - env: ci-arduino-3
-            board: esp32-s3-devkitc-1
-          - env: ci-arduino-3
-            board: esp32-c6-devkitc-1
 
-          - env: ci-arduino-310rc1
+          - name: ESP32
+            env: ci-esp32
             board: esp32dev
-          - env: ci-arduino-310rc1
+          
+          - name: ESP32-S2
+            env: ci-esp32
+            board: esp32-s2-saola-1
+          
+          - name: ESP32-S3
+            env: ci-esp32
             board: esp32-s3-devkitc-1
-          - env: ci-arduino-310rc1
+          
+          - name: ESP32-C3
+            env: ci-esp32
+            board: esp32-c3-devkitc-02
+          
+          - name: ESP32-C6
+            env: ci-esp32
             board: esp32-c6-devkitc-1
-
-          - env: ci-esp8266
-            board: huzzah
-          - env: ci-esp8266
-            board: d1_mini
+          
+          - name: Pico W | RP2040+W
+            env: ci-rp2040
+            board: rpipicow
+
+          - name: Pico 2W | RP2350+W
+            env: ci-rp2350
+            board: rpipico2w
     steps:
-      - name: Checkout
-        uses: actions/checkout@v4
+      - uses: actions/checkout@v4
 
-      - name: Cache PlatformIO
+      - name: Set up cache
         uses: actions/cache@v4
         with:
           key: ${{ runner.os }}-pio
           path: |
-            ~/.cache/pip
             ~/.platformio
-
-      - name: Python
+            ~/.cache/pip
+      
+      - name: Setup Python
         uses: actions/setup-python@v5
         with:
           python-version: "3.x"
 
-      - name: Build
+      - 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_SRC_DIR="examples/Demo_AP" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
-      - run: PLATFORMIO_SRC_DIR="examples/Logging" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
-      - run: PLATFORMIO_SRC_DIR="examples/HighPerf" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
-
+      
+      - run: PLATFORMIO_SRC_DIR=examples/Demo PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
+      - run: PLATFORMIO_SRC_DIR=examples/Demo_AP PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
+      - run: PLATFORMIO_SRC_DIR=examples/HighPerf PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
+      - run: PLATFORMIO_SRC_DIR=examples/Logging PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
       - run: PLATFORMIO_BUILD_FLAGS="-DWSL_HIGH_PERF" PLATFORMIO_SRC_DIR="examples/Demo" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
       - run: PLATFORMIO_BUILD_FLAGS="-DWSL_HIGH_PERF" PLATFORMIO_SRC_DIR="examples/Demo_AP" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
       - run: PLATFORMIO_BUILD_FLAGS="-DWSL_HIGH_PERF" PLATFORMIO_SRC_DIR="examples/Logging" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
-      - run: PLATFORMIO_BUILD_FLAGS="-DWSL_HIGH_PERF" PLATFORMIO_SRC_DIR="examples/HighPerf" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}
+      - run: PLATFORMIO_BUILD_FLAGS="-DWSL_HIGH_PERF" PLATFORMIO_SRC_DIR="examples/HighPerf" PIO_BOARD=${{ matrix.board }} pio run -e ${{ matrix.env }}

+ 5 - 2
.github/workflows/stale.yml

@@ -12,6 +12,9 @@ jobs:
           stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
           stale-pr-message: 'This PR is marked as stale because it has been open 45 days with no activity. You can remove stale label or comment if this PR is still valid.'
           close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
+          exempt-issue-labels: bug,triage,feature_request
+          exempt-pr-labels: wip,feature_request
+          exempt-all-assignees: true
           days-before-stale: 30
-          days-before-close: 5
-          days-before-pr-close: -1
+          days-before-close: 7
+          days-before-pr-close: -1

+ 30 - 16
README.md

@@ -1,15 +1,22 @@
-<p align="center"><a href="https://webserial.pro?ref=ghfeature" target="_blank"><img src="/docs/feature.png" width="1200"></a></p>
+<p align="center">
+  <a href="https://webserial.pro?ref=ghfeature" target="_blank">
+    <img src="/docs/feature.png" width="1200">
+  </a>
+</p>
+
 <br/>
+
 <p>
-<img src="https://img.shields.io/github/last-commit/ayushsharma82/WebSerial.svg?style=for-the-badge" />
-&nbsp;
-<img src="https://img.shields.io/github/actions/workflow/status/ayushsharma82/WebSerial/ci.yml?branch=master&style=for-the-badge" />
-&nbsp;
-<img src="https://img.shields.io/github/license/ayushsharma82/WebSerial.svg?style=for-the-badge" />
+  <img src="https://img.shields.io/github/last-commit/ayushsharma82/WebSerial.svg?style=for-the-badge" />
+  &nbsp;
+  <img src="https://img.shields.io/github/actions/workflow/status/ayushsharma82/WebSerial/ci.yml?branch=master&style=for-the-badge" />
+  &nbsp;
+  <img src="https://img.shields.io/github/license/ayushsharma82/WebSerial.svg?style=for-the-badge" />
 </p>
+
 <br/>
 
-<p><b>WebSerial</b> is a remote terminal to log, monitor or debug your firmware without being connected by wire. It lives on your wireless microcontroller itself and can be accessed anytime through your browser.
+**WebSerial** is a remote terminal to log, monitor or debug your firmware without being connected by wire. It lives on your wireless microcontroller itself and can be accessed anytime through your browser.
 
 <br/>
 <br/>
@@ -25,20 +32,27 @@
 <br/>
 
 ## Supported MCUs
+
 WebSerial works on the following microcontrollers/boards:
+
 - ESP8266
 - ESP32
+- RP2040+W (Example: Raspberry Pico W)
+- RP2350+W (Example: Raspberry Pico 2W)
 - *( more coming soon )*
 
 <br/>
 
-<h2>Documentation</h2>
-<p>Learn more about Installation & Usage: <a href="https://docs.webserial.pro?ref=gitreadme">Click Here</a></p>
+## Documentation
+
+Learn more about Installation & Usage: [Click Here](https://docs.webserial.pro?ref=gitreadme)
 
 <br>
 
-<h2>OSS Preview</h2>
-<p>Once you have integrated WebSerial library in your code, a terminal like below will be accessible over your WiFi microcontroller's IP: 
+## OSS Preview
+
+Once you have integrated WebSerial library in your code, a terminal like below will be accessible over your WiFi microcontroller's IP:
+
 <p align="center"><img src="/docs/preview.png" width="1200"></p>
 
 <br/>
@@ -67,17 +81,17 @@ WebSerial Pro comes with the following extended functionality:
 </a>
 
 <br>
-<br>
 
-<h2>Contributions</h2>
-<p>Every contribution to this repository is highly appreciated! If you spot any bug or problem, open a issue or pull request so that it can be rectified for everyone.</p>
+## Contributions
+
+Every contribution to this repository is highly appreciated! If you spot any bug or problem, open a issue or pull request so that it can be rectified for everyone.
 
 **For feature requests:** Please open a issue and I'll add the feature in a future release once I get some time in my hands.
 
 <br/>
 
-<h2>License</h2>
+## License
 
 WebSerial open-source edition is licensed under Affero General Public License v3.0 ( AGPL-3.0 ).
 
-If you are intending to use WebSerial in a commercial project, please consider purchasing [WebSerial Pro](https://webserial.pro?ref=ghlicense) which comes with a less restrictive SOFTT Commercial License 1.1 ( SCL-1.1 ).
+If you are intending to use WebSerial in a commercial project, please consider purchasing [WebSerial Pro](https://webserial.pro?ref=ghlicense) which comes with a less restrictive SOFTT Commercial License 1.2 ( SCL-1.2 ).

+ 12 - 1
examples/Demo/Demo.ino

@@ -13,6 +13,8 @@
   Works with following hardware:
   - ESP8266
   - ESP32
+  - RP2040+W
+  - RP2350+W
 
   WebSerial terminal will be accessible at your microcontroller's <IPAddress>/webserial URL.
 
@@ -26,6 +28,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>
 #include <WebSerial.h>
@@ -81,7 +86,13 @@ void loop() {
     WebSerial.print(F("IP address: "));
     WebSerial.println(WiFi.localIP());
     WebSerial.printf("Uptime: %lums\n", millis());
-    WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #if defined(ESP8266)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #elif defined(ESP32)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", rp2040.getFreeHeap());
+    #endif
     last_print_time = millis();
   }
 

+ 12 - 1
examples/Demo_AP/Demo_AP.ino

@@ -13,6 +13,8 @@
   Works with following hardware:
   - ESP8266
   - ESP32
+  - RP2040+W
+  - RP2350+W
 
   WebSerial terminal will be accessible at your microcontroller's <IPAddress>/webserial URL.
 
@@ -26,6 +28,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>
 #include <WebSerial.h>
@@ -74,7 +79,13 @@ void loop() {
     WebSerial.print(F("IP address: "));
     WebSerial.println(WiFi.softAPIP());
     WebSerial.printf("Uptime: %lums\n", millis());
-    WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #if defined(ESP8266)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #elif defined(ESP32)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", rp2040.getFreeHeap());
+    #endif
     last_print_time = millis();
   }
 

+ 9 - 4
examples/HighPerf/HighPerf.ino

@@ -17,13 +17,18 @@
  *  -D WS_MAX_QUEUED_MESSAGES=128
  */
 #include <Arduino.h>
+
 #if defined(ESP8266)
-#include <ESP8266WiFi.h>
-#include <ESPAsyncTCP.h>
+  #include <ESP8266WiFi.h>
+  #include <ESPAsyncTCP.h>
 #elif defined(ESP32)
-#include <AsyncTCP.h>
-#include <WiFi.h>
+  #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 <DNSServer.h>
 #include <ESPAsyncWebServer.h>
 #include <WString.h>

+ 16 - 5
examples/Logging/Logging.ino

@@ -9,13 +9,18 @@
  *  -D WS_MAX_QUEUED_MESSAGES=128
  */
 #include <Arduino.h>
+
 #if defined(ESP8266)
-#include <ESP8266WiFi.h>
-#include <ESPAsyncTCP.h>
+  #include <ESP8266WiFi.h>
+  #include <ESPAsyncTCP.h>
 #elif defined(ESP32)
-#include <AsyncTCP.h>
-#include <WiFi.h>
+  #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 <DNSServer.h>
 #include <ESPAsyncWebServer.h>
 #include <WString.h>
@@ -48,7 +53,13 @@ void loop() {
     WebSerial.print(F("IP address: "));
     WebSerial.println(WiFi.softAPIP());
     WebSerial.printf("Uptime: %lums\n", millis());
-    WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #if defined(ESP8266)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #elif defined(ESP32)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", ESP.getFreeHeap());
+    #elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
+      WebSerial.printf("Free heap: %" PRIu32 "\n", rp2040.getFreeHeap());
+    #endif
 
     last = millis();
   }

+ 6 - 6
library.json

@@ -1,6 +1,6 @@
 {
   "name": "WebSerial",
-  "keywords": "WebSerial, remote, terminal, serial, monitor, ESP8266, ESP32, webpage, websocket, wireless",
+  "keywords": "WebSerial, remote, terminal, serial, monitor, ESP8266, ESP32, RP2040, RP2350, webpage, websocket, wireless",
   "description": "WebSerial is a remote terminal which is accessible via browser to log, monitor or debug your firmware remotely.",
   "repository":
   {
@@ -15,15 +15,15 @@
       "maintainer": true
     }
   ],
-  "version": "2.0.8",
+  "version": "2.1.1",
   "frameworks": "arduino",
-  "platforms": ["espressif8266", "espressif32"],
+  "platforms": ["espressif8266", "espressif32", "raspberrypi"],
   "dependencies": [
     {
-      "owner": "mathieucarbou",
+      "owner": "esp32async",
       "name": "ESPAsyncWebServer",
-      "version": "^3.3.17",
-      "platforms": ["espressif8266", "espressif32"]
+      "version": "^3.7.3",
+      "platforms": ["espressif8266", "espressif32", "raspberrypi"]
     }
   ]
 }

+ 2 - 2
library.properties

@@ -1,9 +1,9 @@
 name=WebSerial
-version=2.0.8
+version=2.1.1
 author=Ayush Sharma
 category=Communication
 maintainer=Ayush Sharma <asrocks5@gmail.com>
 sentence=Remote terminal for wireless microcontrollers
 paragraph=WebSerial is a remote terminal which is accessible via browser to log, monitor or debug your firmware remotely.
 url=https://github.com/ayushsharma82/WebSerial
-architectures=esp8266,esp32
+architectures=esp8266,esp32,rp2040

+ 73 - 35
platformio.ini

@@ -4,59 +4,97 @@ build_flags =
   -Wall -Wextra
   -D CONFIG_ARDUHAL_LOG_COLORS
   -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-  -D CONFIG_ASYNC_TCP_QUEUE_SIZE=128
-  -D CONFIG_ASYNC_TCP_RUNNING_CORE=1
-  -D WS_MAX_QUEUED_MESSAGES=128
-  -D WSL_HIGH_PERF
-lib_deps = 
-  mathieucarbou/ESPAsyncWebServer@^3.3.11
-lib_compat_mode = strict
-lib_ldf_mode = chain
+lib_deps = 
+  esp32async/ESPAsyncWebServer@^3.7.3
 upload_protocol = esptool
 monitor_speed = 115200
 monitor_filters = esp32_exception_decoder, log2file
 
 [platformio]
-default_envs = arduino-2, arduino-3, arduino-310rc1, esp8266
 lib_dir = .
-; src_dir = examples/Demo
+src_dir = examples/Demo
 ; src_dir = examples/Demo_AP
-src_dir = examples/HighPerf
-; src_dir = examples/Logging
-
-[env:arduino-2]
-platform = espressif32@6.8.1
-board = esp32-s3-devkitc-1
 
-[env:arduino-3]
-platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
+[env:esp32]
+build_flags = ${env.build_flags}
+platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
 board = esp32-s3-devkitc-1
-; board = esp32-c6-devkitc-1
-
-[env:arduino-310rc1]
-platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10%%2Brc1/platform-espressif32.zip
-board = esp32-s3-devkitc-1
-; board = esp32-c6-devkitc-1
+lib_deps = 
+  esp32async/AsyncTCP@^3.3.7
+  ${env.lib_deps}
 
 [env:esp8266]
 platform = espressif8266
 board = huzzah
-; board = d1_mini
+lib_deps = 
+  esp32async/ESPAsyncTCP@^2.0.0
+  ${env.lib_deps}
 
-; CI
+[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:ci-arduino-2]
-platform = espressif32@6.8.1
-board = ${sysenv.PIO_BOARD}
+[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
+
+;  ------------
+;  CI Workflows
+;  ------------
 
-[env:ci-arduino-3]
-platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
+[env:ci-esp8266]
+platform = espressif8266
 board = ${sysenv.PIO_BOARD}
+lib_deps = 
+  esp32async/ESPAsyncTCP@^2.0.0
+  ${env.lib_deps}
 
-[env:ci-arduino-310rc1]
-platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10%%2Brc1/platform-espressif32.zip
+[env:ci-esp32-arduino-2]
+platform = espressif32@6.7.0
 board = ${sysenv.PIO_BOARD}
+lib_deps = 
+  esp32async/AsyncTCP@^3.3.7
+  ${env.lib_deps}
 
-[env:ci-esp8266]
-platform = espressif8266
+[env:ci-esp32]
+platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
 board = ${sysenv.PIO_BOARD}
+lib_deps = 
+  esp32async/AsyncTCP@^3.3.7
+  ${env.lib_deps}
+
+[env:ci-rp2040]
+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: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

+ 13 - 3
src/WebSerial.cpp

@@ -114,6 +114,10 @@ void WebSerialClass::onMessage(WSLStringMessageHandler callback) {
   };
 }
 
+bool WebSerialClass::getConnectionCount() {
+  return _ws->count();
+}
+
 // Print func
 size_t WebSerialClass::write(uint8_t m) {
   if (!_ws)
@@ -123,10 +127,12 @@ size_t WebSerialClass::write(uint8_t m) {
   // We do not support non-buffered write on webserial for the HIGH_PERF version
   // we fail with a stack trace allowing the user to change the code to use write(const uint8_t* buffer, size_t size) instead
   if(!_initialBufferCapacity) {
-#ifdef ESP8266
+#if defined(ESP8266)
     ets_printf("Non-buffered write is not supported. Please use write(const uint8_t* buffer, size_t size) instead.");
-#else
+#elif defined(ESP32)
     log_e("Non-buffered write is not supported. Please use write(const uint8_t* buffer, size_t size) instead.");
+#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
+    Serial.println("Non-buffered write is not supported. Please use write(const uint8_t* buffer, size_t size) instead.");
 #endif
     assert(false);
     return 0;
@@ -199,7 +205,11 @@ void WebSerialClass::_send(const uint8_t* buffer, size_t size) {
     if (_buffer.length() > _initialBufferCapacity) {
       setBuffer(_initialBufferCapacity);
     } else {
-      _buffer.clear();
+      #if defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
+        _buffer = "";
+      #else
+        _buffer.clear();
+      #endif
     }
   }
 }

+ 18 - 10
src/WebSerial.h

@@ -24,15 +24,24 @@ License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html)
 #include <functional>
 
 #if defined(ESP8266)
-    #define HARDWARE "ESP8266"
-    #include "ESP8266WiFi.h"
-    #include "ESPAsyncTCP.h"
-    #include "ESPAsyncWebServer.h"
+  #define HARDWARE "ESP8266"
+  #include "ESP8266WiFi.h"
+  #include "ESPAsyncTCP.h"
+  #include "ESPAsyncWebServer.h"
 #elif defined(ESP32)
-    #define HARDWARE "ESP32"
-    #include "WiFi.h"
-    #include "AsyncTCP.h"
-    #include "ESPAsyncWebServer.h"
+  #define HARDWARE "ESP32"
+  #include "WiFi.h"
+  #include "AsyncTCP.h"
+  #include "ESPAsyncWebServer.h"
+#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
+  #include "WiFi.h"
+  #include "RPAsyncTCP.h"
+  #include "ESPAsyncWebServer.h"
+  #if defined(TARGET_RP2040) || defined(PICO_RP2040)
+    #define HARDWARE "RP2040"
+  #elif defined(TARGET_RP2350) || defined(PICO_RP2350)
+    #define HARDWARE "RP2350"
+  #endif
 #endif
 
 #ifndef WSL_MAX_WS_CLIENTS
@@ -97,6 +106,7 @@ class WebSerialClass : public Print {
     void setAuthentication(const String& username, const String& password);
     void onMessage(WSLMessageHandler recv);
     void onMessage(WSLStringMessageHandler recv);
+    bool getConnectionCount();
     size_t write(uint8_t) override;
     size_t write(const uint8_t* buffer, size_t size) override;
     
@@ -115,7 +125,6 @@ class WebSerialClass : public Print {
     void setBuffer(size_t initialCapacity);
 
 #ifdef WSL_HIGH_PERF
-  #ifdef ASYNCWEBSERVER_FORK_mathieucarbou
     // Expose the internal WebSocket makeBuffer to even improve memory consumption on client-side
     // 1. make a AsyncWebSocketMessageBuffer
     // 2. put the data inside
@@ -134,7 +143,6 @@ class WebSerialClass : public Print {
       if (_ws->count())
         _ws->textAll(buffer);
     }
-  #endif
 #endif
 
   private: