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>