aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* klippy: Rework shutdown handlingKevin O'Connor2017-10-121-32/+41
| | | | | | | | | If an MCU signals a shutdown from the background thread, notify the main thread and handle the shutdown there. Dispatch shutdown handling from the main Printer() class instead of from the Toolhead class. This simplifies the shutdown logic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Avoid using '%' syntax when calling logging moduleKevin O'Connor2017-09-271-3/+3
| | | | | | | The logging module can build strings directly from printf syntax - no need to build the string first. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Initial support for multiple micro-controllersKevin O'Connor2017-09-201-10/+22
| | | | | | | | | Add initial support for controlling multiple independent micro-controllers from a single Klippy host instance. Add basic support for synchronizing the clocks of the additional mcus to the main mcu's clock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Separate is_active() code from stats() codeKevin O'Connor2017-09-191-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Do not start stats timer until after connect completesKevin O'Connor2017-09-191-7/+3
| | | | | | | Generating stats during connect leads to potential use of not yet initialized variables. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Allow heater_fan to work with heater_bedKevin O'Connor2017-09-071-6/+7
| | | | | | | Fix order of init error preventing heater_fan from being used with heater_bed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Provide some further help on common MCU shutdown errorsKevin O'Connor2017-09-051-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Eliminate set_max_jerk() from kinematic classesKevin O'Connor2017-09-031-2/+2
| | | | | | | | Allow the kinematic classes to query the max velocity, max accel, and max halt velocity from the toolhead class instead of having the toolhead class call into the kinematic classes with those values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Move restart logic into Printer() classKevin O'Connor2017-08-261-26/+15
| | | | | | | Move the restart logic out of main() and into Printer.run(). This simplifies the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename internal functions so that they are prefaced with "_"Kevin O'Connor2017-08-261-8/+8
| | | | | | | Preface the internal functions to make it more clear which functions are interfaces to external code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* chipmisc: Add support for statically configured output pinsKevin O'Connor2017-08-261-2/+2
| | | | | | | Allow digital and PWM output pins to be setup via new config sections. This makes it easier to setup pin configurations. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Support registering arbitrary chips that supply configurable pinsKevin O'Connor2017-08-251-6/+6
| | | | | | | | | Allow multiple chips to provide pin mappings (not just the main mcu chip). Move the pin parsing from the mcu.py code to pins.py and support mapping from pin descriptions to their corresponding chips and parameters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Store printer startup parameters in new "start_args" dictionaryKevin O'Connor2017-08-251-50/+31
| | | | | | | | | Store pertinent information from the software startup in a dictionary that the various printer components can access instead of in individual variables in the Printer() class. This makes it easier to add future command-line options. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Add support for heater_fan objectsKevin O'Connor2017-07-171-0/+3
| | | | | | | Add support for fans designed to cool the components of an extruder or heater. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Request python2 for all directly executed python binariesKevin O'Connor2017-06-271-1/+1
| | | | | | | Some systems point python to python3 instead of python2 - explicitly request python2 to avoid conflicts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Make sure to always sleep before retrying next stats() callKevin O'Connor2017-06-151-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Use newer "except XYZError as e" python syntaxKevin O'Connor2017-06-101-4/+4
| | | | | | Use the newer syntax for python exceptions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow each module to define their config sectionsKevin O'Connor2017-06-091-11/+8
| | | | | | | | Create add_printer_objects() functions in the fan, heater, extruder, and toolhead modules. Create the necessary printer component objects from this call instead of placing the code directly in klippy.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Prefer python dictionary comprehension to dict() callKevin O'Connor2017-06-061-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>