diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-10-28 12:47:59 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-10-28 15:35:08 -0400 |
commit | 56004c0228d68a39b4141eb557fe796e7c4c3bbb (patch) | |
tree | b24ec45cfaa639892f3380f5aba5bcf2d7be000a | |
parent | 106d1d2a2aea4d8b15cb22d7e4382d417fd3c554 (diff) | |
download | kutter-56004c0228d68a39b4141eb557fe796e7c4c3bbb.tar.gz kutter-56004c0228d68a39b4141eb557fe796e7c4c3bbb.tar.xz kutter-56004c0228d68a39b4141eb557fe796e7c4c3bbb.zip |
mcu: Don't default serial config option to /dev/ttyS0
If the mcu config section is omitted, it leads to confusing error
messages. Don't default the serial config option to /dev/ttyS0 to
improve the error reporting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | docs/Config_Changes.md | 4 | ||||
-rw-r--r-- | klippy/mcu.py | 20 |
2 files changed, 14 insertions, 10 deletions
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'] |