diff options
author | Andy Silverman <andrewsi@outlook.com> | 2017-12-30 15:43:03 -0800 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-03 12:32:11 -0500 |
commit | b22a81cd3469bf8621f7467a171e784eea7b706f (patch) | |
tree | cbd5ed6c9ec4fe33a6fb1f05c8928addb2305cd1 | |
parent | 9fc5506c83691cd0b8e422839eb9fc048d0e05b6 (diff) | |
download | kutter-b22a81cd3469bf8621f7467a171e784eea7b706f.tar.gz kutter-b22a81cd3469bf8621f7467a171e784eea7b706f.tar.xz kutter-b22a81cd3469bf8621f7467a171e784eea7b706f.zip |
heater: Added config for heater PWM cycle time.
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>
-rw-r--r-- | config/example.cfg | 5 | ||||
-rw-r--r-- | klippy/heater.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/config/example.cfg b/config/example.cfg index 74ec1224..a7d6fd3d 100644 --- a/config/example.cfg +++ b/config/example.cfg @@ -203,6 +203,11 @@ pid_Kd: 114 #pid_integral_max: # The maximum "windup" the integral term may accumulate. The default # is to use the same value as max_power. +#pwm_cycle_time: 0.100 +# Time in seconds for each software PWM cycle of the heater. It is +# not recommended to set this unless there is an electrical +# requirement to switch the heater faster than 10 times a second. +# The default is 0.100 seconds. #min_extrude_temp: 170 # The minimum temperature (in Celsius) at which extruder move # commands may be issued. The default is 170 Celsius. diff --git a/klippy/heater.py b/klippy/heater.py index 553b208b..83e8cf7c 100644 --- a/klippy/heater.py +++ b/klippy/heater.py @@ -95,7 +95,6 @@ Sensors = { SAMPLE_TIME = 0.001 SAMPLE_COUNT = 8 REPORT_TIME = 0.300 -PWM_CYCLE_TIME = 0.100 MAX_HEAT_TIME = 5.0 AMBIENT_TEMP = 25. PID_PARAM_BASE = 255. @@ -125,7 +124,9 @@ class PrinterHeater: self.mcu_pwm = pins.setup_pin(printer, 'digital_out', heater_pin) else: self.mcu_pwm = pins.setup_pin(printer, 'pwm', heater_pin) - self.mcu_pwm.setup_cycle_time(PWM_CYCLE_TIME) + pwm_cycle_time = config.getfloat( + 'pwm_cycle_time', 0.100, above=0., maxval=REPORT_TIME) + self.mcu_pwm.setup_cycle_time(pwm_cycle_time) self.mcu_pwm.setup_max_duration(MAX_HEAT_TIME) self.mcu_adc = pins.setup_pin(printer, 'adc', config.get('sensor_pin')) adc_range = [self.sensor.calc_adc(self.min_temp), |