diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index 3f415c54..ba13ffc0 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -6,6 +6,10 @@ All dates in this document are approximate. # Changes +20201029: The serial option in the mcu config section no longer +defaults to /dev/ttyS0. In the rare situation where /dev/ttyS0 is the +desired serial port, it must be specified explicitly. + 20201020: Klipper v0.9.0 released. 20200902: The RTD resistance-to-temperature calculation for MAX31865 diff --git a/klippy/mcu.py b/klippy/mcu.py index df49c927..a6246fb8 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -391,20 +391,14 @@ class CommandWrapper: class MCU: error = error def __init__(self, config, clocksync): - self._printer = config.get_printer() + self._printer = printer = config.get_printer() self._clocksync = clocksync - self._reactor = self._printer.get_reactor() + self._reactor = printer.get_reactor() self._name = config.get_name() if self._name.startswith('mcu '): self._name = self._name[4:] - self._printer.register_event_handler("klippy:connect", self._connect) - self._printer.register_event_handler("klippy:mcu_identify", - self._mcu_identify) - self._printer.register_event_handler("klippy:shutdown", self._shutdown) - self._printer.register_event_handler("klippy:disconnect", - self._disconnect) # Serial port - self._serialport = config.get('serial', '/dev/ttyS0') + self._serialport = config.get('serial') serial_rts = True if config.get('restart_method', None) == "cheetah": # Special case: Cheetah boards require RTS to be deasserted, else @@ -428,7 +422,7 @@ class MCU: self._is_shutdown = self._is_timeout = False self._shutdown_msg = "" # Config building - self._printer.lookup_object('pins').register_chip(self._name, self) + printer.lookup_object('pins').register_chip(self._name, self) self._oid_count = 0 self._config_callbacks = [] self._config_cmds = [] @@ -447,6 +441,12 @@ class MCU: self._mcu_tick_avg = 0. self._mcu_tick_stddev = 0. self._mcu_tick_awake = 0. + # Register handlers + printer.register_event_handler("klippy:connect", self._connect) + printer.register_event_handler("klippy:mcu_identify", + self._mcu_identify) + printer.register_event_handler("klippy:shutdown", self._shutdown) + printer.register_event_handler("klippy:disconnect", self._disconnect) # Serial callbacks def _handle_mcu_stats(self, params): count = params['count']