Skip to content

Commit d481a64

Browse files
committed
la la la lint
1 parent 3407acd commit d481a64

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

examples/bluefruitspi_neocolorpicker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ def wait_for_connection():
4444
# This code will check the connection but only query the module if it has been
4545
# at least 'n_sec' seconds. Otherwise it 'caches' the response, to keep from
4646
# hogging the Bluefruit connection with constant queries
47-
connect_check_timestamp = None
47+
connection_timestamp = None
4848
is_connected = None
4949
def check_connection(n_sec):
50-
if (not connect_check_timestamp) or (time.monotonic() - connection_timestamp > n_sec):
50+
# pylint: disable=global-statement
51+
global connection_timestamp, is_connected
52+
if (not connection_timestamp) or (time.monotonic() - connection_timestamp > n_sec):
5153
connection_timestamp = time.monotonic()
5254
is_connected = bluefruit.connected
5355
return is_connected

examples/bluefruitspi_ruggedechotest.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,21 @@ def wait_for_connection():
3636
dotcount = (dotcount + 1) % 80
3737
if dotcount == 79:
3838
print("")
39-
time.sleep(0.5)
39+
time.sleep(0.5)
4040

4141
# This code will check the connection but only query the module if it has been
4242
# at least 'n_sec' seconds. Otherwise it 'caches' the response, to keep from
4343
# hogging the Bluefruit connection with constant queries
44-
connect_check_timestamp = None
44+
connection_timestamp = None
4545
is_connected = None
4646
def check_connection(n_sec):
47-
if (not connect_check_timestamp) or (time.monotonic() - connection_timestamp > n_sec):
47+
# pylint: disable=global-statement
48+
global connection_timestamp, is_connected
49+
if (not connection_timestamp) or (time.monotonic() - connection_timestamp > n_sec):
4850
connection_timestamp = time.monotonic()
4951
is_connected = bluefruit.connected
5052
return is_connected
51-
53+
5254
# Unlike most circuitpython code, this runs in two loops
5355
# one outer loop manages reconnecting bluetooth if we lose connection
5456
# then one inner loop for doing what we want when connected!

0 commit comments

Comments
 (0)