Subversion Repositories Tronxy-X3A-Marlin

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ron 1
/**
2
 * Marlin 3D Printer Firmware
3
 * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
 *
5
 * Based on Sprinter and grbl.
6
 * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
 
23
#ifndef THERMISTORTABLES_H_
24
#define THERMISTORTABLES_H_
25
 
26
#include "Marlin.h"
27
#include "macros.h"
28
 
29
#define OVERSAMPLENR 16
30
#define OV(N) int16_t((N)*(OVERSAMPLENR))
31
 
32
#define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORBED == n || THERMISTORCHAMBER == n)
33
 
34
// Pt1000 and Pt100 handling
35
//
36
// Rt=R0*(1+a*T+b*T*T) [for T>0]
37
// a=3.9083E-3, b=-5.775E-7
38
#define PtA 3.9083E-3
39
#define PtB -5.775E-7
40
#define PtRt(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T)))
41
#define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
42
#define PtLine(T,R0,Rup) { OV(PtAdVal(T,R0,Rup)), T },
43
 
44
#if ANY_THERMISTOR_IS(1) // 100k bed thermistor
45
  #include "thermistortable_1.h"
46
#endif
47
#if ANY_THERMISTOR_IS(2) // 200k bed thermistor
48
  #include "thermistortable_2.h"
49
#endif
50
#if ANY_THERMISTOR_IS(3) // mendel-parts
51
  #include "thermistortable_3.h"
52
#endif
53
#if ANY_THERMISTOR_IS(4) // 10k thermistor
54
  #include "thermistortable_4.h"
55
#endif
56
#if ANY_THERMISTOR_IS(5) // 100k ParCan thermistor (104GT-2)
57
  #include "thermistortable_5.h"
58
#endif
59
#if ANY_THERMISTOR_IS(501) // 100k Zonestar thermistor
60
  #include "thermistortable_501.h"
61
#endif
62
#if ANY_THERMISTOR_IS(6) // 100k Epcos thermistor
63
  #include "thermistortable_6.h"
64
#endif
65
#if ANY_THERMISTOR_IS(7) // 100k Honeywell 135-104LAG-J01
66
  #include "thermistortable_7.h"
67
#endif
68
#if ANY_THERMISTOR_IS(71) // 100k Honeywell 135-104LAF-J01
69
  #include "thermistortable_71.h"
70
#endif
71
#if ANY_THERMISTOR_IS(8) // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
72
  #include "thermistortable_8.h"
73
#endif
74
#if ANY_THERMISTOR_IS(9) // 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
75
  #include "thermistortable_9.h"
76
#endif
77
#if ANY_THERMISTOR_IS(10) // 100k RS thermistor 198-961 (4.7k pullup)
78
  #include "thermistortable_10.h"
79
#endif
80
#if ANY_THERMISTOR_IS(11) // QU-BD silicone bed QWG-104F-3950 thermistor
81
  #include "thermistortable_11.h"
82
#endif
83
#if ANY_THERMISTOR_IS(13) // Hisens thermistor B25/50 =3950 +/-1%
84
  #include "thermistortable_13.h"
85
#endif
86
#if ANY_THERMISTOR_IS(15) // JGAurora A5 thermistor calibration
87
  #include "thermistortable_15.h"
88
#endif
89
#if ANY_THERMISTOR_IS(20) // PT100 with INA826 amp on Ultimaker v2.0 electronics
90
  #include "thermistortable_20.h"
91
#endif
92
#if ANY_THERMISTOR_IS(51) // 100k EPCOS (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
93
  #include "thermistortable_51.h"
94
#endif
95
#if ANY_THERMISTOR_IS(52) // 200k ATC Semitec 204GT-2 (WITH 1kohm RESISTOR FOR PULLUP, R9 ON SANGUINOLOLU! NOT FOR 4.7kohm PULLUP! THIS IS NOT NORMAL!)
96
  #include "thermistortable_52.h"
97
#endif
98
#if ANY_THERMISTOR_IS(55) // 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!)
99
  #include "thermistortable_55.h"
100
#endif
101
#if ANY_THERMISTOR_IS(60) // Maker's Tool Works Kapton Bed Thermistor
102
  #include "thermistortable_60.h"
103
#endif
104
#if ANY_THERMISTOR_IS(66) // DyzeDesign 500°C Thermistor
105
  #include "thermistortable_66.h"
106
#endif
107
#if ANY_THERMISTOR_IS(12) // 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
108
  #include "thermistortable_12.h"
109
#endif
110
#if ANY_THERMISTOR_IS(70) // bqh2 stock thermistor
111
  #include "thermistortable_70.h"
112
#endif
113
#if ANY_THERMISTOR_IS(75) // Many of the generic silicon heat pads use the MGB18-104F39050L32 Thermistor
114
  #include "thermistortable_75.h"
115
#endif
116
#if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
117
  #include "thermistortable_110.h"
118
#endif
119
#if ANY_THERMISTOR_IS(147) // Pt100 with 4k7 pullup
120
  #include "thermistortable_147.h"
121
#endif
122
#if ANY_THERMISTOR_IS(1010) // Pt1000 with 1k0 pullup
123
  #include "thermistortable_1010.h"
124
#endif
125
#if ANY_THERMISTOR_IS(1047) // Pt1000 with 4k7 pullup
126
  #include "thermistortable_1047.h"
127
#endif
128
#if ANY_THERMISTOR_IS(998) // User-defined table 1
129
  #include "thermistortable_998.h"
130
#endif
131
#if ANY_THERMISTOR_IS(999) // User-defined table 2
132
  #include "thermistortable_999.h"
133
#endif
134
 
135
#define _TT_NAME(_N) temptable_ ## _N
136
#define TT_NAME(_N) _TT_NAME(_N)
137
 
138
#if THERMISTORHEATER_0
139
  #define HEATER_0_TEMPTABLE TT_NAME(THERMISTORHEATER_0)
140
  #define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
141
#elif defined(HEATER_0_USES_THERMISTOR)
142
  #error "No heater 0 thermistor table specified"
143
#else
144
  #define HEATER_0_TEMPTABLE NULL
145
  #define HEATER_0_TEMPTABLE_LEN 0
146
#endif
147
 
148
#if THERMISTORHEATER_1
149
  #define HEATER_1_TEMPTABLE TT_NAME(THERMISTORHEATER_1)
150
  #define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE)
151
#elif defined(HEATER_1_USES_THERMISTOR)
152
  #error "No heater 1 thermistor table specified"
153
#else
154
  #define HEATER_1_TEMPTABLE NULL
155
  #define HEATER_1_TEMPTABLE_LEN 0
156
#endif
157
 
158
#if THERMISTORHEATER_2
159
  #define HEATER_2_TEMPTABLE TT_NAME(THERMISTORHEATER_2)
160
  #define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE)
161
#elif defined(HEATER_2_USES_THERMISTOR)
162
  #error "No heater 2 thermistor table specified"
163
#else
164
  #define HEATER_2_TEMPTABLE NULL
165
  #define HEATER_2_TEMPTABLE_LEN 0
166
#endif
167
 
168
#if THERMISTORHEATER_3
169
  #define HEATER_3_TEMPTABLE TT_NAME(THERMISTORHEATER_3)
170
  #define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE)
171
#elif defined(HEATER_3_USES_THERMISTOR)
172
  #error "No heater 3 thermistor table specified"
173
#else
174
  #define HEATER_3_TEMPTABLE NULL
175
  #define HEATER_3_TEMPTABLE_LEN 0
176
#endif
177
 
178
#if THERMISTORHEATER_4
179
  #define HEATER_4_TEMPTABLE TT_NAME(THERMISTORHEATER_4)
180
  #define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE)
181
#elif defined(HEATER_4_USES_THERMISTOR)
182
  #error "No heater 4 thermistor table specified"
183
#else
184
  #define HEATER_4_TEMPTABLE NULL
185
  #define HEATER_4_TEMPTABLE_LEN 0
186
#endif
187
 
188
#ifdef THERMISTORBED
189
  #define BEDTEMPTABLE TT_NAME(THERMISTORBED)
190
  #define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
191
#elif defined(HEATER_BED_USES_THERMISTOR)
192
  #error "No bed thermistor table specified"
193
#else
194
  #define BEDTEMPTABLE_LEN 0
195
#endif
196
 
197
#ifdef THERMISTORCHAMBER
198
  #define CHAMBERTEMPTABLE TT_NAME(THERMISTORCHAMBER)
199
  #define CHAMBERTEMPTABLE_LEN COUNT(CHAMBERTEMPTABLE)
200
#elif defined(HEATER_CHAMBER_USES_THERMISTOR)
201
  #error "No chamber thermistor table specified"
202
#else
203
  #define CHAMBERTEMPTABLE_LEN 0
204
#endif
205
 
206
// The SCAN_THERMISTOR_TABLE macro needs alteration?
207
static_assert(HEATER_0_TEMPTABLE_LEN < 256 && HEATER_1_TEMPTABLE_LEN < 256 && HEATER_2_TEMPTABLE_LEN < 256 && HEATER_3_TEMPTABLE_LEN < 256 && HEATER_4_TEMPTABLE_LEN < 256 && BEDTEMPTABLE_LEN < 256 && CHAMBERTEMPTABLE_LEN < 256,
208
  "Temperature conversion tables over 255 entries need special consideration."
209
);
210
 
211
// Set the high and low raw values for the heaters
212
// For thermistors the highest temperature results in the lowest ADC value
213
// For thermocouples the highest temperature results in the highest ADC value
214
#ifndef HEATER_0_RAW_HI_TEMP
215
  #ifdef HEATER_0_USES_THERMISTOR
216
    #define HEATER_0_RAW_HI_TEMP 0
217
    #define HEATER_0_RAW_LO_TEMP 16383
218
  #else
219
    #define HEATER_0_RAW_HI_TEMP 16383
220
    #define HEATER_0_RAW_LO_TEMP 0
221
  #endif
222
#endif
223
#ifndef HEATER_1_RAW_HI_TEMP
224
  #ifdef HEATER_1_USES_THERMISTOR
225
    #define HEATER_1_RAW_HI_TEMP 0
226
    #define HEATER_1_RAW_LO_TEMP 16383
227
  #else
228
    #define HEATER_1_RAW_HI_TEMP 16383
229
    #define HEATER_1_RAW_LO_TEMP 0
230
  #endif
231
#endif
232
#ifndef HEATER_2_RAW_HI_TEMP
233
  #ifdef HEATER_2_USES_THERMISTOR
234
    #define HEATER_2_RAW_HI_TEMP 0
235
    #define HEATER_2_RAW_LO_TEMP 16383
236
  #else
237
    #define HEATER_2_RAW_HI_TEMP 16383
238
    #define HEATER_2_RAW_LO_TEMP 0
239
  #endif
240
#endif
241
#ifndef HEATER_3_RAW_HI_TEMP
242
  #ifdef HEATER_3_USES_THERMISTOR
243
    #define HEATER_3_RAW_HI_TEMP 0
244
    #define HEATER_3_RAW_LO_TEMP 16383
245
  #else
246
    #define HEATER_3_RAW_HI_TEMP 16383
247
    #define HEATER_3_RAW_LO_TEMP 0
248
  #endif
249
#endif
250
#ifndef HEATER_4_RAW_HI_TEMP
251
  #ifdef HEATER_4_USES_THERMISTOR
252
    #define HEATER_4_RAW_HI_TEMP 0
253
    #define HEATER_4_RAW_LO_TEMP 16383
254
  #else
255
    #define HEATER_4_RAW_HI_TEMP 16383
256
    #define HEATER_4_RAW_LO_TEMP 0
257
  #endif
258
#endif
259
#ifndef HEATER_BED_RAW_HI_TEMP
260
  #ifdef HEATER_BED_USES_THERMISTOR
261
    #define HEATER_BED_RAW_HI_TEMP 0
262
    #define HEATER_BED_RAW_LO_TEMP 16383
263
  #else
264
    #define HEATER_BED_RAW_HI_TEMP 16383
265
    #define HEATER_BED_RAW_LO_TEMP 0
266
  #endif
267
#endif
268
#ifndef HEATER_CHAMBER_RAW_HI_TEMP
269
  #ifdef HEATER_CHAMBER_USES_THERMISTOR
270
    #define HEATER_CHAMBER_RAW_HI_TEMP 0
271
    #define HEATER_CHAMBER_RAW_LO_TEMP 16383
272
  #else
273
    #define HEATER_CHAMBER_RAW_HI_TEMP 16383
274
    #define HEATER_CHAMBER_RAW_LO_TEMP 0
275
  #endif
276
#endif
277
 
278
#endif // THERMISTORTABLES_H_