Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
/** |
2 |
|
|
|
* @file thermistors.cpp |
3 |
|
|
|
* |
4 |
|
|
|
* @date Feb 17, 2013 |
5 |
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020 |
6 |
|
|
|
*/ |
7 |
|
|
|
|
8 |
|
|
|
/** |
9 |
|
|
|
* http://en.wikipedia.org/wiki/Thermistor |
10 |
|
|
|
* http://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation |
11 |
|
|
|
*/ |
12 |
|
|
|
|
13 |
|
|
|
#include "pch.h" |
14 |
|
|
|
|
15 |
|
|
6 |
void setDodgeSensor(ThermistorConf *thermistorConf, float pullup) { |
16 |
|
|
6 |
thermistorConf->config = {-40, 30, 120, 336660, 7550, 390, pullup}; |
17 |
|
|
6 |
} |
18 |
|
|
|
|
19 |
|
|
3 |
void setAtSensor(ThermistorConf *thermistorConf, |
20 |
|
|
|
float tempLow, float rLow, |
21 |
|
|
|
float tempMid, float rMid, |
22 |
|
|
|
float tempHigh, float rHigh) { |
23 |
|
|
3 |
thermistorConf->config.tempC_1 = tempLow; |
24 |
|
|
3 |
thermistorConf->config.resistance_1 = rLow; |
25 |
|
|
|
|
26 |
|
|
3 |
thermistorConf->config.tempC_2 = tempMid; |
27 |
|
|
3 |
thermistorConf->config.resistance_2 = rMid; |
28 |
|
|
|
|
29 |
|
|
3 |
thermistorConf->config.tempC_3 = tempHigh; |
30 |
|
|
3 |
thermistorConf->config.resistance_3 = rHigh; |
31 |
|
|
3 |
} |
32 |
|
|
|
|
33 |
|
|
616 |
void setCommonNTCSensorParameters(ThermistorConf *thermistorConf) { |
34 |
|
|
|
/** |
35 |
|
|
|
* 18K Ohm @ -20C |
36 |
|
|
|
* 2.1K Ohm @ 24C |
37 |
|
|
|
* 294 Ohm @ 80C |
38 |
|
|
|
* http://www.rexbo.eu/hella/coolant-temperature-sensor-6pt009107121?c=100334&at=3130 |
39 |
|
|
|
*/ |
40 |
|
|
616 |
thermistorConf->config.tempC_1 = -20; |
41 |
|
|
616 |
thermistorConf->config.tempC_2 = 23.8889; |
42 |
|
|
616 |
thermistorConf->config.tempC_3 = 120; |
43 |
|
|
616 |
thermistorConf->config.resistance_1 = 18000; |
44 |
|
|
616 |
thermistorConf->config.resistance_2 = 2100; |
45 |
|
|
616 |
thermistorConf->config.resistance_3 = 100; |
46 |
|
|
616 |
} |
47 |
|
|
|
|
48 |
|
|
|
|
49 |
|
|
|
// todo: better method name? |
50 |
|
|
|
// todo: poor API mixes SensorParameters with board bias resistor |
51 |
|
|
✗ |
void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup) { |
52 |
|
|
✗ |
setCommonNTCSensorParameters(thermistorConf); |
53 |
|
|
✗ |
thermistorConf->config.bias_resistor = pullup; |
54 |
|
|
✗ |
} |
55 |
|
|
|
|
56 |
|
|
✗ |
void setGmCltSensor(ThermistorConf *thermistorConf) { |
57 |
|
|
✗ |
thermistorConf->config.tempC_1 = -40; |
58 |
|
|
✗ |
thermistorConf->config.tempC_2 = 40; |
59 |
|
|
✗ |
thermistorConf->config.tempC_3 = 130; |
60 |
|
|
✗ |
thermistorConf->config.resistance_1 = 100'000; |
61 |
|
|
✗ |
thermistorConf->config.resistance_2 = 1459; |
62 |
|
|
✗ |
thermistorConf->config.resistance_3 = 70; |
63 |
|
|
✗ |
} |
64 |
|
|
|
|