Added better error handling for macro input
This commit is contained in:
parent
bd61e0a0c6
commit
bd090a09d7
1 changed files with 11 additions and 2 deletions
13
nxbt/cli.py
13
nxbt/cli.py
|
|
@ -1,5 +1,6 @@
|
||||||
import argparse
|
import argparse
|
||||||
from random import randint
|
from random import randint
|
||||||
|
from time import sleep
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from .nxbt import Nxbt, PRO_CONTROLLER
|
from .nxbt import Nxbt, PRO_CONTROLLER
|
||||||
|
|
@ -180,8 +181,16 @@ def macro():
|
||||||
print("Connected!")
|
print("Connected!")
|
||||||
|
|
||||||
print("Running macro...")
|
print("Running macro...")
|
||||||
nx.macro(index, macro)
|
macro_id = nx.macro(index, macro, block=False)
|
||||||
print("Finished running macro. Exiting...")
|
while (True):
|
||||||
|
if nx.state[index]["state"] == "crashed":
|
||||||
|
print("Controller crashed while running macro")
|
||||||
|
print(nx.state[index]["errors"])
|
||||||
|
break
|
||||||
|
if macro_id in nx.state[index]["finished_macros"]:
|
||||||
|
print("Finished running macro. Exiting...")
|
||||||
|
break
|
||||||
|
sleep(1/30)
|
||||||
|
|
||||||
|
|
||||||
def list_switch_addresses():
|
def list_switch_addresses():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue