Skip to content
Snippets Groups Projects
Commit 86a04205 authored by kr69sugu's avatar kr69sugu
Browse files

add dmx_data_received listener and log error if none is received

parent 84dbf6a1
No related branches found
No related tags found
No related merge requests found
...@@ -18,8 +18,9 @@ import sys ...@@ -18,8 +18,9 @@ import sys
# # # # # # # # # # # # # #
FAIL_DMX=3 FAIL_DMX=3
FAIL_DMX_SEND=4 FAIL_DMX_SEND=4
FAIL_LOG=5 FAIL_DMX_RECEIVE=5
FAIL_MOON=6 FAIL_LOG=6
FAIL_MOON=7
# either fullpath or just name (then logFile will be created in scriptdir) # either fullpath or just name (then logFile will be created in scriptdir)
# or fullpath containing '/' # or fullpath containing '/'
...@@ -31,6 +32,7 @@ moonDmx=0 ...@@ -31,6 +32,7 @@ moonDmx=0
#dmx setup #dmx setup
wrapper = None wrapper = None
UNIVERSE = 10 UNIVERSE = 10
dmxDataReceived = False
MAX_DMX_FRAME_SIZE = 512 MAX_DMX_FRAME_SIZE = 512
...@@ -237,6 +239,8 @@ def dmxSent(status): ...@@ -237,6 +239,8 @@ def dmxSent(status):
else: else:
log('\t' + str(moonLux) + "\t" + str(moonDmx) + "\t" + str(skyglow)) log('\t' + str(moonLux) + "\t" + str(moonDmx) + "\t" + str(skyglow))
def dmxReceive(data):
print("Dmx, data received:" + data)
def main(args=""): def main(args=""):
...@@ -285,10 +289,14 @@ def main(args=""): ...@@ -285,10 +289,14 @@ def main(args=""):
client = wrapper.Client() client = wrapper.Client()
# send 1 dmx frame with values for channels 1-3 for all ecounits # send 1 dmx frame with values for channels 1-3 for all ecounits
client.SendDmx(UNIVERSE, data, dmxSent) client.SendDmx(UNIVERSE, data, dmxSent)
client.RegisterUniverse(UNIVERSE, client.REGISTER, dmxReceive)
wrapper.Run() wrapper.Run()
except Exception as e: except Exception as e:
error(FAIL_DMX,e) error(FAIL_DMX,e)
if not dmxDataReceived:
error(FAIL_DMX_RECEIVE)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment