forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Milestone
Description
CircuitPython version
Adafruit CircuitPython 7.2.0-alpha.1-224-gac7a80753 on 2022-01-26; Adafruit QT Py ESP32S2 with ESP32S2
Adafruit CircuitPython 7.2.0-alpha.1-224-gac7a80753 on 2022-01-26; Saola 1 w/Wrover with ESP32S2
Code/REPL
import time
import wifi
from secrets import secrets
DELAY = 0.5 # this is fine, but 0-0.4 or so lead to Safe Mode after a couple of pings
wifi.radio.connect(secrets['ssid'], secrets['password'])
while True:
print(f"LAN ping: {wifi.radio.ping(wifi.radio.ipv4_gateway)}s")
time.sleep(DELAY)
Behavior
code.py output:
LAN ping: 0.009s
LAN ping: 0.237s
LAN ping: 0.004s
LAN ping: 0.002s
[tio 10:38:58] Disconnected
[tio 10:39:00] Connected
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
Press any key to enter the REPL. Use CTRL-D to reload.
Description
It's a little more resilient if the same IP address isn't ping
ed repeatedly:
import time
import wifi
import ipaddress
from secrets import secrets
DELAY = 0.1 # Safe Mode after about 10 pings
wifi.radio.connect(secrets['ssid'], secrets['password'])
for _ in range(0, 256):
ipv4 = ipaddress.ip_address(".".join((repr(wifi.radio.ipv4_gateway).rpartition(".")[0], str(_))))
print(f"LAN ping: {str(ipv4):15} {wifi.radio.ping(ipv4)} s")
time.sleep(DELAY)
Additional information
I think this has been an issue since the beginning of wifi
iirc. Not a showstopper, just don't ping
too fast.