MOD: run the script
This commit is contained in:
parent
7011108542
commit
c36f42ea9b
@ -100,32 +100,32 @@ def sendDMX(data):
|
|||||||
global DMXRDMFLAG
|
global DMXRDMFLAG
|
||||||
global DMXRDM
|
global DMXRDM
|
||||||
|
|
||||||
while False:#True:
|
|
||||||
with serial.Serial('/dev/serial0', baudrate=250000, timeout=1, stopbits=serial.STOPBITS_TWO, bytesize=8) as DMXSER:# UART configuration and definition
|
|
||||||
DMXSER.cancel_read()
|
|
||||||
|
|
||||||
# GPIO_18 to switch RS-485 driver (IC1) to TX-mode
|
with serial.Serial('/dev/serial0', baudrate=250000, timeout=1, stopbits=serial.STOPBITS_TWO, bytesize=8) as DMXSER:# UART configuration and definition
|
||||||
GPIO.output(18, GPIO.HIGH)
|
DMXSER.cancel_read()
|
||||||
|
|
||||||
# send reset
|
# GPIO_18 to switch RS-485 driver (IC1) to TX-mode
|
||||||
DMXSER.send_break(DMXRST / 1000000.0)
|
GPIO.output(18, GPIO.HIGH)
|
||||||
|
|
||||||
# break-time
|
# send reset
|
||||||
time.sleep(DMXBRK / 1000000.0)
|
DMXSER.send_break(DMXRST / 1000000.0)
|
||||||
|
|
||||||
# send complete data array
|
# break-time
|
||||||
DMXSER.write(bytearray(DMXDATA))
|
time.sleep(DMXBRK / 1000000.0)
|
||||||
|
|
||||||
# GPIO_18 to switch RS-485 driver (IC1) to RX-mode
|
# send complete data array
|
||||||
DMXSER.reset_input_buffer()
|
DMXSER.write(bytearray(DMXDATA))
|
||||||
GPIO.output(18, GPIO.LOW)
|
|
||||||
|
|
||||||
# Sleep between TX packages, use time to get RDM packages
|
# GPIO_18 to switch RS-485 driver (IC1) to RX-mode
|
||||||
DMXRDM = ""
|
DMXSER.reset_input_buffer()
|
||||||
DMXRDMFLAG = False
|
GPIO.output(18, GPIO.LOW)
|
||||||
DMXSER.timeout(DMXSLP / 1000.0) # between 0 - 1 sec
|
|
||||||
DMXRDM = DMXSER.readlines()
|
# Sleep between TX packages, use time to get RDM packages
|
||||||
DMXRDMFLAG = True
|
DMXRDM = ""
|
||||||
|
DMXRDMFLAG = False
|
||||||
|
DMXSER.timeout(DMXSLP / 1000.0) # between 0 - 1 sec
|
||||||
|
DMXRDM = DMXSER.readlines()
|
||||||
|
DMXRDMFLAG = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -339,3 +339,7 @@ GPIO.output(4, GPIO.LOW)
|
|||||||
asyncio.get_event_loop().run_until_complete(
|
asyncio.get_event_loop().run_until_complete(
|
||||||
websockets.serve(websworker, port=6789))
|
websockets.serve(websworker, port=6789))
|
||||||
asyncio.get_event_loop().run_forever()
|
asyncio.get_event_loop().run_forever()
|
||||||
|
|
||||||
|
print("start")
|
||||||
|
while True:
|
||||||
|
sendDMX(DMXDATA)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user