paneldue: use component_init for post initialization
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
799e763050
commit
e6bedd1ffe
|
@ -60,7 +60,6 @@ class SerialConnection:
|
||||||
self.send_busy: bool = False
|
self.send_busy: bool = False
|
||||||
self.send_buffer: bytes = b""
|
self.send_buffer: bytes = b""
|
||||||
self.attempting_connect: bool = True
|
self.attempting_connect: bool = True
|
||||||
self.event_loop.register_callback(self._connect)
|
|
||||||
|
|
||||||
def disconnect(self, reconnect: bool = False) -> None:
|
def disconnect(self, reconnect: bool = False) -> None:
|
||||||
if self.connected:
|
if self.connected:
|
||||||
|
@ -77,9 +76,10 @@ class SerialConnection:
|
||||||
logging.info("PanelDue Disconnected")
|
logging.info("PanelDue Disconnected")
|
||||||
if reconnect and not self.attempting_connect:
|
if reconnect and not self.attempting_connect:
|
||||||
self.attempting_connect = True
|
self.attempting_connect = True
|
||||||
self.event_loop.delay_callback(1., self._connect)
|
self.event_loop.delay_callback(1., self.connect)
|
||||||
|
|
||||||
async def _connect(self) -> None:
|
async def connect(self) -> None:
|
||||||
|
self.attempting_connect = True
|
||||||
start_time = connect_time = time.time()
|
start_time = connect_time = time.time()
|
||||||
while not self.connected:
|
while not self.connected:
|
||||||
if connect_time > start_time + 30.:
|
if connect_time > start_time + 30.:
|
||||||
|
@ -266,6 +266,9 @@ class PanelDue:
|
||||||
'M999': lambda args: "FIRMWARE_RESTART"
|
'M999': lambda args: "FIRMWARE_RESTART"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async def component_init(self) -> None:
|
||||||
|
await self.ser_conn.connect()
|
||||||
|
|
||||||
async def _process_klippy_ready(self) -> None:
|
async def _process_klippy_ready(self) -> None:
|
||||||
# Request "info" and "configfile" status
|
# Request "info" and "configfile" status
|
||||||
retries = 10
|
retries = 10
|
||||||
|
|
Loading…
Reference in New Issue