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>
This commit is contained in:
parent
106d1d2a2a
commit
56004c0228
|
@ -6,6 +6,10 @@ All dates in this document are approximate.
|
||||||
|
|
||||||
# Changes
|
# 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.
|
20201020: Klipper v0.9.0 released.
|
||||||
|
|
||||||
20200902: The RTD resistance-to-temperature calculation for MAX31865
|
20200902: The RTD resistance-to-temperature calculation for MAX31865
|
||||||
|
|
|
@ -391,20 +391,14 @@ class CommandWrapper:
|
||||||
class MCU:
|
class MCU:
|
||||||
error = error
|
error = error
|
||||||
def __init__(self, config, clocksync):
|
def __init__(self, config, clocksync):
|
||||||
self._printer = config.get_printer()
|
self._printer = printer = config.get_printer()
|
||||||
self._clocksync = clocksync
|
self._clocksync = clocksync
|
||||||
self._reactor = self._printer.get_reactor()
|
self._reactor = printer.get_reactor()
|
||||||
self._name = config.get_name()
|
self._name = config.get_name()
|
||||||
if self._name.startswith('mcu '):
|
if self._name.startswith('mcu '):
|
||||||
self._name = self._name[4:]
|
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
|
# Serial port
|
||||||
self._serialport = config.get('serial', '/dev/ttyS0')
|
self._serialport = config.get('serial')
|
||||||
serial_rts = True
|
serial_rts = True
|
||||||
if config.get('restart_method', None) == "cheetah":
|
if config.get('restart_method', None) == "cheetah":
|
||||||
# Special case: Cheetah boards require RTS to be deasserted, else
|
# Special case: Cheetah boards require RTS to be deasserted, else
|
||||||
|
@ -428,7 +422,7 @@ class MCU:
|
||||||
self._is_shutdown = self._is_timeout = False
|
self._is_shutdown = self._is_timeout = False
|
||||||
self._shutdown_msg = ""
|
self._shutdown_msg = ""
|
||||||
# Config building
|
# 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._oid_count = 0
|
||||||
self._config_callbacks = []
|
self._config_callbacks = []
|
||||||
self._config_cmds = []
|
self._config_cmds = []
|
||||||
|
@ -447,6 +441,12 @@ class MCU:
|
||||||
self._mcu_tick_avg = 0.
|
self._mcu_tick_avg = 0.
|
||||||
self._mcu_tick_stddev = 0.
|
self._mcu_tick_stddev = 0.
|
||||||
self._mcu_tick_awake = 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
|
# Serial callbacks
|
||||||
def _handle_mcu_stats(self, params):
|
def _handle_mcu_stats(self, params):
|
||||||
count = params['count']
|
count = params['count']
|
||||||
|
|
Loading…
Reference in New Issue