Browse Source

Simpler/extensible thermistor test in thermistortables.h

Scott Lahteine 8 years ago
parent
commit
e03414b2dd
1 changed files with 28 additions and 26 deletions
  1. 28
    26
      Marlin/thermistortables.h

+ 28
- 26
Marlin/thermistortables.h View File

@@ -28,7 +28,9 @@
28 28
 
29 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 34
 const short temptable_1[][2] PROGMEM = {
33 35
   {   23 * OVERSAMPLENR, 300 },
34 36
   {   25 * OVERSAMPLENR, 295 },
@@ -94,7 +96,7 @@ const short temptable_1[][2] PROGMEM = {
94 96
 };
95 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 100
 // 200k ATC Semitec 204GT-2
99 101
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
100 102
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
@@ -134,7 +136,7 @@ const short temptable_2[][2] PROGMEM = {
134 136
 };
135 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 140
 const short temptable_3[][2] PROGMEM = {
139 141
   {    1 * OVERSAMPLENR, 864 },
140 142
   {   21 * OVERSAMPLENR, 300 },
@@ -167,7 +169,7 @@ const short temptable_3[][2] PROGMEM = {
167 169
 };
168 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 173
 const short temptable_4[][2] PROGMEM = {
172 174
   {    1 * OVERSAMPLENR, 430 },
173 175
   {   54 * OVERSAMPLENR, 137 },
@@ -192,7 +194,7 @@ const short temptable_4[][2] PROGMEM = {
192 194
 };
193 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 198
 // ATC Semitec 104GT-2 (Used in ParCan)
197 199
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
198 200
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
@@ -232,7 +234,7 @@ const short temptable_5[][2] PROGMEM = {
232 234
 };
233 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 238
 const short temptable_6[][2] PROGMEM = {
237 239
   {    1 * OVERSAMPLENR, 350 },
238 240
   {   28 * OVERSAMPLENR, 250 }, // top rating 250C
@@ -275,7 +277,7 @@ const short temptable_6[][2] PROGMEM = {
275 277
 };
276 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 281
 const short temptable_7[][2] PROGMEM = {
280 282
   {    1 * OVERSAMPLENR, 941 },
281 283
   {   19 * OVERSAMPLENR, 362 },
@@ -338,7 +340,7 @@ const short temptable_7[][2] PROGMEM = {
338 340
 };
339 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 344
 // R0 = 100000 Ohm
343 345
 // T0 = 25 °C
344 346
 // Beta = 3974
@@ -489,7 +491,7 @@ const short temptable_71[][2] PROGMEM = {
489 491
 };
490 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 495
 // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
494 496
 const short temptable_8[][2] PROGMEM = {
495 497
   {    1 * OVERSAMPLENR, 704 },
@@ -515,7 +517,7 @@ const short temptable_8[][2] PROGMEM = {
515 517
 };
516 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 521
 // 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
520 522
 const short temptable_9[][2] PROGMEM = {
521 523
   {    1 * OVERSAMPLENR, 936 },
@@ -552,7 +554,7 @@ const short temptable_9[][2] PROGMEM = {
552 554
 };
553 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 558
 // 100k RS thermistor 198-961 (4.7k pullup)
557 559
 const short temptable_10[][2] PROGMEM = {
558 560
   {    1 * OVERSAMPLENR, 929 },
@@ -589,7 +591,7 @@ const short temptable_10[][2] PROGMEM = {
589 591
 };
590 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 595
 // QU-BD silicone bed QWG-104F-3950 thermistor
594 596
 const short temptable_11[][2] PROGMEM = {
595 597
   {    1 * OVERSAMPLENR, 938 },
@@ -645,7 +647,7 @@ const short temptable_11[][2] PROGMEM = {
645 647
 };
646 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 651
 // Hisens thermistor B25/50 =3950 +/-1%
650 652
 const short temptable_13[][2] PROGMEM = {
651 653
   {  20.04 * OVERSAMPLENR, 300 },
@@ -675,7 +677,7 @@ const short temptable_13[][2] PROGMEM = {
675 677
 };
676 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 681
 // The PT100 in the Ultimaker v2.0 electronics has a high sample value for a high temperature.
680 682
 // This does not match the normal thermistor behaviour so we need to set the following defines
681 683
 #if (THERMISTORHEATER_0 == 20)
@@ -751,7 +753,7 @@ const short temptable_20[][2] PROGMEM = {
751 753
 };
752 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 757
 // 100k EPCOS (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
756 758
 // Verified by linagee.
757 759
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
@@ -813,7 +815,7 @@ const short temptable_51[][2] PROGMEM = {
813 815
 };
814 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 819
 // 200k ATC Semitec 204GT-2 (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
818 820
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
819 821
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
@@ -854,7 +856,7 @@ const short temptable_52[][2] PROGMEM = {
854 856
 };
855 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 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 861
 // Verified by linagee. Source: http://shop.arcol.hu/static/datasheets/thermistors.pdf
860 862
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
@@ -895,7 +897,7 @@ const short temptable_55[][2] PROGMEM = {
895 897
 };
896 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 901
 // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=3950
900 902
 // r0: 100000
901 903
 // t0: 25
@@ -980,7 +982,7 @@ const short temptable_60[][2] PROGMEM = {
980 982
 };
981 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 986
 // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
985 987
 const short temptable_12[][2] PROGMEM = {
986 988
   {   35 * OVERSAMPLENR, 180 }, // top rating 180C
@@ -1016,7 +1018,7 @@ const short temptable_12[][2] PROGMEM = {
1016 1018
 };
1017 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 1022
 const short temptable_70[][2] PROGMEM = {
1021 1023
   {   22 * OVERSAMPLENR, 300 },
1022 1024
   {   24 * OVERSAMPLENR, 295 },
@@ -1093,7 +1095,7 @@ const short temptable_70[][2] PROGMEM = {
1093 1095
 #define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
1094 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 1099
 const short temptable_110[][2] PROGMEM = {
1098 1100
   // only few values are needed as the curve is very flat
1099 1101
   PtLine(  0, 100, 1000)
@@ -1105,7 +1107,7 @@ const short temptable_110[][2] PROGMEM = {
1105 1107
   PtLine(300, 100, 1000)
1106 1108
 };
1107 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 1111
 const short temptable_147[][2] PROGMEM = {
1110 1112
   // only few values are needed as the curve is very flat
1111 1113
   PtLine(  0, 100, 4700)
@@ -1117,7 +1119,7 @@ const short temptable_147[][2] PROGMEM = {
1117 1119
   PtLine(300, 100, 4700)
1118 1120
 };
1119 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 1123
 const short temptable_1010[][2] PROGMEM = {
1122 1124
   PtLine(  0, 1000, 1000)
1123 1125
   PtLine( 25, 1000, 1000)
@@ -1134,7 +1136,7 @@ const short temptable_1010[][2] PROGMEM = {
1134 1136
   PtLine(300, 1000, 1000)
1135 1137
 };
1136 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 1140
 const short temptable_1047[][2] PROGMEM = {
1139 1141
   // only few values are needed as the curve is very flat
1140 1142
   PtLine(  0, 1000, 4700)
@@ -1147,7 +1149,7 @@ const short temptable_1047[][2] PROGMEM = {
1147 1149
 };
1148 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 1153
   // Dummy Thermistor table.. It will ALWAYS read a fixed value.
1152 1154
   #ifndef DUMMY_THERMISTOR_999_VALUE
1153 1155
     #define DUMMY_THERMISTOR_999_VALUE 25
@@ -1158,7 +1160,7 @@ const short temptable_1047[][2] PROGMEM = {
1158 1160
 };
1159 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 1164
   // Dummy Thermistor table.. It will ALWAYS read a fixed value.
1163 1165
   #ifndef DUMMY_THERMISTOR_998_VALUE
1164 1166
     #define DUMMY_THERMISTOR_998_VALUE 25

Loading…
Cancel
Save