Add Webserial (#444)

* Webserial

* Webserial
This commit is contained in:
iranl
2024-08-09 11:35:42 +02:00
committed by GitHub
parent 44b5f71b40
commit 43ac62a22d
86 changed files with 1846 additions and 1192 deletions

View File

@@ -1,35 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''
---
**Please make sure to go through the recommendations before opening a bug report:**
[https://github.com/mathieucarbou/AsyncTCP?tab=readme-ov-file#important-recommendations](https://github.com/mathieucarbou/AsyncTCP?tab=readme-ov-file#important-recommendations)
**Description**
A clear and concise description of what the bug is.
**Board**
esp32dev, esp32s3, etc
**Ethernet adapter used ?**
If yes, please specify which one
**Stack trace**
Please provide the stack trace here taken with `monitor_filters = esp32_exception_decoder`.
**Any issue opened with a non readable stack trace will be ignored because not helpful at all.**
As an alternative, you can use [https://maximeborges.github.io/esp-stacktrace-decoder/](https://maximeborges.github.io/esp-stacktrace-decoder/).
**Additional notes**
Add any other context about the problem here.

View File

@@ -1,10 +0,0 @@
---
name: Question
about: Describe your question
title: "[Q]"
labels: question
assignees: ''
---

View File

@@ -1,10 +0,0 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"

View File

@@ -1,31 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
daysUntilStale: 60
daysUntilClose: 14
limitPerRun: 30
staleLabel: stale
exemptLabels:
- pinned
- security
- "to be implemented"
- "for reference"
- "move to PR"
- "enhancement"
only: issues
onlyLabels: []
exemptProjects: false
exemptMilestones: false
exemptAssignees: false
markComment: >
[STALE_SET] This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 14 days if no further activity occurs. Thank you
for your contributions.
unmarkComment: >
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
closeComment: >
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

View File

@@ -1,52 +0,0 @@
name: Async TCP CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-arduino:
name: ${{ matrix.config }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config: [arduino-cli.yaml, arduino-cli-dev.yaml]
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-arduino-cli@v1
- name: Download board
run: |
arduino-cli --config-file ${{ matrix.config }} core update-index
arduino-cli --config-file ${{ matrix.config }} board listall
arduino-cli --config-file ${{ matrix.config }} core install esp32:esp32
- name: Compile Sketch
run: arduino-cli --config-file ${{ matrix.config }} --library ./src/ compile --fqbn esp32:esp32:esp32 ./examples/ClientServer/Client/Client.ino
- name: Compile Sketch with IPv6
env:
LWIP_IPV6: true
run: arduino-cli --config-file ${{ matrix.config }} --library ./src/ compile --fqbn esp32:esp32:esp32 ./examples/ClientServer/Client/Client.ino
build-pio:
name: ${{ matrix.board }} ${{ matrix.env }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
board: [esp32dev, esp32-s3-devkitc-1]
env: [arduino-2, arduino-3]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.platformio
~/.cache/pip
key: ${{ matrix.env }}
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: pip install platformio
- run: sed -i -e 's/esp32dev/${{ matrix.board }}/g' platformio.ini
- run: pio run -e ${{ matrix.env }}

View File

@@ -1,6 +0,0 @@
.DS_Store
.lh
/.pio
/.vscode/*
!/.vscode/settings.json
/logs

View File

@@ -1,8 +1,8 @@
# AsyncTCP
[![License: LGPL 3.0](https://img.shields.io/badge/License-LGPL%203.0-yellow.svg)](https://opensource.org/license/lgpl-3-0/)
[![Continuous Integration](https://github.com/mathieucarbou/AsyncTCP/actions/workflows/push.yml/badge.svg)](https://github.com/mathieucarbou/AsyncTCP/actions/workflows/push.yml)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/mathieucarbou/library/Async%20TCP.svg)](https://registry.platformio.org/libraries/mathieucarbou/Async%20TCP)
[![Continuous Integration](https://github.com/mathieucarbou/AsyncTCP/actions/workflows/ci.yml/badge.svg)](https://github.com/mathieucarbou/AsyncTCP/actions/workflows/ci.yml)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/mathieucarbou/library/AsyncTCP.svg)](https://registry.platformio.org/libraries/mathieucarbou/AsyncTCP)
A fork of the [AsyncTCP](https://github.com/me-no-dev/AsyncTCP) library by [@me-no-dev](https://github.com/me-no-dev) for [ESPHome](https://esphome.io).
@@ -21,10 +21,14 @@ The base classes on which everything else is built. They expose all possible sce
- All improvements from [ESPHome fork](https://github.com/esphome/AsyncTCP)
- Reverted back `library.properties` for Arduino IDE users
- Arduino 3 / ESP-IDF 5 compatibility
- Changed lib name: `AsyncTCP` -> `Async TCP`
- Point to `mathieucarbou/Async TCP @ ^3.1.4`
- IPv6 support
## Coordinates
```
mathieucarbou/AsyncTCP @ ^3.2.4
```
## Important recommendations
Most of the crashes are caused by improper configuration of the library for the project.

View File

@@ -1,6 +1,6 @@
{
"name": "Async TCP",
"version": "3.1.4",
"name": "AsyncTCP",
"version": "3.2.4",
"description": "Asynchronous TCP Library for ESP32",
"keywords": "async,tcp",
"repository": {

View File

@@ -1,5 +1,5 @@
name=Async TCP
version=3.1.4
name=AsyncTCP
version=3.2.4
author=Me-No-Dev
maintainer=Mathieu Carbou <mathieu.carbou@gmail.com>
sentence=Async TCP Library for ESP32

View File

@@ -23,6 +23,26 @@ board = esp32dev
[env:arduino-3]
platform = espressif32
platform_packages=
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
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
board = esp32dev
[env:pioarduino-esp32dev]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
board = esp32dev
[env:pioarduino-esp32-s2]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
board = esp32-s2-saola-1
[env:pioarduino-esp32-s3]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
board = esp32-s3-devkitc-1
[env:pioarduino-esp32-c3]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
board = esp32-c3-devkitc-02
[env:pioarduino-esp32-c6]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
board = esp32-c6-devkitc-1

View File

@@ -33,6 +33,12 @@ extern "C"{
#include "esp_task_wdt.h"
#endif
// Required for:
// https://github.com/espressif/arduino-esp32/blob/3.0.3/libraries/Network/src/NetworkInterface.cpp#L37-L47
#if ESP_IDF_VERSION_MAJOR >= 5
#include <NetworkInterface.h>
#endif
/*
* TCP/IP Event Task
* */
@@ -439,7 +445,7 @@ static esp_err_t _tcp_write(tcp_pcb * pcb, int8_t closed_slot, const char* data,
static err_t _tcp_recved_api(struct tcpip_api_call_data *api_call_msg){
tcp_api_call_t * msg = (tcp_api_call_t *)api_call_msg;
msg->err = ERR_CONN;
if(msg->closed_slot == -1 || !_closed_slots[msg->closed_slot]) {
if(msg->closed_slot != -1 && !_closed_slots[msg->closed_slot]) {
msg->err = 0;
tcp_recved(msg->pcb, msg->received);
}
@@ -723,8 +729,8 @@ bool AsyncClient::_connect(ip_addr_t addr, uint16_t port){
tcp_recv(pcb, &_tcp_recv);
tcp_sent(pcb, &_tcp_sent);
tcp_poll(pcb, &_tcp_poll, 1);
_tcp_connect(pcb, _closed_slot, &addr, port,(tcp_connected_fn)&_tcp_connected);
return true;
esp_err_t err =_tcp_connect(pcb, _closed_slot, &addr, port,(tcp_connected_fn)&_tcp_connected);
return err == ESP_OK;
}
bool AsyncClient::connect(const IPAddress& ip, uint16_t port){
@@ -1006,7 +1012,7 @@ int8_t AsyncClient::_recv(tcp_pcb* pcb, pbuf* pb, int8_t err) {
int8_t AsyncClient::_poll(tcp_pcb* pcb){
if(!_pcb){
log_d("pcb is NULL");
// log_d("pcb is NULL");
return ERR_OK;
}
if(pcb != _pcb){
@@ -1091,12 +1097,9 @@ size_t AsyncClient::write(const char* data) {
size_t AsyncClient::write(const char* data, size_t size, uint8_t apiflags) {
size_t will_send = add(data, size, apiflags);
if(!will_send) {
if(!will_send || !send()) {
return 0;
}
while (connected() && !send()) {
taskYIELD();
}
return will_send;
}

View File

@@ -22,9 +22,9 @@
#ifndef ASYNCTCP_H_
#define ASYNCTCP_H_
#define ASYNCTCP_VERSION "3.1.4"
#define ASYNCTCP_VERSION "3.2.4"
#define ASYNCTCP_VERSION_MAJOR 3
#define ASYNCTCP_VERSION_MINOR 1
#define ASYNCTCP_VERSION_MINOR 2
#define ASYNCTCP_VERSION_REVISION 4
#define ASYNCTCP_FORK_mathieucarbou