Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit f840a4a

Browse files
authored
v1.1.0 to fix issue with slow browsers or network
### Releases v1.1.0 1. Fix issue with slow browsers or network 2. Remove hard-code if possible 3. Improve debug messages by adding functions to display `error/state messages` instead of `cryptic error/state number` 4. Clean up
1 parent 79b27c6 commit f840a4a

18 files changed

+900
-264
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1515
Please ensure to specify the following:
1616

1717
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18-
* `Teensyduino` Core Version (e.g. Teensy core v1.56)
18+
* `Teensyduino` Core Version (e.g. Teensy core v1.57)
1919
* Contextual information (e.g. what you were trying to achieve)
2020
* Simplest possible steps to reproduce
2121
* Anything that might be relevant in your opinion, such as:
@@ -27,12 +27,13 @@ Please ensure to specify the following:
2727

2828
```
2929
Arduino IDE version: 1.8.19
30-
Teensyduino Core Version 1.56
30+
Teensyduino Core Version 1.57
31+
Teensy 4.1
3132
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.13.0-35-generic #40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
33+
Linux xy-Inspiron-3593 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3334
3435
Context:
35-
I encountered an endless loop while trying to connect to Local WiFi.
36+
I encountered an endless loop while trying to use this library
3637
3738
Steps to reproduce:
3839
1. ...

README.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
* [VS Code & PlatformIO](#vs-code--platformio)
2626
* [HOWTO Fix `Multiple Definitions` Linker Error](#howto-fix-multiple-definitions-linker-error)
2727
* [Orignal documentation](#Orignal-documentation)
28+
* [AsyncClient and AsyncServer](#AsyncClient-and-AsyncServer)
29+
* [AsyncPrinter](#AsyncPrinter)
30+
* [AsyncTCPbuffer](#AsyncTCPbuffer)
31+
* [SyncClient](#SyncClient)
32+
* [Libraries currently depend on this library](#Libraries-currently-depend-on-this-library)
2833
* [Examples](#examples)
2934
* [1. multiFileProject](examples/multiFileProject)
3035
* [Debug Terminal Output Samples](#debug-terminal-output-samples)
@@ -53,7 +58,7 @@ This library is based on, modified from:
5358
1. [Hristo Gochkov's ESPAsyncTCP](https://github.com/me-no-dev/ESPAsyncTCP)
5459
2. [Hristo Gochkov's AsyncTCP](https://github.com/me-no-dev/AsyncTCP)
5560

56-
to apply the better and faster **asynchronous** feature of the **powerful** [ESPAsyncTCP Library](https://github.com/me-no-dev/ESPAsyncTCP) without SSL to Teensy 4.1 using LwIP-based [QNEthernet Library](https://github.com/ssilverman/QNEthernet), and will be the base for future or current and more advanced Async libraries, such as [AsyncHTTPRequest_Generic](https://github.com/khoih-prog/AsyncHTTPRequest_Generic), [AsyncHTTPRequest_Generic](https://github.com/khoih-prog/AsyncHTTPRequest_Generic), [AsyncMQTT_Generic](https://github.com/khoih-prog/AsyncMQTT_Generic), Teensy41_AsyncWebServer, Teensy41_AsyncUDP, Teensy41_AsyncDNSServer, Teensy41_AsyncTCP_SSL, etc.
61+
to apply the better and faster **asynchronous** feature of the **powerful** [ESPAsyncTCP Library](https://github.com/me-no-dev/ESPAsyncTCP) without SSL to Teensy 4.1 using LwIP-based [QNEthernet Library](https://github.com/ssilverman/QNEthernet), and will be the base for future or current and more advanced Async libraries, such as [AsyncHTTPRequest_Generic](https://github.com/khoih-prog/AsyncHTTPRequest_Generic), [AsyncHTTPRequest_Generic](https://github.com/khoih-prog/AsyncHTTPRequest_Generic), [AsyncMQTT_Generic](https://github.com/khoih-prog/AsyncMQTT_Generic), [AsyncWebServer_Teensy41](https://github.com/khoih-prog/AsyncWebServer_Teensy41), [AsyncUDP_Teensy41](https://github.com/khoih-prog/AsyncUDP_Teensy41), [AsyncDNSServer_Teensy41](https://github.com/khoih-prog/AsyncDNSServer_Teensy41), AsyncTCP_SSL_Teensy41, etc.
5762

5863

5964
#### Why Async is better
@@ -83,8 +88,8 @@ to apply the better and faster **asynchronous** feature of the **powerful** [ESP
8388
## Prerequisites
8489

8590
1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
86-
2. [`Teensy core v1.56+`](https://www.pjrc.com/teensy/td_download.html) for Teensy 4.1
87-
3. [`QNEthernet Library version v0.13.0+`](https://github.com/ssilverman/QNEthernet) for Teensy 4.1 built-in Ethernet.
91+
2. [`Teensy core v1.57+`](https://www.pjrc.com/teensy/td_download.html) for Teensy 4.1
92+
3. [`QNEthernet Library version v0.15.0+`](https://github.com/ssilverman/QNEthernet) for Teensy 4.1 built-in Ethernet.
8893

8994
---
9095
---
@@ -101,9 +106,9 @@ You can also use this link [![arduino-library-badge](https://www.ardu-badge.com/
101106
Another way to install is to:
102107

103108
1. Navigate to [**Teensy41_AsyncTCP**](https://github.com/khoih-prog/Teensy41_AsyncTCP) page.
104-
2. Download the latest release `Teensy41_AsyncTCP-master.zip`.
105-
3. Extract the zip file to `Teensy41_AsyncTCP-master` directory
106-
4. Copy whole `Teensy41_AsyncTCP-master` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
109+
2. Download the latest release `Teensy41_AsyncTCP-main.zip`.
110+
3. Extract the zip file to `Teensy41_AsyncTCP-main` directory
111+
4. Copy whole `Teensy41_AsyncTCP-main` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
107112

108113
### VS Code & PlatformIO
109114

@@ -146,9 +151,37 @@ Check [AsyncTCP Library](https://github.com/me-no-dev/AsyncTCP)
146151

147152
This is a fully asynchronous TCP library, aimed at enabling trouble-free, multi-connection network environment for **Teensy 4.1 using QNEthernet Library**.
148153

154+
### AsyncClient and AsyncServer
155+
156+
The base classes on which everything else is built. They expose all possible scenarios, but are really raw and require more skills to use.
157+
158+
### AsyncPrinter
159+
160+
This class can be used to send data like any other `Print` interface (`Serial` for example).
161+
162+
The object then can be used outside of the Async callbacks (the loop) and receive asynchronously data using `onData`. The object can be checked if the underlying `AsyncClient`is connected, or hook to the `onDisconnect` callback.
163+
164+
### AsyncTCPbuffer
165+
166+
This class is really similar to the `AsyncPrinter`, but it can buffer some of the incoming data.
167+
168+
### SyncClient
169+
170+
It is exactly what it sounds like. This is a standard, synchronous blocking TCP Client you're used to.
171+
172+
149173
---
150174
---
151175

176+
### Libraries currently depend on this library
177+
178+
1. [AsyncWebServer_Teensy41](https://github.com/khoih-prog/AsyncWebServer_Teensy41) [![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncWebServer_Teensy41.svg)](https://github.com/khoih-prog/AsyncWebServer_Teensy41/releases/latest)
179+
2. [AsyncHTTPRequest_Teensy41](https://github.com/khoih-prog/AsyncHTTPRequest_Teensy41) [![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncHTTPRequest_Teensy41.svg)](https://github.com/khoih-prog/AsyncHTTPRequest_Teensy41/releases/latest)
180+
3. [AsyncMQTT_Generic](https://github.com/khoih-prog/AsyncMQTT_Generic) [![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncMQTT_Generic.svg)](https://github.com/khoih-prog/AsyncMQTT_Generic/releases/latest)
181+
182+
183+
---
184+
---
152185

153186
### Examples
154187

@@ -166,7 +199,7 @@ Following is the debug terminal when running example [FullyFeatured_QNEthernet](
166199

167200
```
168201
Starting FullyFeatured_QNEthernet on TEENSY 4.1
169-
AsyncMQTT_Generic v1.3.0 for Teensy 4.1 QNEthernet
202+
AsyncMQTT_Generic v1.7.0 for Teensy 4.1 QNEthernet
170203
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
171204
Connecting to MQTT...
172205
Connected to MQTT broker: broker.emqx.io, port: 1883
@@ -231,7 +264,7 @@ Following is the debug terminal when running example [FullyFeatured_QNEthernet](
231264

232265
```
233266
Starting FullyFeatured_QNEthernet on TEENSY 4.1
234-
AsyncMQTT_Generic v1.3.0 for Teensy 4.1 QNEthernet
267+
AsyncMQTT_Generic v1.7.0 for Teensy 4.1 QNEthernet
235268
Initialize Ethernet using static IP => Connected! IP address:192.168.2.222
236269
Connecting to MQTT...
237270
Connected to MQTT broker: broker.emqx.io, port: 1883
@@ -334,7 +367,9 @@ Submit issues to: [Teensy41_AsyncTCP issues](https://github.com/khoih-prog/Teens
334367
3. Add debug feature
335368
4. Use `h-only` style library
336369
5. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project to avoid `multiple-definitions` linker error
337-
370+
6. Fix issue with slow browsers or network
371+
7. Remove hard-code if possible
372+
8. Improve debug messages by adding functions to display `error/state messages` instead of `cryptic error/state number`
338373

339374
---
340375
---

changelog.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Teensy41_AsyncTCP client for ESP8266, ESP32, etc.
1+
# Teensy41_AsyncTCP Library
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/Teensy41_AsyncTCP.svg?)](https://www.ardu-badge.com/Teensy41_AsyncTCP)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/Teensy41_AsyncTCP.svg)](https://github.com/khoih-prog/Teensy41_AsyncTCP/releases)
@@ -11,13 +11,21 @@
1111
## Table of Contents
1212

1313
* [Changelog](#changelog)
14+
* [Releases v1.1.0](#Releases-v110)
1415
* [Initial Releases v1.0.0](#Initial-Releases-v100)
1516

1617
---
1718
---
1819

1920
## Changelog
2021

22+
### Releases v1.1.0
23+
24+
1. Fix issue with slow browsers or network
25+
2. Remove hard-code if possible
26+
3. Improve debug messages by adding functions to display `error/state messages` instead of `cryptic error/state number`
27+
4. Clean up
28+
2129
### Initial Releases v1.0.0
2230

2331
1. Initial porting and coding to support **Teensy 4.1 using QNEthernet Library**

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"Teensy41_AsyncTCP",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description":"Asynchronous TCP Library for Teensy 4.1 using QNEthernet. This library is the base for future Async support for many current or future libraries, such as AsyncHTTPRequest_Generic, AsyncHTTPSRequest_Generic, AsyncMQTT_Generic, Teensy41_AsyncWebServer, Teensy41_AsyncUDP, Teensy41_AsyncDNSServer, Teensy41_AsyncTCP_SSL",
55
"keywords":"async, tcp, teensy, teensy41, teensy-41, qnethernet, lwip",
66
"authors":

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=Teensy41_AsyncTCP
2-
version=1.0.0
2+
version=1.1.0
33
author=Hristo Gochkov, Khoi Hoang
44
maintainer=Khoi Hoang <[email protected]>
55
sentence=Async TCP Library for Teensy 4.1 using QNEthernet
6-
paragraph=This library is the base for future Async support for many current or future libraries, such as AsyncHTTPRequest_Generic, AsyncHTTPSRequest_Generic, AsyncMQTT_Generic, Teensy41_AsyncWebServer, Teensy41_AsyncUDP, Teensy41_AsyncDNSServer, Teensy41_AsyncTCP_SSL
6+
paragraph=This library is the base for future Async support for many current or future libraries, such as AsyncHTTPRequest_Generic, AsyncHTTPSRequest_Generic, AsyncMQTT_Generic, AsyncWebServer_Teensy41, AsyncUDP_Teensy41, AsyncDNSServer_Teensy41, AsyncTCP_SSL_Teensy41, etc.
77
category=Communication
88
url=https://github.com/khoih-prog/Teensy41_AsyncTCP
99
license=LGPLv3

platformio/platformio.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ upload_speed = 921600
2727
;monitor_port = COM11
2828

2929
; Checks for the compatibility with frameworks and dev/platforms
30+
; Adjust as necessary
3031
lib_compat_mode = strict
32+
lib_ldf_mode = chain+
33+
;lib_ldf_mode = deep+
3134

3235
lib_deps =
3336
; PlatformIO 4.x
@@ -38,7 +41,7 @@ lib_deps =
3841
build_flags =
3942
; set your build_flags
4043

41-
[env:STM32]
44+
[env:teensy]
4245
platform = teensy
4346
framework = arduino
4447

src/AsyncPrinter.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
2121
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
2222
23-
Version: 1.0.0
23+
Version: 1.1.0
2424
2525
Version Modified By Date Comments
2626
------- ----------- ---------- -----------
2727
1.0.0 K Hoang 17/03/2022 Initial coding to support only Teensy4.1 using QNEthernet
28+
1.1.0 K Hoang 26/09/2022 Fix issue with slow browsers or network. Clean up. Remove hard-code if possible
2829
*****************************************************************************************************************************/
2930

3031
#pragma once
@@ -38,11 +39,15 @@
3839

3940
#include "cbuf.hpp"
4041

42+
/////////////////////////////////////////////////
43+
4144
class AsyncPrinter;
4245

4346
typedef std::function<void(void*, AsyncPrinter*, uint8_t*, size_t)> ApDataHandler;
4447
typedef std::function<void(void*, AsyncPrinter*)> ApCloseHandler;
4548

49+
/////////////////////////////////////////////////
50+
4651
class AsyncPrinter: public Print
4752
{
4853
private:
@@ -85,4 +90,6 @@ class AsyncPrinter: public Print
8590
void _attachCallbacks();
8691
};
8792

93+
/////////////////////////////////////////////////
94+
8895
#endif // _TEENSY41_ASYNC_PRINTER_HPP_

0 commit comments

Comments
 (0)