mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-07 23:17:37 -06:00
serialhdl: Update callers to decide serial fd type
Don't try to detect a "real serial port" in serialhdl.py. Instead, have the callers invoke either connect_uart(), connect_file(), or connect_pipe(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
bc2096f543
commit
9d3a3f3f30
4 changed files with 89 additions and 70 deletions
|
@ -777,9 +777,11 @@ class SDCardSPI:
|
|||
class MCUConnection:
|
||||
def __init__(self, k_reactor, device, baud, board_cfg):
|
||||
self.reactor = k_reactor
|
||||
self.serial_device = device
|
||||
self.baud = baud
|
||||
# TODO: a change in baudrate will cause an issue, come up
|
||||
# with a method for handling it gracefully
|
||||
self._serial = serialhdl.SerialReader(self.reactor, device, baud)
|
||||
self._serial = serialhdl.SerialReader(self.reactor)
|
||||
self.clocksync = clocksync.ClockSync(self.reactor)
|
||||
self.board_config = board_cfg
|
||||
self.fatfs = None
|
||||
|
@ -817,7 +819,7 @@ class MCUConnection:
|
|||
endtime = eventtime + 60.
|
||||
while True:
|
||||
try:
|
||||
self._serial.connect()
|
||||
self._serial.connect_uart(self.serial_device, self.baud)
|
||||
self.clocksync.connect(self._serial)
|
||||
except Exception:
|
||||
curtime = self.reactor.monotonic()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue