wait for tx empty

This commit is contained in:
2020-08-29 14:33:32 +02:00
parent 1ecc18dfee
commit 0e01b0b1df

View File

@ -2,6 +2,8 @@ import wiringpi
from time import sleep from time import sleep
import serial import serial
from enum import Enum from enum import Enum
import array
LOOP_ENABLE = 18 LOOP_ENABLE = 18
LOOP_DISABLE = 23 LOOP_DISABLE = 23
@ -114,9 +116,13 @@ class MeterbusSerial(object):
self.port.write(msg) self.port.write(msg)
# FIXME: Attention, the actual write time of the interface is not considered. buf = array.array('h', [0])
# This is a measured value. while True:
sleep(0.030) fcntl.ioctl(self.port.fileno(), termios.TIOCSERGETLSR, buf, 1)
if self.buf[0] & termios.TIOCSER_TEMT:
break
sleep(0.001)
frontendHold() frontendHold()
frontendRxEnable(True) frontendRxEnable(True)