-
Notifications
You must be signed in to change notification settings - Fork 0
/
x0hdfurymode.py
31 lines (24 loc) · 886 Bytes
/
x0hdfurymode.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class X0HDFuryMode:
"""Class to set and report the HDFury follow mode"""
def __init__(self, useLog):
self.log = useLog
self.desired = None
self.mode = 'follow'
def action(self):
if not self.desired:
self.log.debug('Called with nothing to do')
return (True,self.mode)
self.mode = self.desired
self.log.debug(f'HDFury mode changed to {self.mode}')
self.desired = None
# we are done
return (True,self.mode)
def set(self, cmd:str, data: bytearray):
if self.desired:
self.log.error(f'Already set HDFuryMode to {self.desired}')
else:
self.desired = 'follow'
if cmd == 'ignore':
self.desired = 'ignore'
self.log.debug(f'Asked to set HDFuryMode to {self.desired}')
# self.action()