Graceful sleep between failed serial read attempts
This commit is contained in:
parent
5bc7319933
commit
c4d3e6b467
1 changed files with 2 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import serial
|
||||
import time
|
||||
|
||||
from platypush.plugins import Plugin, action
|
||||
from platypush.plugins.gpio.sensor import GpioSensorPlugin
|
||||
|
@ -88,6 +89,7 @@ class SerialPlugin(GpioSensorPlugin):
|
|||
try:
|
||||
ser = self._get_serial()
|
||||
except:
|
||||
time.sleep(1)
|
||||
ser = self._get_serial(reset=True)
|
||||
|
||||
data = self._read_json(ser)
|
||||
|
|
Loading…
Reference in a new issue