power: improves GPIO initial_state handling

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
This commit is contained in:
Pedro Lamas authored and Eric Callahan committed 2021-11-11 19:09:06 -05:00
1 parent 7ff126a56e
commit a3ba4b4169
1 file changed
+4 -2
+4 -2
View File
@@ -478,10 +478,12 @@ class GpioDevice(PowerDevice):
if invert:
self.line.request(
consumer="moonraker", type=gpiod.LINE_REQ_DIR_OUT,
flags=gpiod.LINE_REQ_FLAG_ACTIVE_LOW)
flags=gpiod.LINE_REQ_FLAG_ACTIVE_LOW,
default_val=int(self.initial_state))
else:
self.line.request(
consumer="moonraker", type=gpiod.LINE_REQ_DIR_OUT)
consumer="moonraker", type=gpiod.LINE_REQ_DIR_OUT,
default_val=int(self.initial_state))
except Exception:
self.state = "error"
logging.exception(