You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Refined channel/power check (from workerThread) by implementing a list (currently only NEEWER-RGB176) that don't feed that data back - so we don't need to check them
- Refined setTheTable as well, implementing a check to not update the table if the data being submitted is the same as the data already in the table
- Added another second of delay before trying to re-link a light for the 2nd time
printDebugString("Attempting to link to light "+str(selectedLight+1) +" ["+availableLights[selectedLight][0].name+"] "+returnMACname() +" "+availableLights[selectedLight][0].address+" (Attempt "+str(currentAttempt) +" of "+str(maxNumOfAttempts) +")")
1303
-
1304
1307
try:
1305
1308
ifnotavailableLights[selectedLight][1].is_connected: # if the current device isn't linked to Bluetooth
1309
+
printDebugString("Attempting to link to light "+str(selectedLight+1) +" ["+availableLights[selectedLight][0].name+"] "+returnMACname() +" "+availableLights[selectedLight][0].address+" (Attempt "+str(currentAttempt) +" of "+str(maxNumOfAttempts) +")")
1306
1310
isConnected=awaitavailableLights[selectedLight][1].connect() # try connecting it (and return the connection status)
1307
1311
else:
1308
1312
isConnected=True# the light is already connected, so mark it as being connected
returnValue=False# if we're in CLI mode, and there is an error connecting to the light, return False
1316
1320
1317
1321
currentAttempt=currentAttempt+1
1318
-
awaitasyncio.sleep(3) # wait a few seconds before trying again
1322
+
awaitasyncio.sleep(4) # wait a few seconds before trying to link to the light again
1319
1323
else:
1320
1324
return"quit"
1321
1325
1322
1326
ifthreadAction=="quit":
1323
1327
return"quit"
1324
1328
else:
1325
1329
ifisConnected==True:
1326
-
printDebugString("Successfully linked to light "+str(selectedLight+1) +" ["+availableLights[selectedLight][0].name+"] "+returnMACname() +" "+availableLights[selectedLight][0].address)
1330
+
printDebugString("Successful link on light "+str(selectedLight+1) +" ["+availableLights[selectedLight][0].name+"] "+returnMACname() +" "+availableLights[selectedLight][0].address)
1327
1331
1328
1332
ifupdateGUI==True:
1329
-
mainWindow.setTheTable(["", "", "LINKED\n --- / ᴄʜ. ---", "Waiting to send..."], selectedLight) # if it's successful, show that in the table
1333
+
mainWindow.setTheTable(["", "", "LINKED", "Waiting to send..."], selectedLight) # if it's successful, show that in the table
1330
1334
else:
1331
1335
returnValue=True# if we're in CLI mode, and there is no error connecting to the light, return True
return""# if there is an error checking the characteristic, just quit out of this routine
1355
1359
1356
-
ifreceivedData!=""andlen(receivedData) >1andreceivedData[1] ==typeOfData: # if we've received data, and the data returned is the right *kind* of data, then return it
1357
-
break# we found data, so we can stop checking
1360
+
ifreceivedData!="": # if the recieved data is populated
1361
+
iflen(receivedData) >1: # if we have enough elements to get a status from
1362
+
ifreceivedData[1] ==typeOfData: # if the data returned is the correct *kind* of data
1363
+
break# stop scanning for data
1364
+
else: # if we have a list, but it doesn't have a payload in it (the light didn't supply enough data)
1365
+
receivedData="---"# then just re-set recievedData to the default string
1366
+
break# stop scanning for data
1358
1367
else:
1359
1368
awaitasyncio.sleep(0.25) # wait a little bit of time before checking again
0 commit comments