aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/heater.py
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* mcu: Rename output_file_mode variable to is_fileoutputKevin O'Connor2016-11-291-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Handle adc initialization entirely in mcu codeKevin O'Connor2016-11-291-3/+1
| | | | | | | | 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>
* heater: Do not require target temperature be above min_extrude_tempKevin O'Connor2016-11-081-5/+2
| | | | | | | | | | 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>
* heater: Make it possible to disable min_extrude_temp for testingKevin O'Connor2016-10-111-1/+1
| | | | | | | | 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>
* extruder: Support a minimum extrude temperatureKevin O'Connor2016-09-301-0/+8
| | | | | | | | 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>
* heater: Add "ATC Semitec 104GT-2" thermistor definitionKevin O'Connor2016-09-151-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Remove redundant float conversionKevin O'Connor2016-09-151-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Convert PWM and ADC objects to take mcu_time instead of clockKevin O'Connor2016-08-241-58/+46
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+288
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>