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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Some systems point python to python3 instead of python2 - explicitly
request python2 to avoid conflicts.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>