kopia lustrzana https://github.com/tayfunulu/WiFiManager
make connection wait loop more readable
| is the bitwise or operator, you rather want a logical operator here.pull/3/head
rodzic
72292a72ab
commit
28e2aa5001
6
main.py
6
main.py
|
@ -11,10 +11,10 @@ def do_connect(ntwrk_ssid, netwrk_pass):
|
||||||
if not sta_if.isconnected():
|
if not sta_if.isconnected():
|
||||||
print('Trying to connect to %s...' % ntwrk_ssid)
|
print('Trying to connect to %s...' % ntwrk_ssid)
|
||||||
sta_if.connect(ntwrk_ssid, netwrk_pass)
|
sta_if.connect(ntwrk_ssid, netwrk_pass)
|
||||||
a = 0
|
retry = 0
|
||||||
while not sta_if.isconnected() | (a > 99):
|
while not sta_if.isconnected() and retry < 100:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
a += 1
|
retry += 1
|
||||||
print('.', end='')
|
print('.', end='')
|
||||||
if sta_if.isconnected():
|
if sta_if.isconnected():
|
||||||
print('\nConnected. Network config: ', sta_if.ifconfig())
|
print('\nConnected. Network config: ', sta_if.ifconfig())
|
||||||
|
|
Ładowanie…
Reference in New Issue