aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
Commit message (Collapse)AuthorAgeFilesLines
* klippy: return message category in get_state_message()Arksine2020-06-241-1/+7
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* klippy: Instantiate the webhooks moduleArksine2020-06-241-4/+7
| | | | | | Add 'cpu_info' to start_args so it may be reported via the "info" endpoint in webhooks.py. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* klippy: Rename try_load_module() to load_object()Kevin O'Connor2020-05-081-6/+11
| | | | | | | | 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>
* klippy: Minor code movementKevin O'Connor2020-05-081-5/+5
| | | | | | Move set_rollover_info() - no code changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heaters: Make heater.py an "extras" moduleKevin O'Connor2020-04-251-2/+2
| | | | | | | 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>
* klippy: Add an is_shutdown() methodKevin O'Connor2020-04-251-3/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Log shutdown state in invoke_shutdown()Kevin O'Connor2020-03-241-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* util: Try to dump mcu build information on a connection errorKevin O'Connor2020-03-221-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Contact and identify all the mcus prior to configuring themKevin O'Connor2019-11-061-0/+1
| | | | | | | | | | | 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>
* klippy: Warn if starting klippy with logging disabledKevin O'Connor2019-09-011-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Only set the run_result if it hasn't already been setKevin O'Connor2019-06-281-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Provide global access to a printer.command_error exception classKevin O'Connor2019-06-061-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Report the underlying error on an internal error during connectKevin O'Connor2019-04-041-5/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Wrap code to 80 columnsKevin O'Connor2019-02-271-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Report the first error generatedKevin O'Connor2019-01-111-1/+2
| | | | | | | | 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>
* klippy: Fix error handling during connect phaseKevin O'Connor2019-01-081-0/+4
| | | | | | | Make sure to exit the _connect() method if a connect event handler raises an error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Convert printer_state("connect") to an event handlerKevin O'Connor2019-01-081-6/+2
| | | | | | | 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>
* klippy: Convert printer_state("ready") to an event handlerKevin O'Connor2019-01-081-7/+10
| | | | | | | 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>
* klippy: Convert printer_state("shutdown") to an event handlerKevin O'Connor2019-01-081-5/+8
| | | | | | | 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>
* klippy: No need to return anything from _connect() methodKevin O'Connor2018-10-181-3/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add a basic event dispatch mechanismKevin O'Connor2018-10-161-0/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Move config file code from klippy.py to new fileKevin O'Connor2018-09-251-110/+11
| | | | | | | Add a klippy/configfile.py file with the code needed to read the main printer config file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Send proactive state messagesKevin O'Connor2018-09-121-1/+1
| | | | | | Send a g-code info message on printer state changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Remove unneeded loop in run() methodKevin O'Connor2018-09-121-18/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Log MCU information before configuringKevin O'Connor2018-09-031-2/+3
| | | | | | | | Log the details of the MCU prior to attempting to configure the MCU. This way, the log contains the MCU information even if a configuration error occurs. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* statistics: Move stats handling to new "extras" moduleKevin O'Connor2018-09-021-14/+1
| | | | | | Move the generation of statistics to its own module. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename lookup_module_objects() to lookup_objects()Kevin O'Connor2018-09-021-6/+9
| | | | | | Rename the method and support returning all known objects. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Use reactor register_callback() mechanismKevin O'Connor2018-09-021-9/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Move tracking of accessed config items into _read_config() methodKevin O'Connor2018-08-031-8/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Move kinematic modules to new kinematics/ directoryKevin O'Connor2018-07-121-2/+2
| | | | | | | | Move extruder.py, cartesian.py, corexy.py, and delta.py to a new kinematics/ sub-directory. This is intended to make adding new kinematics a little easier. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: No need to pass printer reference to add_printer_objects()Kevin O'Connor2018-07-121-2/+2
| | | | | | The config reference already stores a reference to the printer object. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow extras modules to be directoriesKevin O'Connor2018-06-271-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: try_load_module() should return the module loadedKevin O'Connor2018-06-201-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Return an error code if batch input results in an errorKevin O'Connor2018-06-161-10/+18
| | | | | | | When reading from a debug input file, propagate any errors to the program return status. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Fix detection of mixed case section namesKevin O'Connor2018-05-251-3/+3
| | | | | | | If a section name had mixed case it would cause an incorrect error during the section/option config checking. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Reword the error messages during config file parsingKevin O'Connor2018-04-201-5/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Add PrinterHeaters class that stores all sensors and heatersKevin O'Connor2018-04-041-3/+3
| | | | | | | | | | | | Add a PrinterHeaters class that can stores references to available temperature sensors and stores references to instantiated heaters. Add a extras/heater_bed.py file and delay instantiation of the heater_bed object. This allows the heater.py module to be imported earlier during the setup phase, and allows the PrinterHeaters class to be available for registering sensors and heaters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Automatically clear rollover_info on each restartKevin O'Connor2018-04-031-9/+10
| | | | | | | Automatically clear the information printed at the start of each log file rollover on a klippy internal restart. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* output_pin: Move pwm and digital output pins to new module in extras/Kevin O'Connor2018-03-171-2/+2
| | | | | | | | Rename the digital_output, pwm_output, and static_pwm_output config sections to output_pin and move to a new module in the extras/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rework starting error messageKevin O'Connor2018-03-121-1/+1
| | | | | | | Commit 9bc4239e now emphasizes the first line of a multi-line error message, so rework startup_message to conform to that. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow external callers of try_load_module()Kevin O'Connor2018-03-111-2/+2
| | | | | | | It can be useful to automatically pull in a module in the extras/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow any stats producer to determine when stats are neededKevin O'Connor2018-02-051-7/+3
| | | | | | | | Instead of using the toolhead class to determine if stats should be reported, allow every printer object with a stats() callback to determine if stats are needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Introduce load_config_prefix() for modules that take parametersKevin O'Connor2018-02-031-2/+8
| | | | | | | | Use both load_config() and load_config_prefix() functions when dynamically loading a module from the extras directory - if the config section name has parameters in it then use load_config_prefix(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: No need to store fileconfig in main printer objectKevin O'Connor2018-02-031-24/+22
| | | | | | Just pass the fileconfig reference to the ConfigWrapper instances. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Move fan code to extras directoryKevin O'Connor2018-01-281-2/+2
| | | | | | | The print cooling fan and printer heater_fan are independent modules that can reside in the extras directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add support for dynamic loading of python modulesKevin O'Connor2018-01-281-3/+17
| | | | | | | | Check if a config section matches a python filename in the klippy/extras/ directory. If it does, load that python code to handle the config section. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support generic printer_state() and stats() callbacksKevin O'Connor2018-01-281-27/+30
| | | | | | | | | | | Instead of hardcoding which objects are called on state transitions, allow any "printer object" to be invoked if it has a printer_state() method. Convert connect, ready, shutdown, and disconnect callbacks to this mechanism. Similarly, allow all printer objects to provide a stats() callback. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add access methods and avoid peeking into the printer classesKevin O'Connor2018-01-281-12/+37
| | | | | | | | | Add get_reactor(), lookup_object(), lookup_module_objects(), and set_rollover_info() to the main Printer class so that callers do not need to peek into the class' members. Similarly, add get_printer() and get_name() methods to the ConfigWrapper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Move SET_SERVO command from gcode.py to chipmisc.pyKevin O'Connor2017-12-061-1/+1
| | | | | | | Now that commands can be registered dynamically, move the code for SET_SERVO from gcode.py to the PrinterServo() class in chipmisc.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Always recommend a FIRMWARE_RESTART on a shutdown eventKevin O'Connor2017-12-031-6/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>