Fixed controller state sharing
This commit is contained in:
parent
e917f3b98b
commit
78e62fd013
2 changed files with 8 additions and 7 deletions
2
demo.py
2
demo.py
|
|
@ -12,4 +12,4 @@ if __name__ == "__main__":
|
|||
|
||||
while True:
|
||||
time.sleep(1)
|
||||
print(nxbt.get_state())
|
||||
print(nxbt.get_state()[0])
|
||||
|
|
|
|||
13
nxbt/nxbt.py
13
nxbt/nxbt.py
|
|
@ -60,7 +60,6 @@ class Nxbt():
|
|||
cm = ControllerManager(state)
|
||||
|
||||
while True:
|
||||
|
||||
try:
|
||||
msg = task_queue.get_nowait()
|
||||
except queue.Empty:
|
||||
|
|
@ -122,17 +121,19 @@ class ControllerManager():
|
|||
def __init__(self, state):
|
||||
|
||||
self.state = state
|
||||
self.controller_resources = Manager()
|
||||
self.controller_states = []
|
||||
self.controller_queues = []
|
||||
|
||||
def create_controller(self, index, controller_type, adapter_path):
|
||||
|
||||
controller_queue = Queue()
|
||||
controller_state = {
|
||||
"state": "initializing",
|
||||
"finished_macros": [],
|
||||
"errors": False
|
||||
}
|
||||
|
||||
controller_state = self.controller_resources.dict()
|
||||
controller_state["state"] = "initializing"
|
||||
controller_state["finished_macros"] = []
|
||||
controller_state["errors"] = False
|
||||
|
||||
self.state[index] = controller_state
|
||||
# Get the last parameter of the path, AKA the ID
|
||||
device_id = adapter_path.split("/")[-1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue