An mcu device acting as an "mcu bridge" should only be reset after
other normal devices are reset - otherwise the bridge wont be able to
pass along the reset message to the downstream mcus.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The `logging.basicConfig` does not reconfigure default logger.
This results in printing only warnings/errors to stderr
instead of also info (or debug).
This fixes the issue by setting log level on root logger.
Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
Minor indentation and variable name changes.
Don't remove linebreaks from message_protocol_error lines.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The MCU protocol error message often confuses users, especially after getting bombarded with the config format error line. This PR tries to improve it and has the following goals:
- Put the technical error at the end to prevent confusion and avoid the immediate jump to help channels instead of continuing to read
- Inform the user first what the type of error is (In this case: MCU Protocol error) and not at the end of the long error message
- Give the users a clear instruction what to do (pretty much unchanged), but possibly more approachable because the user is not confused by the technical error anymore
- Shows the version numbers of Klipper separate from all MCU version numbers so that it is more obvious that this is the version of Klipper
- Separates the version numbers between outdated MCUs and up-to-date MCUs, so that it becomes obvious if a MCU flash failed because the MCU doesn't disappear from the outdated list
- Previously, when viewing the errors in a web frontend, additional line breaks made it extremely hard to read the message, sometimes with as little as one word on one line. The error messages are now formatted to not have rogue line breaks, improving readability.
Signed-off-by: Felicia Alexa Hummel <felicia@drachenkatze.org>
Add a test case to verify that every optional module successfully
loads on both Python2 and Python3. This is intended to catch syntax
and module imports that are not compatible between Python versions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for performing Python gc work only from the main reactor
thread and only when it appears the main thread is idle.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Explicitly run the python garbage collector on a restart. This cleans
up memory from the previous session.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existence of a __del__() method prevents deallocation on python2
if there are circular references. Replace the __del__() method with a
new finalize() call and arrange for it to be called when the main
reactor is released.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Try to invoke a shutdown on an unhandled exception from reactor.run().
If that fails, try to do a clean exit.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new "gcode/subscribe_output" webhook endpoint to subscribe to
gcode output. Only client connections that subscribe to the gcode
output will receive that output.
This also moves all the gcode webhooks from gcode.py to webhooks.py
and arranges for gcode.py to be initialized prior to webhooks.py.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't default to "/tmp/klippy_uds" for the webhooks unix domain socket
filename. Instead, require the filename to be specified on the
command-line (via a new "-a" parameter).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename try_load_module() so that it uses consistent naming for
"printer objects". Change the function to raise an error by default
if the specified module does not exist.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The heater logic is an independent module that does not need to be
treated as part of the "core" klipper code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Break up the connect phase into two phases - mcu_identify and connect.
The first phase will contact all the micro-controllers and obtain the
"identify" data dictionaries for them. Once all the micro-controllers
have been contacted, then they can be configured. This fixes an issue
with FIRMWARE_RESTART not working correctly on multi-mcu setups that
use restart_method=command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Only update the status message with the first error report.
Subsequent errors are often the result of the first error and
reporting the last error can be misleading.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert all users of the printer_state("connect") handler to register
a "klippy:connect" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert all users of the printer_state("ready") handler to register a
"klippy:ready" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert all users of the printer_state("shutdown") handler to register
a "klippy:shutdown" event handler instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>