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