|
@@ -616,7 +616,7 @@ class DMXCH(object):
|
|
|
def exec_id(self,_id=None):
|
|
|
if type(_id) is not type(None):
|
|
|
self._exec_id = _id
|
|
|
- print("set exec_id",_id)
|
|
|
+
|
|
|
return self._exec_id
|
|
|
|
|
|
def __repr__(self):
|
|
@@ -810,6 +810,7 @@ class Main():
|
|
|
|
|
|
|
|
|
self.fx = {}
|
|
|
+ self.lock = thread.allocate_lock()
|
|
|
def loop(self):
|
|
|
|
|
|
|
|
@@ -837,6 +838,7 @@ class Main():
|
|
|
artnet.dmx = [0]*512
|
|
|
|
|
|
while 1:
|
|
|
+ self.lock.acquire_lock()
|
|
|
t = clock.time()
|
|
|
ii = 0
|
|
|
old_univ = -1
|
|
@@ -924,6 +926,8 @@ class Main():
|
|
|
try:
|
|
|
artnet.next()
|
|
|
except:pass
|
|
|
+ self.lock.release_lock()
|
|
|
+
|
|
|
time.sleep(0.01)
|
|
|
|
|
|
main = Main()
|
|
@@ -956,7 +960,7 @@ def JCB(data): #json client input
|
|
|
out = {}
|
|
|
for x in cmds:
|
|
|
|
|
|
- cprint("json", x,type(x),color="yellow")
|
|
|
+
|
|
|
if "CMD" in x:
|
|
|
print("CMD:",x)
|
|
|
if "EXEC-SPEED-MASTER" == x["CMD"]:
|
|
@@ -1082,45 +1086,52 @@ def JCB(data): #json client input
|
|
|
|
|
|
|
|
|
|
|
|
- for DMX in out:
|
|
|
- line = out[DMX]
|
|
|
-
|
|
|
- if out[DMX]["fx"]:
|
|
|
- x = out[DMX]["fx"]
|
|
|
- Bdmx[DMX].fx(xtype=x["xtype"]
|
|
|
- ,size=x["size"]
|
|
|
- ,speed=x["speed"]
|
|
|
- ,invert=x["invert"]
|
|
|
- ,width=x["width"]
|
|
|
- ,start=x["start"]
|
|
|
- ,offset=x["offset"]
|
|
|
- ,base=x["base"]
|
|
|
- ,clock=x["clock"]
|
|
|
- ,master=["master"])
|
|
|
- if out[DMX]["flash_fx"]:
|
|
|
- x = out[DMX]["flash_fx"]
|
|
|
- Bdmx[DMX].flash_fx(xtype=x["xtype"]
|
|
|
- ,size=x["size"]
|
|
|
- ,speed=x["speed"]
|
|
|
- ,invert=x["invert"]
|
|
|
- ,width=x["width"]
|
|
|
- ,start=x["start"]
|
|
|
- ,offset=x["offset"]
|
|
|
- ,base=x["base"]
|
|
|
- ,clock=x["clock"]
|
|
|
- ,master=["master"])
|
|
|
- if out[DMX]["flash"]:
|
|
|
- x = out[DMX]["flash"]
|
|
|
- Bdmx[DMX].flash(target=x["target"]
|
|
|
- ,ftime=x["ftime"]
|
|
|
- ,clock=x["clock"]
|
|
|
- ,delay=x["delay"])
|
|
|
- if out[DMX]["fade"]:
|
|
|
- x = out[DMX]["fade"]
|
|
|
- Bdmx[DMX].fade(target=x["target"]
|
|
|
- ,ftime=x["ftime"]
|
|
|
- ,clock=x["clock"]
|
|
|
- ,delay=x["delay"])
|
|
|
+
|
|
|
+ try:
|
|
|
+ main.lock.acquire_lock()
|
|
|
+
|
|
|
+ for DMX in out:
|
|
|
+ line = out[DMX]
|
|
|
+
|
|
|
+ if out[DMX]["fx"]:
|
|
|
+ x = out[DMX]["fx"]
|
|
|
+ Bdmx[DMX].fx(xtype=x["xtype"]
|
|
|
+ ,size=x["size"]
|
|
|
+ ,speed=x["speed"]
|
|
|
+ ,invert=x["invert"]
|
|
|
+ ,width=x["width"]
|
|
|
+ ,start=x["start"]
|
|
|
+ ,offset=x["offset"]
|
|
|
+ ,base=x["base"]
|
|
|
+ ,clock=x["clock"]
|
|
|
+ ,master=x["master"])
|
|
|
+ if out[DMX]["flash_fx"]:
|
|
|
+ x = out[DMX]["flash_fx"]
|
|
|
+ Bdmx[DMX].flash_fx(xtype=x["xtype"]
|
|
|
+ ,size=x["size"]
|
|
|
+ ,speed=x["speed"]
|
|
|
+ ,invert=x["invert"]
|
|
|
+ ,width=x["width"]
|
|
|
+ ,start=x["start"]
|
|
|
+ ,offset=x["offset"]
|
|
|
+ ,base=x["base"]
|
|
|
+ ,clock=x["clock"]
|
|
|
+ ,master=x["master"])
|
|
|
+ if out[DMX]["flash"]:
|
|
|
+ x = out[DMX]["flash"]
|
|
|
+ Bdmx[DMX].flash(target=x["target"]
|
|
|
+ ,ftime=x["ftime"]
|
|
|
+ ,clock=x["clock"]
|
|
|
+ ,delay=x["delay"])
|
|
|
+ if out[DMX]["fade"]:
|
|
|
+ x = out[DMX]["fade"]
|
|
|
+ Bdmx[DMX].fade(target=x["target"]
|
|
|
+ ,ftime=x["ftime"]
|
|
|
+ ,clock=x["clock"]
|
|
|
+ ,delay=x["delay"])
|
|
|
+
|
|
|
+ finally:
|
|
|
+ main.lock.release_lock()
|
|
|
|
|
|
|
|
|
|
|
@@ -1128,6 +1139,7 @@ def JCB(data): #json client input
|
|
|
cprint("EXCEPTION JCB",e,color="red")
|
|
|
cprint("----",str(jdata)[:150],"...",color="red")
|
|
|
cprint("Error on line {}".format(sys.exc_info()[-1].tb_lineno),color="red")
|
|
|
+ raise e
|
|
|
|
|
|
|
|
|
|