aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
Commit message (Collapse)AuthorAgeFilesLines
* klippy: Report "shutdown" category from get_state_message()Kevin O'Connor2020-08-161-0/+2
| | | | | | Reported by @Arksine. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* webhooks: Require a subscription to receive gcode outputKevin O'Connor2020-08-161-1/+1
| | | | | | | | | | | 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>
* webhooks: Specify server_address on klippy command-lineKevin O'Connor2020-08-161-1/+4
| | | | | | | | 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>
* webhooks: Introduce add_early_printer_objects()Kevin O'Connor2020-08-061-2/+3
| | | | | | | Create the initial gcode class via new module level add_early_printer_objects() function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Introduce add_early_printer_objects()Kevin O'Connor2020-08-061-1/+1
| | | | | | | Create the initial gcode class via new module level add_early_printer_objects() function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Pass the pseudo-tty fd via the start_args systemKevin O'Connor2020-08-061-7/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* 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>