aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/avrsim.cfg8
-rw-r--r--config/example-delta.cfg8
-rw-r--r--config/example.cfg13
-rw-r--r--config/makergear-m2-2012.cfg8
-rw-r--r--klippy/heater.py15
5 files changed, 26 insertions, 26 deletions
diff --git a/config/avrsim.cfg b/config/avrsim.cfg
index 6a50ae80..dbbe45ca 100644
--- a/config/avrsim.cfg
+++ b/config/avrsim.cfg
@@ -45,8 +45,8 @@ step_distance: .004242
nozzle_diameter: 0.500
filament_diameter: 3.500
heater_pin: ar4
-thermistor_pin: analog1
-thermistor_type: EPCOS 100K B57560G104F
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: analog1
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
@@ -57,8 +57,8 @@ max_temp: 210
[heater_bed]
heater_pin: ar3
-thermistor_pin: analog0
-thermistor_type: EPCOS 100K B57560G104F
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: analog0
control: watermark
min_temp: 0
max_temp: 110
diff --git a/config/example-delta.cfg b/config/example-delta.cfg
index 90f8c8b5..add26f52 100644
--- a/config/example-delta.cfg
+++ b/config/example-delta.cfg
@@ -47,8 +47,8 @@ step_distance: .0022
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: ar10
-thermistor_pin: analog13
-thermistor_type: ATC Semitec 104GT-2
+sensor_type: ATC Semitec 104GT-2
+sensor_pin: analog13
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
@@ -58,8 +58,8 @@ max_temp: 250
[heater_bed]
heater_pin: ar8
-thermistor_pin: analog14
-thermistor_type: EPCOS 100K B57560G104F
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: analog14
control: watermark
min_temp: 0
max_temp: 130
diff --git a/config/example.cfg b/config/example.cfg
index 9037d919..f9102ceb 100644
--- a/config/example.cfg
+++ b/config/example.cfg
@@ -160,13 +160,12 @@ heater_pin: ar4
# allow the pin to be enabled for no more than half the time. This
# setting may be used to limit the total power output (over extended
# periods) to the heater. The default is 1.0.
-thermistor_pin: analog1
+sensor_type: EPCOS 100K B57560G104F
+# Type of sensor - this may be "EPCOS 100K B57560G104F" or "ATC
+# Semitec 104GT-2". This parameter must be provided.
+sensor_pin: analog1
# Analog input pin connected to thermistor. This parameter must be
# provided.
-thermistor_type: EPCOS 100K B57560G104F
-# Type of thermistor (see the Thermistors variable at the top of
-# klippy/heater.py for available types). This parameter must be
-# provided.
#pullup_resistor: 4700
# The resistance (in ohms) of the pullup attached to the
# thermistor. The default is 4700 ohms.
@@ -203,8 +202,8 @@ max_temp: 210
# section if not present).
[heater_bed]
heater_pin: ar3
-thermistor_pin: analog0
-thermistor_type: EPCOS 100K B57560G104F
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: analog0
control: watermark
#max_delta: 2.0
# On 'watermark' controlled heaters this is the number of degrees in
diff --git a/config/makergear-m2-2012.cfg b/config/makergear-m2-2012.cfg
index 845e64b0..bf5b315e 100644
--- a/config/makergear-m2-2012.cfg
+++ b/config/makergear-m2-2012.cfg
@@ -52,8 +52,8 @@ nozzle_diameter: 0.350
filament_diameter: 1.750
pressure_advance: 0.07
heater_pin: PH6
-thermistor_pin: PF0
-thermistor_type: EPCOS 100K B57560G104F
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: PF0
control: pid
pid_Kp: 7.0
pid_Ki: 0.1
@@ -63,8 +63,8 @@ max_temp: 210
[heater_bed]
heater_pin: PE5
-thermistor_pin: PF2
-thermistor_type: EPCOS 100K B57560G104F
+sensor_type: EPCOS 100K B57560G104F
+sensor_pin: PF2
control: watermark
min_temp: 0
max_temp: 100
diff --git a/klippy/heater.py b/klippy/heater.py
index d41055e2..7ad2318c 100644
--- a/klippy/heater.py
+++ b/klippy/heater.py
@@ -5,8 +5,9 @@
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging, threading
-# Mapping from name to Steinhart-Hart coefficients
-Thermistors = {
+# Available sensors
+Sensors = {
+ # Common thermistors and their Steinhart-Hart coefficients
"EPCOS 100K B57560G104F": (
0.000722136308968056, 0.000216766566488498, 8.92935804531095e-08),
"ATC Semitec 104GT-2": (
@@ -29,7 +30,7 @@ class PrinterHeater:
error = error
def __init__(self, printer, config):
self.name = config.section
- self.thermistor_c = config.getchoice('thermistor_type', Thermistors)
+ self.sensor_c = config.getchoice('sensor_type', Sensors)
self.pullup_r = config.getfloat('pullup_resistor', 4700.)
self.min_extrude_temp = config.getfloat('min_extrude_temp', 170.)
self.min_temp = config.getfloat('min_temp')
@@ -44,14 +45,14 @@ class PrinterHeater:
algos = {'watermark': ControlBangBang, 'pid': ControlPID}
algo = config.getchoice('control', algos)
heater_pin = config.get('heater_pin')
- thermistor_pin = config.get('thermistor_pin')
+ sensor_pin = config.get('sensor_pin')
if algo is ControlBangBang and self.max_power == 1.:
self.mcu_pwm = printer.mcu.create_digital_out(
heater_pin, MAX_HEAT_TIME)
else:
self.mcu_pwm = printer.mcu.create_pwm(
heater_pin, PWM_CYCLE_TIME, 0, MAX_HEAT_TIME)
- self.mcu_adc = printer.mcu.create_adc(thermistor_pin)
+ self.mcu_adc = printer.mcu.create_adc(sensor_pin)
adc_range = [self.calc_adc(self.min_temp), self.calc_adc(self.max_temp)]
self.mcu_adc.set_minmax(SAMPLE_TIME, SAMPLE_COUNT,
minval=min(adc_range), maxval=max(adc_range))
@@ -81,13 +82,13 @@ class PrinterHeater:
def calc_temp(self, adc):
r = self.pullup_r * adc / (1.0 - adc)
ln_r = math.log(r)
- c1, c2, c3 = self.thermistor_c
+ c1, c2, c3 = self.sensor_c
temp_inv = c1 + c2*ln_r + c3*math.pow(ln_r, 3)
return 1.0/temp_inv + KELVIN_TO_CELCIUS
def calc_adc(self, temp):
if temp is None:
return None
- c1, c2, c3 = self.thermistor_c
+ c1, c2, c3 = self.sensor_c
temp -= KELVIN_TO_CELCIUS
temp_inv = 1./temp
y = (c1 - temp_inv) / (2*c3)