Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve network reliability in beta.18->beta.20 #201

Merged
merged 4 commits into from
Jan 5, 2022

Conversation

brentru
Copy link
Member

@brentru brentru commented Jan 4, 2022

Improvements to network FSM (runNetFSM):

  • Unrecoverable errors with WiFi and MQTT network connectivity failures cause the device to reset completely, instead of hanging forever.
  • Implement a WiFi reconnect delay from the application code to avoid rapid-connection attempts.
  • Queries the adapter's status from the application, instead of relying on a control flow within the interface itself.

Addresses #199


Test: A wippersnapper device is connected and running. The wireless network goes offline
during runtime and comes back later to simulate an intermittent connectivity problem.
Hardware Tested: Adafruit QT Py ESP32-S2

Beta.20 Behavior

MQTT ping packet:
[0xC0], [0x00],
Client sendPacket returned: 2
Read data: [0xD0],
Packet Type: [0xD0],
Read data: [0x00],
Packet Length: 0
*** Rapid attempt to reconnect, too many attempts in succession ***
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
Connecting to: io.adafruit.com
Connect result: 0
ERROR: Unable to connect to Adafruit.IO
*** Device never reboots, stalls and blinks ***

Beta.21 Behavior

Read data: [0x00], [0x0B],
Publish QOS1+ reply: @ [0x40], [0x02], [0x00], [0x0B],
PUBLISHED!
*** DISCONNECTED NETWORK ***
Packet Length: 0
networkStatus: 6
Attempting to connect to WiFi...
networkStatus: 1
Attempting to connect to WiFi...
networkStatus: 1
Attempting to connect to WiFi...
networkStatus: 1
Attempting to connect to WiFi...
networkStatus: 1
Attempting to connect to WiFi...
networkStatus: 1
Attempting to connect to WiFi...
networkStatus: 1
networkStatus: 1
ERROR [WDT RESET]: ERROR: Unable to connect to WiFi, rebooting soon...
*** RECONNECTED NETWORK ***
*** DEVICE REBOOTED ***
Attempting to connect to WiFi...
networkStatus: 3
networkStatus: 3
networkStatus: 3
FSM_NET_ESTABLISH_MQTT
Connecting to: io.adafruit.com
Connect result: 1
MQTT connect packet:
....

Test: A WipperSnapper device can not connect to an offline wireless network.
Hardware Tested: Adafruit QT Py ESP32-S2

beta.20

15:47:59.340 -> ERROR: Unable to connect to Wireless Network
*** HANGS ***

beta.21

ERROR: Unable to connect to Wireless Network
Attempting to connect to WiFi...
Attempting to connect to WiFi...
Attempting to connect to WiFi...
Attempting to connect to WiFi...
Attempting to connect to WiFi...
ERROR [WDT RESET]: ERROR: Unable to connect to WiFi, rebooting soon...
*** REBOOT ***

@brentru brentru merged commit 4746949 into master Jan 5, 2022
@brentru brentru deleted the reconnect-reliability-tweaks branch January 5, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant