rdm again?

This commit is contained in:
Jens Ullmert 2022-07-27 15:55:48 +02:00
parent df5b0a9a92
commit df8a8025ba

View File

@ -102,7 +102,7 @@ def sendDMX(data):
while 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()
DMXSER.cancel_read()
# GPIO_18 to switch RS-485 driver (IC1) to TX-mode
GPIO.output(18, GPIO.HIGH)
@ -117,18 +117,29 @@ def sendDMX(data):
# send complete data array
DMXSER.write(bytearray(DMXDATA))
# we have to send a string
rtn = ""
# dont have to send DMXDATA[0], this is the start code
for index in range(1, len(DMXDATA)):
rtn += (str(index) + "=" + str(DMXDATA[index]) + "; ")
# give debug feedback
print("output ", rtn)
# GPIO_18 to switch RS-485 driver (IC1) to RX-mode
#DMXSER.reset_input_buffer()
DMXSER.reset_input_buffer()
GPIO.output(18, GPIO.LOW)
# Sleep between TX packages, use time to get RDM packages
#DMXRDM = ""
#DMXRDMFLAG = False
DMXRDM = ""
DMXRDMFLAG = False
time.sleep(2)
#-----------------------------------------------------------------------DMXSER.timeout(DMXSLP / 1000.0) # between 0 - 1 sec
#DMXRDM = DMXSER.readlines(hint=none)
#DMXRDMFLAG = True
DMXRDM = DMXSER.readline()
print("input", DMXRDM)
DMXRDMFLAG = True