forked from platypush/platypush
Revert "serial.write should have a blocking wait if the serial port is busy"
This reverts commit 0537d1fcac
.
This commit is contained in:
parent
0537d1fcac
commit
3b8c580611
1 changed files with 12 additions and 8 deletions
|
@ -131,7 +131,9 @@ class SerialPlugin(GpioSensorPlugin):
|
|||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
|
||||
with self.serial_lock:
|
||||
try:
|
||||
serial_available = self.serial_lock.acquire(timeout=2)
|
||||
if serial_available:
|
||||
try:
|
||||
ser = self._get_serial()
|
||||
except:
|
||||
|
@ -140,6 +142,8 @@ class SerialPlugin(GpioSensorPlugin):
|
|||
|
||||
self.logger.info('Writing {} to {}'.format(data, self.device))
|
||||
ser.write(data)
|
||||
finally:
|
||||
self.serial_lock.release()
|
||||
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
||||
|
|
Loading…
Reference in a new issue