forget about devices that have been disconnected for too long
This commit is contained in:
parent
4100e8c625
commit
42ef44e2e2
|
@ -14,10 +14,10 @@ from .constants import *
|
|||
|
||||
NAME = 'Wireless Solar Keyboard K750'
|
||||
|
||||
_STATUS_NAMES = ('excellent', 'good', 'okay', 'poor')
|
||||
_STATUS_NAMES = ('excellent', 'good', 'okay', 'poor', 'very low')
|
||||
|
||||
_CHARGE_LIMITS = (75, 40, 20, -1)
|
||||
_LIGHTING_LIMITS = (450, 310, 190, -1)
|
||||
_CHARGE_LIMITS = (75, 40, 20, 10, -1)
|
||||
_LIGHTING_LIMITS = (400, 200, 50, 20, -1)
|
||||
|
||||
#
|
||||
#
|
||||
|
|
10
solaar.py
10
solaar.py
|
@ -28,7 +28,7 @@ NO_DEVICES = 'No devices attached.'
|
|||
NO_RECEIVER = 'Unifying Receiver not found.'
|
||||
FOUND_RECEIVER = 'Unifying Receiver found.'
|
||||
|
||||
STATUS_TIMEOUT = 31 # seconds
|
||||
STATUS_TIMEOUT = 61 # seconds
|
||||
ICON_UPDATE_SLEEP = 7 # seconds
|
||||
|
||||
#
|
||||
|
@ -198,7 +198,13 @@ class StatusThread(threading.Thread):
|
|||
device_status[1] = status_code
|
||||
device_status[2] = status_text
|
||||
|
||||
if old_status_code != status_code:
|
||||
if old_status_code == status_code:
|
||||
# the device has been missing twice in a row (1 to 2 minutes), so
|
||||
# forget about it
|
||||
if status_code == DEVICE_STATUS.UNAVAILABLE:
|
||||
del self.devices[devinfo.number]
|
||||
del self.statuses[devinfo.number]
|
||||
else:
|
||||
logging.debug("device status changed from %s => %s: %s", old_status_code, status_code, status_text)
|
||||
notify_desktop(status_code, devinfo.name, status_text)
|
||||
|
||||
|
|
Loading…
Reference in New Issue