From 28e2aa500165116fdf1504269dbdcc856841cbc5 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 11 Dec 2017 15:18:39 +0100 Subject: [PATCH] make connection wait loop more readable | is the bitwise or operator, you rather want a logical operator here. --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index d44cb3e..d2665bb 100644 --- a/main.py +++ b/main.py @@ -11,10 +11,10 @@ def do_connect(ntwrk_ssid, netwrk_pass): if not sta_if.isconnected(): print('Trying to connect to %s...' % ntwrk_ssid) sta_if.connect(ntwrk_ssid, netwrk_pass) - a = 0 - while not sta_if.isconnected() | (a > 99): + retry = 0 + while not sta_if.isconnected() and retry < 100: time.sleep(0.1) - a += 1 + retry += 1 print('.', end='') if sta_if.isconnected(): print('\nConnected. Network config: ', sta_if.ifconfig())