Drop support for M303 and PID_TUNE, and replace it with a new
PID_CALIBRATE command. Move the logic for this command from heater.py
to a new pid_calibrate.py file in the extras/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add support for displaying basic status information on ST7920 and
HD44780 based LCDs that are attached directly to a micro-controller.
Signed-off-by: Marcio Teixeira <marcio@alephobjects.com>
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>
Report the current temperature, current pwm setting, and target
temperature as statistics in the log.
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>
Determine the median period from the pin tuning tests and use that to
recommend a set of PID parameters. Report the results over the g-code
terminal.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Added the pwm_cycle_time option for heater config sections. Defaults
to previous value of 0.100 seconds, but may be reduced to shorter times
at the expense of MCU workload and possible MOSFET heating, depending on
controller design. Some printers that need bed PID to be enabled,
notably the Felixprinters series, are known to benefit from shorter
cycle times, as the default 10hz rate results in excessive voltage
supply droop.
While this option can be used on extruder heaters as well, there
is not expected to be any particular benefit from doing so unless
the extruder heater presents a particularly large load.
Signed-off-by: Andy Silverman <andrewsi@outlook.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add PID_SETTLE_DELTA and PID_SETTLE_SLOPE constants to the code to try
and make it a little more clear how the wait for temperature code
works.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Continue to sample the ADC input pins even if the MCU goes into a
shutdown state. This enables the printer to continue reporting
temperatures even on an mcu error.
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>
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>
Store the underlying temperature and resistance values instead of the
Steinhart-Hart coefficents obtained from them. This makes it easier
to add new thermistors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure the heater.target_temp is set during the auto-tune test so
that the heater.set_pwm() command will allow the heater to be turned
on.
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>
Fix a corner case where a residual in the PID could cause a non-zero
pwm request even when the target_temp is zero. (Which could lead to a
firmware "Missed scheduling of next pwm event" shutdown.)
Simplify the logic for suppressing duplicate pwm updates and make sure
a zero target_temp always results in a zero pwm update on the
following set_pwm calculation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rename the thermistor_type and thermistor_pin config variables to
sensor_type and sensor_pin. This is in preparation for support of
sensors beyond thermistors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When using a sensor that isn't a thermisistor, the maximum and minimum
adc values may be swapped - handle that case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Now that the mcu objects can be created prior to connecting to the
mcu, it is no longer necessary to separate the init and build_config
phases in the high-level code. Move the mcu objection creation from
the build_config phase to the init phase and eliminate the
build_config phase.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Not all hardware has PWM support and there is no compelling reason to
use hardware PWM for fans. Change the default to use software PWM.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the mcu PWM value from an integer (0-255) to a float (0. - 1.).
Add support for limiting the maximum power (as measured over a
sufficiently long duration) to a particular heater.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Continue to resend the pwm value even if the last value was zero -
this extends the debugging info.
Also, add the target temperature to the pwm debugging.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add helper function that ensures a config option is one of several
choices. This helps ensure that a proper error is raised if an
invalid choice is made.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't expose the ADC initialization to the gcode and heater code -
instead, register a callback within the MCU_adc class and call it
directly from the MCU class after configuration completes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Only disable the extruder if the last measured temperature is below
the minimum extrude temperature setting. Verifying the target
temperature is not necessary, and it can incorrectly prevent some
valid moves. It's not uncommon for scripts to retract filament
immiedietly after setting the extruder temperature to zero.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow a config file to specify 'min_extrude_temp: 0' to disable the
minimum extrude temperature test. This makes it easier to perform
testing on the avr simulator.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the config file to specify the minimum temperature for the
extruder and check for that temperature prior to moving the extruder
motor.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>