respeed
This commit is contained in:
parent
af0a536a26
commit
325b0c229b
@ -56,7 +56,7 @@ DMXRST = 88.0 # typical 88µs
|
|||||||
DMXBRK = 8.0 # 8µs (min) to 1s (max)
|
DMXBRK = 8.0 # 8µs (min) to 1s (max)
|
||||||
|
|
||||||
# DMX Sequence sleep [ms]/float
|
# DMX Sequence sleep [ms]/float
|
||||||
DMXSLP = 5000.0 #250.0 # 0µs (min) to 1s (max)
|
DMXSLP = 250.0 # 0µs (min) to 1s (max)
|
||||||
|
|
||||||
# Buffer for RDM
|
# Buffer for RDM
|
||||||
DMXRDM = "<initial>"
|
DMXRDM = "<initial>"
|
||||||
@ -101,8 +101,8 @@ def sendDMX(data):
|
|||||||
global DMXRDM
|
global DMXRDM
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
with serial.Serial('/dev/serial0', baudrate=250000, timeout=1, stopbits=serial.STOPBITS_TWO, bytesize=8) as DMXSER:# UART configuration and definition
|
with serial.Serial('/dev/serial0', baudrate=250000, timeout=DMXSLP, stopbits=serial.STOPBITS_TWO, bytesize=8) as DMXSER:# UART configuration and definition
|
||||||
DMXSER.cancel_read()
|
#DMXSER.cancel_read()
|
||||||
|
|
||||||
# GPIO_18 to switch RS-485 driver (IC1) to TX-mode
|
# GPIO_18 to switch RS-485 driver (IC1) to TX-mode
|
||||||
GPIO.output(18, GPIO.HIGH)
|
GPIO.output(18, GPIO.HIGH)
|
||||||
@ -111,25 +111,20 @@ def sendDMX(data):
|
|||||||
DMXSER.send_break(DMXRST / 1000000.0)
|
DMXSER.send_break(DMXRST / 1000000.0)
|
||||||
|
|
||||||
# break-time
|
# break-time
|
||||||
#-----------------------------------------------------------------------time.sleep(DMXBRK / 1000000.0)
|
time.sleep(DMXBRK / 1000000.0)
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
# send complete data array
|
# send complete data array
|
||||||
DMXSER.write(bytearray(DMXDATA))
|
DMXSER.write(bytearray(DMXDATA))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# GPIO_18 to switch RS-485 driver (IC1) to RX-mode
|
# GPIO_18 to switch RS-485 driver (IC1) to RX-mode
|
||||||
DMXSER.reset_input_buffer()
|
DMXSER.reset_input_buffer()
|
||||||
GPIO.output(18, GPIO.LOW)
|
GPIO.output(18, GPIO.LOW)
|
||||||
|
|
||||||
# Sleep between TX packages, use time to get RDM packages
|
# Sleep between TX packages, use time to get RDM packages
|
||||||
#DMXRDM = ""
|
DMXRDM = DMXSER.read(400)
|
||||||
#DMXRDMFLAG = False
|
|
||||||
|
|
||||||
time.sleep(2)
|
|
||||||
#-----------------------------------------------------------------------DMXSER.timeout(DMXSLP / 1000.0) # between 0 - 1 sec
|
|
||||||
DMXRDM = DMXSER.read(size=10)
|
|
||||||
print("input", DMXRDM)
|
|
||||||
#DMXRDMFLAG = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user