aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorAndy Silverman <andrewsi@outlook.com>2017-12-30 15:43:03 -0800
committerKevin O'Connor <kevin@koconnor.net>2018-01-03 12:32:11 -0500
commitb22a81cd3469bf8621f7467a171e784eea7b706f (patch)
treecbd5ed6c9ec4fe33a6fb1f05c8928addb2305cd1 /klippy
parent9fc5506c83691cd0b8e422839eb9fc048d0e05b6 (diff)
downloadkutter-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>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/heater.py5
1 files changed, 3 insertions, 2 deletions
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),