Browse Source

Merge pull request #4245 from thinkyhead/rc_simpler_therm_check

Simpler/extensible thermistor test in thermistortables.h
Scott Lahteine 9 years ago
parent
commit
77283f5bf0
1 changed files with 28 additions and 26 deletions
  1. 28
    26
      Marlin/thermistortables.h

+ 28
- 26
Marlin/thermistortables.h View File

28
 
28
 
29
 #define OVERSAMPLENR 16
29
 #define OVERSAMPLENR 16
30
 
30
 
31
-#if (THERMISTORHEATER_0 == 1) || (THERMISTORHEATER_1 == 1)  || (THERMISTORHEATER_2 == 1) || (THERMISTORHEATER_3 == 1) || (THERMISTORBED == 1) //100k bed thermistor
31
+#define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORBED == n)
32
+
33
+#if ANY_THERMISTOR_IS(1) // 100k bed thermistor
32
 const short temptable_1[][2] PROGMEM = {
34
 const short temptable_1[][2] PROGMEM = {
33
   {   23 * OVERSAMPLENR, 300 },
35
   {   23 * OVERSAMPLENR, 300 },
34
   {   25 * OVERSAMPLENR, 295 },
36
   {   25 * OVERSAMPLENR, 295 },
94
 };
96
 };
95
 #endif
97
 #endif
96
 
98
 
97
-#if (THERMISTORHEATER_0 == 2) || (THERMISTORHEATER_1 == 2) || (THERMISTORHEATER_2 == 2) || (THERMISTORHEATER_3 == 2) || (THERMISTORBED == 2) //200k bed thermistor
99
+#if ANY_THERMISTOR_IS(2) // 200k bed thermistor
98
 // 200k ATC Semitec 204GT-2
100
 // 200k ATC Semitec 204GT-2
99
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
101
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
100
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
102
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
134
 };
136
 };
135
 #endif
137
 #endif
136
 
138
 
137
-#if (THERMISTORHEATER_0 == 3) || (THERMISTORHEATER_1 == 3) || (THERMISTORHEATER_2 == 3) || (THERMISTORHEATER_3 == 3) || (THERMISTORBED == 3) //mendel-parts
139
+#if ANY_THERMISTOR_IS(3) // mendel-parts
138
 const short temptable_3[][2] PROGMEM = {
140
 const short temptable_3[][2] PROGMEM = {
139
   {    1 * OVERSAMPLENR, 864 },
141
   {    1 * OVERSAMPLENR, 864 },
140
   {   21 * OVERSAMPLENR, 300 },
142
   {   21 * OVERSAMPLENR, 300 },
167
 };
169
 };
168
 #endif
170
 #endif
169
 
171
 
170
-#if (THERMISTORHEATER_0 == 4) || (THERMISTORHEATER_1 == 4) || (THERMISTORHEATER_2 == 4) || (THERMISTORHEATER_3 == 4) || (THERMISTORBED == 4) //10k thermistor
172
+#if ANY_THERMISTOR_IS(4) // 10k thermistor
171
 const short temptable_4[][2] PROGMEM = {
173
 const short temptable_4[][2] PROGMEM = {
172
   {    1 * OVERSAMPLENR, 430 },
174
   {    1 * OVERSAMPLENR, 430 },
173
   {   54 * OVERSAMPLENR, 137 },
175
   {   54 * OVERSAMPLENR, 137 },
192
 };
194
 };
193
 #endif
195
 #endif
194
 
196
 
195
-#if (THERMISTORHEATER_0 == 5) || (THERMISTORHEATER_1 == 5) || (THERMISTORHEATER_2 == 5) || (THERMISTORHEATER_3 == 5) || (THERMISTORBED == 5) //100k ParCan thermistor (104GT-2)
197
+#if ANY_THERMISTOR_IS(5) // 100k ParCan thermistor (104GT-2)
196
 // ATC Semitec 104GT-2 (Used in ParCan)
198
 // ATC Semitec 104GT-2 (Used in ParCan)
197
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
199
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
198
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
200
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
232
 };
234
 };
233
 #endif
235
 #endif
234
 
236
 
235
-#if (THERMISTORHEATER_0 == 6) || (THERMISTORHEATER_1 == 6) || (THERMISTORHEATER_2 == 6) || (THERMISTORHEATER_3 == 6) || (THERMISTORBED == 6) // 100k Epcos thermistor
237
+#if ANY_THERMISTOR_IS(6) // 100k Epcos thermistor
236
 const short temptable_6[][2] PROGMEM = {
238
 const short temptable_6[][2] PROGMEM = {
237
   {    1 * OVERSAMPLENR, 350 },
239
   {    1 * OVERSAMPLENR, 350 },
238
   {   28 * OVERSAMPLENR, 250 }, // top rating 250C
240
   {   28 * OVERSAMPLENR, 250 }, // top rating 250C
275
 };
277
 };
276
 #endif
278
 #endif
277
 
279
 
278
-#if (THERMISTORHEATER_0 == 7) || (THERMISTORHEATER_1 == 7) || (THERMISTORHEATER_2 == 7) || (THERMISTORHEATER_3 == 7) || (THERMISTORBED == 7) // 100k Honeywell 135-104LAG-J01
280
+#if ANY_THERMISTOR_IS(7) // 100k Honeywell 135-104LAG-J01
279
 const short temptable_7[][2] PROGMEM = {
281
 const short temptable_7[][2] PROGMEM = {
280
   {    1 * OVERSAMPLENR, 941 },
282
   {    1 * OVERSAMPLENR, 941 },
281
   {   19 * OVERSAMPLENR, 362 },
283
   {   19 * OVERSAMPLENR, 362 },
338
 };
340
 };
339
 #endif
341
 #endif
340
 
342
 
341
-#if (THERMISTORHEATER_0 == 71) || (THERMISTORHEATER_1 == 71) || (THERMISTORHEATER_2 == 71) || (THERMISTORHEATER_3 == 71) || (THERMISTORBED == 71) // 100k Honeywell 135-104LAF-J01
343
+#if ANY_THERMISTOR_IS(71) // 100k Honeywell 135-104LAF-J01
342
 // R0 = 100000 Ohm
344
 // R0 = 100000 Ohm
343
 // T0 = 25 °C
345
 // T0 = 25 °C
344
 // Beta = 3974
346
 // Beta = 3974
489
 };
491
 };
490
 #endif
492
 #endif
491
 
493
 
492
-#if (THERMISTORHEATER_0 == 8) || (THERMISTORHEATER_1 == 8) || (THERMISTORHEATER_2 == 8) || (THERMISTORHEATER_3 == 8) || (THERMISTORBED == 8)
494
+#if ANY_THERMISTOR_IS(8)
493
 // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
495
 // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
494
 const short temptable_8[][2] PROGMEM = {
496
 const short temptable_8[][2] PROGMEM = {
495
   {    1 * OVERSAMPLENR, 704 },
497
   {    1 * OVERSAMPLENR, 704 },
515
 };
517
 };
516
 #endif
518
 #endif
517
 
519
 
518
-#if (THERMISTORHEATER_0 == 9) || (THERMISTORHEATER_1 == 9) || (THERMISTORHEATER_2 == 9) || (THERMISTORHEATER_3 == 9) || (THERMISTORBED == 9)
520
+#if ANY_THERMISTOR_IS(9)
519
 // 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
521
 // 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
520
 const short temptable_9[][2] PROGMEM = {
522
 const short temptable_9[][2] PROGMEM = {
521
   {    1 * OVERSAMPLENR, 936 },
523
   {    1 * OVERSAMPLENR, 936 },
552
 };
554
 };
553
 #endif
555
 #endif
554
 
556
 
555
-#if (THERMISTORHEATER_0 == 10) || (THERMISTORHEATER_1 == 10) || (THERMISTORHEATER_2 == 10) || (THERMISTORHEATER_3 == 10) || (THERMISTORBED == 10)
557
+#if ANY_THERMISTOR_IS(10)
556
 // 100k RS thermistor 198-961 (4.7k pullup)
558
 // 100k RS thermistor 198-961 (4.7k pullup)
557
 const short temptable_10[][2] PROGMEM = {
559
 const short temptable_10[][2] PROGMEM = {
558
   {    1 * OVERSAMPLENR, 929 },
560
   {    1 * OVERSAMPLENR, 929 },
589
 };
591
 };
590
 #endif
592
 #endif
591
 
593
 
592
-#if (THERMISTORHEATER_0 == 11) || (THERMISTORHEATER_1 == 11) || (THERMISTORHEATER_2 == 11) || (THERMISTORHEATER_3 == 11) || (THERMISTORBED == 11)
594
+#if ANY_THERMISTOR_IS(11)
593
 // QU-BD silicone bed QWG-104F-3950 thermistor
595
 // QU-BD silicone bed QWG-104F-3950 thermistor
594
 const short temptable_11[][2] PROGMEM = {
596
 const short temptable_11[][2] PROGMEM = {
595
   {    1 * OVERSAMPLENR, 938 },
597
   {    1 * OVERSAMPLENR, 938 },
645
 };
647
 };
646
 #endif
648
 #endif
647
 
649
 
648
-#if (THERMISTORHEATER_0 == 13) || (THERMISTORHEATER_1 == 13) || (THERMISTORHEATER_2 == 13) || (THERMISTORHEATER_3 == 13) || (THERMISTORBED == 13)
650
+#if ANY_THERMISTOR_IS(13)
649
 // Hisens thermistor B25/50 =3950 +/-1%
651
 // Hisens thermistor B25/50 =3950 +/-1%
650
 const short temptable_13[][2] PROGMEM = {
652
 const short temptable_13[][2] PROGMEM = {
651
   {  20.04 * OVERSAMPLENR, 300 },
653
   {  20.04 * OVERSAMPLENR, 300 },
675
 };
677
 };
676
 #endif
678
 #endif
677
 
679
 
678
-#if (THERMISTORHEATER_0 == 20) || (THERMISTORHEATER_1 == 20) || (THERMISTORHEATER_2 == 20) || (THERMISTORBED == 20) // PT100 with INA826 amp on Ultimaker v2.0 electronics
680
+#if ANY_THERMISTOR_IS(20) // PT100 with INA826 amp on Ultimaker v2.0 electronics
679
 // The PT100 in the Ultimaker v2.0 electronics has a high sample value for a high temperature.
681
 // The PT100 in the Ultimaker v2.0 electronics has a high sample value for a high temperature.
680
 // This does not match the normal thermistor behaviour so we need to set the following defines
682
 // This does not match the normal thermistor behaviour so we need to set the following defines
681
 #if (THERMISTORHEATER_0 == 20)
683
 #if (THERMISTORHEATER_0 == 20)
751
 };
753
 };
752
 #endif
754
 #endif
753
 
755
 
754
-#if (THERMISTORHEATER_0 == 51) || (THERMISTORHEATER_1 == 51) || (THERMISTORHEATER_2 == 51) || (THERMISTORHEATER_3 == 51) || (THERMISTORBED == 51)
756
+#if ANY_THERMISTOR_IS(51)
755
 // 100k EPCOS (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
757
 // 100k EPCOS (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
756
 // Verified by linagee.
758
 // Verified by linagee.
757
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
759
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
813
 };
815
 };
814
 #endif
816
 #endif
815
 
817
 
816
-#if (THERMISTORHEATER_0 == 52) || (THERMISTORHEATER_1 == 52) || (THERMISTORHEATER_2 == 52) || (THERMISTORHEATER_3 == 52) || (THERMISTORBED == 52)
818
+#if ANY_THERMISTOR_IS(52)
817
 // 200k ATC Semitec 204GT-2 (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
819
 // 200k ATC Semitec 204GT-2 (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
818
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
820
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
819
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
821
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
854
 };
856
 };
855
 #endif
857
 #endif
856
 
858
 
857
-#if (THERMISTORHEATER_0 == 55) || (THERMISTORHEATER_1 == 55) || (THERMISTORHEATER_2 == 55) || (THERMISTORHEATER_3 == 55) || (THERMISTORBED == 55)
859
+#if ANY_THERMISTOR_IS(55)
858
 // 100k ATC Semitec 104GT-2 (Used on ParCan) (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
860
 // 100k ATC Semitec 104GT-2 (Used on ParCan) (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
859
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
861
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
860
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
862
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
895
 };
897
 };
896
 #endif
898
 #endif
897
 
899
 
898
-#if (THERMISTORHEATER_0 == 60) || (THERMISTORHEATER_1 == 60) || (THERMISTORHEATER_2 == 60) || (THERMISTORHEATER_3 == 60) || (THERMISTORBED == 60) // Maker's Tool Works Kapton Bed Thermistor
900
+#if ANY_THERMISTOR_IS(60) // Maker's Tool Works Kapton Bed Thermistor
899
 // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=3950
901
 // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=3950
900
 // r0: 100000
902
 // r0: 100000
901
 // t0: 25
903
 // t0: 25
980
 };
982
 };
981
 #endif
983
 #endif
982
 
984
 
983
-#if (THERMISTORHEATER_0 == 12) || (THERMISTORHEATER_1 == 12) || (THERMISTORHEATER_2 == 12) || (THERMISTORHEATER_3 == 12) || (THERMISTORBED == 12)
985
+#if ANY_THERMISTOR_IS(12)
984
 // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
986
 // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
985
 const short temptable_12[][2] PROGMEM = {
987
 const short temptable_12[][2] PROGMEM = {
986
   {   35 * OVERSAMPLENR, 180 }, // top rating 180C
988
   {   35 * OVERSAMPLENR, 180 }, // top rating 180C
1016
 };
1018
 };
1017
 #endif
1019
 #endif
1018
 
1020
 
1019
-#if (THERMISTORHEATER_0 == 70) || (THERMISTORHEATER_1 == 70) || (THERMISTORHEATER_2 == 70) || (THERMISTORHEATER_3 == 70) || (THERMISTORBED == 70) // bqh2 stock thermistor
1021
+#if ANY_THERMISTOR_IS(70) // bqh2 stock thermistor
1020
 const short temptable_70[][2] PROGMEM = {
1022
 const short temptable_70[][2] PROGMEM = {
1021
   {   22 * OVERSAMPLENR, 300 },
1023
   {   22 * OVERSAMPLENR, 300 },
1022
   {   24 * OVERSAMPLENR, 295 },
1024
   {   24 * OVERSAMPLENR, 295 },
1093
 #define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
1095
 #define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
1094
 #define PtLine(T,R0,Rup) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T },
1096
 #define PtLine(T,R0,Rup) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T },
1095
 
1097
 
1096
-#if (THERMISTORHEATER_0 == 110) || (THERMISTORHEATER_1 == 110) || (THERMISTORHEATER_2 == 110) || (THERMISTORHEATER_3 == 110) || (THERMISTORBED == 110) // Pt100 with 1k0 pullup
1098
+#if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
1097
 const short temptable_110[][2] PROGMEM = {
1099
 const short temptable_110[][2] PROGMEM = {
1098
   // only few values are needed as the curve is very flat
1100
   // only few values are needed as the curve is very flat
1099
   PtLine(  0, 100, 1000)
1101
   PtLine(  0, 100, 1000)
1105
   PtLine(300, 100, 1000)
1107
   PtLine(300, 100, 1000)
1106
 };
1108
 };
1107
 #endif
1109
 #endif
1108
-#if (THERMISTORHEATER_0 == 147) || (THERMISTORHEATER_1 == 147) || (THERMISTORHEATER_2 == 147) || (THERMISTORHEATER_3 == 147) || (THERMISTORBED == 147) // Pt100 with 4k7 pullup
1110
+#if ANY_THERMISTOR_IS(147) // Pt100 with 4k7 pullup
1109
 const short temptable_147[][2] PROGMEM = {
1111
 const short temptable_147[][2] PROGMEM = {
1110
   // only few values are needed as the curve is very flat
1112
   // only few values are needed as the curve is very flat
1111
   PtLine(  0, 100, 4700)
1113
   PtLine(  0, 100, 4700)
1117
   PtLine(300, 100, 4700)
1119
   PtLine(300, 100, 4700)
1118
 };
1120
 };
1119
 #endif
1121
 #endif
1120
-#if (THERMISTORHEATER_0 == 1010) || (THERMISTORHEATER_1 == 1010) || (THERMISTORHEATER_2 == 1010) || (THERMISTORHEATER_3 == 1010) || (THERMISTORBED == 1010) // Pt1000 with 1k0 pullup
1122
+#if ANY_THERMISTOR_IS(1010) // Pt1000 with 1k0 pullup
1121
 const short temptable_1010[][2] PROGMEM = {
1123
 const short temptable_1010[][2] PROGMEM = {
1122
   PtLine(  0, 1000, 1000)
1124
   PtLine(  0, 1000, 1000)
1123
   PtLine( 25, 1000, 1000)
1125
   PtLine( 25, 1000, 1000)
1134
   PtLine(300, 1000, 1000)
1136
   PtLine(300, 1000, 1000)
1135
 };
1137
 };
1136
 #endif
1138
 #endif
1137
-#if (THERMISTORHEATER_0 == 1047) || (THERMISTORHEATER_1 == 1047) || (THERMISTORHEATER_2 == 1047) || (THERMISTORHEATER_3 == 1047) || (THERMISTORBED == 1047) // Pt1000 with 4k7 pullup
1139
+#if ANY_THERMISTOR_IS(1047) // Pt1000 with 4k7 pullup
1138
 const short temptable_1047[][2] PROGMEM = {
1140
 const short temptable_1047[][2] PROGMEM = {
1139
   // only few values are needed as the curve is very flat
1141
   // only few values are needed as the curve is very flat
1140
   PtLine(  0, 1000, 4700)
1142
   PtLine(  0, 1000, 4700)
1147
 };
1149
 };
1148
 #endif
1150
 #endif
1149
 
1151
 
1150
-#if (THERMISTORHEATER_0 == 999) || (THERMISTORHEATER_1 == 999) || (THERMISTORHEATER_2 == 999) || (THERMISTORHEATER_3 == 999) || (THERMISTORBED == 999) //User defined table
1152
+#if ANY_THERMISTOR_IS(999) // User-defined table
1151
   // Dummy Thermistor table.. It will ALWAYS read a fixed value.
1153
   // Dummy Thermistor table.. It will ALWAYS read a fixed value.
1152
   #ifndef DUMMY_THERMISTOR_999_VALUE
1154
   #ifndef DUMMY_THERMISTOR_999_VALUE
1153
     #define DUMMY_THERMISTOR_999_VALUE 25
1155
     #define DUMMY_THERMISTOR_999_VALUE 25
1158
 };
1160
 };
1159
 #endif
1161
 #endif
1160
 
1162
 
1161
-#if (THERMISTORHEATER_0 == 998) || (THERMISTORHEATER_1 == 998) || (THERMISTORHEATER_2 == 998) || (THERMISTORHEATER_3 == 998) || (THERMISTORBED == 998) //User defined table
1163
+#if ANY_THERMISTOR_IS(998) // User-defined table
1162
   // Dummy Thermistor table.. It will ALWAYS read a fixed value.
1164
   // Dummy Thermistor table.. It will ALWAYS read a fixed value.
1163
   #ifndef DUMMY_THERMISTOR_998_VALUE
1165
   #ifndef DUMMY_THERMISTOR_998_VALUE
1164
     #define DUMMY_THERMISTOR_998_VALUE 25
1166
     #define DUMMY_THERMISTOR_998_VALUE 25

Loading…
Cancel
Save