power: improves GPIO initial_state handling
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
This commit is contained in:
parent
7ff126a56e
commit
a3ba4b4169
|
@ -478,10 +478,12 @@ class GpioDevice(PowerDevice):
|
||||||
if invert:
|
if invert:
|
||||||
self.line.request(
|
self.line.request(
|
||||||
consumer="moonraker", type=gpiod.LINE_REQ_DIR_OUT,
|
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:
|
else:
|
||||||
self.line.request(
|
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:
|
except Exception:
|
||||||
self.state = "error"
|
self.state = "error"
|
||||||
logging.exception(
|
logging.exception(
|
||||||
|
|
Loading…
Reference in New Issue