1
1
# Introduction
2
2
3
3
This library provides a resilient full duplex communication link between a WiFi
4
- connected board and a server on the wired LAN. The board may be an ESP8266 or
5
- other target including the Pyboard D. The design is such that the code can run
6
- for indefinite periods. Temporary WiFi or server outages are tolerated without
7
- message loss.
4
+ connected board and a server on the wired LAN. The board may be an ESP8266,
5
+ ESP32 or other target including the Pyboard D. The design is such that the code
6
+ can run for indefinite periods. Temporary WiFi or server outages are tolerated
7
+ without message loss.
8
8
9
9
The API is simple and consistent between client and server applications,
10
10
comprising ` write ` and ` readline ` methods. Guaranteed message delivery is
@@ -22,9 +22,8 @@ reliability is therefore paramount. Security is also a factor for endpoints
22
22
exposed to the internet.
23
23
24
24
Under MicroPython the available hardware for endpoints is limited. Testing has
25
- been done on the ESP8266 and the Pyboard D. The ESP32 running official firmware
26
- V1.10 remains incapable of coping with WiFi outages: see
27
- [ Appendix 1 ESP32] ( ./README.md#appendix-1-esp32 ) .
25
+ been done on the ESP8266, ESP32 and the Pyboard D. The ESP32 must run firmware
26
+ dated on or after 25th March 2019.
28
27
29
28
The ESP8266 remains as a readily available inexpensive device which, with care,
30
29
is capable of long term reliable operation. It does suffer from limited
@@ -114,7 +113,6 @@ but one which persists through outages and offers guaranteed message delivery.
114
113
10 . [ How it works] ( ./README.md#10-how-it-works )
115
114
10.1 [ Interface and client module] ( ./README.md#101-interface-and-client-module )
116
115
10.2 [ Server module] ( ./README.md#102-server-module )
117
- [ Appendix 1 ESP32] ( ./README.md#appendix-1-esp32 )
118
116
119
117
# 2. Design
120
118
@@ -172,7 +170,8 @@ installation on that platform.
172
170
173
171
#### Firmware/Dependency
174
172
175
- On all client platforms firmware must be V1.10 or later.
173
+ Firmware must be V1.10 or later; on ESP32 it must be more recent, specifically
174
+ builds dated 25th March 2019 or later.
176
175
177
176
On ESP8266 it is easiest to use the latest release build of firmware: such
178
177
builds incorporate ` uasyncio ` as frozen bytecode. Daily builds do not.
@@ -190,7 +189,8 @@ On ESP8266 it is necessary to
190
189
191
190
#### Preconditions
192
191
193
- The demo programs store client configuration data in a file ` local.py ` . This
192
+ The demo programs store client configuration data in a file ` local.py ` . Each
193
+ demo has its own ` local.py ` located in the directory of the demo code. This
194
194
contains the following constants which should be edited to match local
195
195
conditions:
196
196
@@ -312,8 +312,9 @@ from micropython_iot.qos import c_qos
312
312
#### The fast qos demo
313
313
314
314
This tests the option of concurrent ` qos ` writes. This is an advanced feature
315
- discussed in [ section 7.1] ( ./README.md#71-the-wait-argument ) . To run the demo,
316
- on the server navigate to the parent directory of ` micropython_iot ` and run:
315
+ discussed in [ section 7.1] ( ./README.md#71-the-wait-argument ) . This demo runs
316
+ but is not resilient on ESP32. See the above link. To run the demo, on the
317
+ server navigate to the parent directory of ` micropython_iot ` and run:
317
318
```
318
319
python3 -m micropython_iot.qos.s_qos_fast
319
320
```
@@ -753,6 +754,10 @@ number of such `qos` messages sent in quick succession: on ESP8266 clients
753
754
buffer overflows can occur. Demands on ` uasyncio ` are increased: it may be
754
755
necessary to amend the default queue sizes in ` get_event_loop ` .
755
756
757
+ The ESP32 is not resilient under these circumstances. Setting ` wait=False ` is
758
+ not recommended. If used, applications should be tested to verify resilience in
759
+ the face of WiFi outages.
760
+
756
761
If messages are sent with ` wait=False ` there is a chance that they may not be
757
762
received in the order in which they were sent. As described above, in the event
758
763
of ` qos ` message loss, retransmission occurs after a timeout period has
@@ -888,19 +893,3 @@ messages to the client. Application code which blocks the scheduler can cause
888
893
this not to be scheduled in a timely fashion with the result that the client
889
894
declares an outage and disconnects. The consequence is a sequence of disconnect
890
895
and reconnect events even in the presence of a strong WiFi signal.
891
-
892
- # Appendix 1 ESP32
893
-
894
- Using official firmware V1.10 the ESP32 seems incapable of recovering from an
895
- outage. The client initially connects and runs. When an outage occurs this is
896
- detected in the usual way by a timeout. Unfortunately I failed to discover a
897
- strategy for detecting when the outage was over. The station interface
898
- ` isconnected ` method always returns ` True ` even if you explicitly disconnect.
899
- You can issue a ` connect ` statement but I could find no way to determine
900
- whether the attempt was successful.
901
-
902
- In my view the ESP32 running official MicroPython remains unsuitable for a
903
- resilient link.
904
-
905
- Contributions and suggestions are invited. Also any test results for the
906
- Loboris port.
0 commit comments