aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/heater.py
Commit message (Collapse)AuthorAgeFilesLines
* heater: take a gcode_id when setting up a heater (#1028)john--2019-01-021-3/+13
| | | | | Allow an arbitrary gcode_id to be supplied during heater setup. This allows future extras to register additional IDs beyond B, and T#. Signed-off-by: John Jardine <john@gprime.net>
* heater: Add new TURN_OFF_HEATERS commandKevin O'Connor2018-09-181-0/+9
| | | | | | | Add a command that will turn off all heaters in the printer. Run this command in the default idle_timeout action. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* thermocouple: Add initial support for common SPI temperature sensing chipsKevin O'Connor2018-07-241-0/+1
| | | | | Signed-off-by: Petri Honkala <cruwaller@gmail.com> 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-4/+4
| | | | | | The config reference already stores a reference to the printer object. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Introduce smooth_time config option; remove pid_deriv_timeKevin O'Connor2018-07-061-20/+31
| | | | | | | | | | | Add generic temperature smoothing to the Heater class. This is useful to avoid min_extrude_temp and verify_heater errors due to measurement noise. Rename the pid_deriv_time config option to smooth_time so that the smoothing amount need only be specified once. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pid_calibrate: Update the heater's target temperature during calibrationKevin O'Connor2018-06-271-0/+4
| | | | | | | | Update the target temperature during the pid calibration. This gives additional feedback to the user and it makes it less likely that a verify_heater error will be raised during calibration. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Don't peak into Heater class member variablesKevin O'Connor2018-06-271-14/+22
| | | | | | The control classes should not peak into the heater member variables. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* temperature_fan: Add support for temperature-triggered fan.Michael Barbour2018-05-101-7/+9
| | | | Signed-off-by: Michael Barbour <barbour.michael.0@gmail.com>
* heater: Move Thermistor and Linear to their own files in extras/Kevin O'Connor2018-04-041-123/+13
| | | | | | | | Move the Thermistor code to a new thermistor.py module. Move the Linear code to a new adc_temperature.py module. This simplifies the heater.py code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Move adc logic into Thermistor classKevin O'Connor2018-04-041-34/+50
| | | | | | | | The Thermistor (and Linear) class should handle all the details of reading the ADC values and converting them to temperatures. So, move that logic out of the Heater() class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Merge ThermistorBeta class into Thermistor classKevin O'Connor2018-04-041-13/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Add PrinterHeaters class that stores all sensors and heatersKevin O'Connor2018-04-041-8/+44
| | | | | | | | | | | | 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>
* pins: Remove module level get_printer_pins() and setup_pin() functionsKevin O'Connor2018-04-041-4/+4
| | | | | | | | Most callers did a lookup of the pins module via printer.lookup_object("pins"). Use that as the standard method and remove these less frequently used methods. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Add some comments to the thermistor mathKevin O'Connor2018-03-291-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pid_calibrate: Move PID calibration logic from heater.py to new fileKevin O'Connor2018-03-181-130/+9
| | | | | | | | 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>
* heater: Allow min_temp to go below zeroKevin O'Connor2018-03-121-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* verify_heater: Add initial support for verifying heaters and sensorsKevin O'Connor2018-03-111-0/+2
| | | | | | | Add runtime checks to heaters and temperature sensors to check for possible hardware faults. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* display: Add initial support for LCD screens attached to an MCUKevin O'Connor2018-03-061-0/+5
| | | | | | | | 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>
* heater: Report stats whenever the heater is activeKevin O'Connor2018-02-051-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Allow any stats producer to determine when stats are neededKevin O'Connor2018-02-051-1/+1
| | | | | | | | 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>
* heater: Add stats reportingKevin O'Connor2018-01-281-1/+8
| | | | | | | Report the current temperature, current pwm setting, and target temperature as statistics in the log. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add access methods and avoid peeking into the printer classesKevin O'Connor2018-01-281-3/+3
| | | | | | | | | 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>
* heater: Report PID tuning results via the g-code terminalKevin O'Connor2018-01-101-5/+20
| | | | | | | | 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>
* heater: Added config for heater PWM cycle time.Andy Silverman2018-01-031-2/+3
| | | | | | | | | | | | | | | | | 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>
* heater: Provide symbolic names for pid check_busy (aka M109 / M190)Kevin O'Connor2018-01-031-1/+5
| | | | | | | | 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>
* heater: Avoid math errors on extreme ADC readingsKevin O'Connor2017-11-131-0/+1
| | | | | | | Avoid log(0) and divide by zero errors in the thermistor calc_temp() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adccmds: Continue to query analog inputs after a shutdownKevin O'Connor2017-10-121-1/+4
| | | | | | | | 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>
* klippy: Avoid using '%' syntax when calling logging moduleKevin O'Connor2017-09-271-9/+9
| | | | | | | 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: Use is_fileoutput() externallyKevin O'Connor2017-09-191-2/+2
| | | | | | | Use mcu.is_fileoutput() instead of looking up the "debugoutput" flag in the start args. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Support registering arbitrary chips that supply configurable pinsKevin O'Connor2017-08-251-9/+9
| | | | | | | | | 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-2/+2
| | | | | | | | | 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>
* heater: Another minor cleanup to Steinhart-Hart mathKevin O'Connor2017-08-201-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Minor cleanup to Steinhart-Hart mathKevin O'Connor2017-08-181-11/+12
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Add support for a generic "NTC 100K beta 3950" thermistorKevin O'Connor2017-08-171-3/+19
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Calibrate thermistor directly from temperature and resistanceKevin O'Connor2017-08-171-43/+70
| | | | | | | | 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>
* heater: Fix auto-tune codeKevin O'Connor2017-06-221-12/+18
| | | | | | | | 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>
* klippy: Allow each module to define their config sectionsKevin O'Connor2017-06-091-0/+5
| | | | | | | | 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: Support minimum/maximum value checks on configuration variablesKevin O'Connor2017-04-111-9/+10
| | | | | | | Verify that numeric parameters are in a sane range when reading the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Force set_pwm of zero when target_temp is zeroKevin O'Connor2017-03-161-8/+5
| | | | | | | | | | | | 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>
* heater: Add support for AD595 type sensorsKevin O'Connor2017-03-131-6/+22
| | | | | | | Add support for sensor chips that produce a voltage that linearly scales with temperature. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Rename thermistor_type config name to sensor_typeKevin O'Connor2017-03-131-7/+8
| | | | | | | | 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>
* heater: Handle case where min adc value is less than max adc valueKevin O'Connor2017-03-131-5/+4
| | | | | | | 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>
* klippy: Eliminate high-level build_config phaseKevin O'Connor2017-03-131-22/+17
| | | | | | | | | | 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>
* fan: Default to using software PWMKevin O'Connor2017-03-081-1/+2
| | | | | | | 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>
* heater: Support max_power setting for heatersKevin O'Connor2017-03-031-22/+24
| | | | | | | | 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>
* heater: Enforce min/max_temp in heater.set_temp()Kevin O'Connor2017-02-211-2/+11
| | | | | | | Raise an error if the user requests a temperate outside the configured min/max_temp range. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Resend PWM values even if last value was zeroKevin O'Connor2017-01-121-3/+4
| | | | | | | | | 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>
* heater: Only create a soft PWM object for PID heatersKevin O'Connor2017-01-101-3/+9
| | | | | | | The "watermark" style heater only needs a digital_out pin - not a software PWM pin. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Report last temperature in PWM debuggingKevin O'Connor2017-01-101-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add ConfigWrapper.getchoice methodKevin O'Connor2016-11-301-3/+2
| | | | | | | | 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>