File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
ESP32_S2_WiFi_Tests/CPy_Native_WiFi_Test Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 30
30
print (f"My IP address: { wifi .radio .ipv4_address } " )
31
31
32
32
ping_ip = ipaddress .IPv4Address ("8.8.8.8" )
33
- ping = wifi .radio .ping (ip = ping_ip ) * 1000
34
- if ping is not None :
35
- print ( f"Ping google.com: { ping } ms" )
36
- else :
33
+ ping = wifi .radio .ping (ip = ping_ip )
34
+
35
+ # retry once if timed out
36
+ if ping is None :
37
37
ping = wifi .radio .ping (ip = ping_ip )
38
- print (f"Ping google.com: { ping } ms" )
38
+
39
+ if ping is None :
40
+ print ("Couldn't ping 'google.com' successfully" )
41
+ else :
42
+ # convert s to ms
43
+ print (f"Pinging 'google.com' took: { ping * 1000 } ms" )
39
44
40
45
pool = socketpool .SocketPool (wifi .radio )
41
46
requests = adafruit_requests .Session (pool , ssl .create_default_context ())
You can’t perform that action at this time.
0 commit comments