2016-03-25 01:19:46 -05:00
/**
2016-03-24 13:01:20 -05:00
* Marlin 3 D Printer Firmware
2020-02-03 08:00:57 -06:00
* Copyright ( c ) 2020 MarlinFirmware [ https : //github.com/MarlinFirmware/Marlin]
2016-03-24 13:01:20 -05:00
*
* Based on Sprinter and grbl .
2019-06-27 23:57:50 -05:00
* Copyright ( c ) 2011 Camiel Gubbels / Erik van der Zalm
2016-03-24 13:01:20 -05:00
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2020-07-22 22:20:14 -05:00
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
2016-03-24 13:01:20 -05:00
*
*/
2018-11-04 02:25:55 -06:00
# pragma once
2011-08-12 15:28:35 -05:00
2017-09-06 06:28:32 -05:00
# include "../../inc/MarlinConfig.h"
2011-11-15 15:50:43 -06:00
2020-04-17 22:33:15 -05:00
# define THERMISTOR_TABLE_ADC_RESOLUTION 10
# define THERMISTOR_TABLE_SCALE (HAL_ADC_RANGE / _BV(THERMISTOR_TABLE_ADC_RESOLUTION))
2019-11-06 17:49:17 -06:00
# if ENABLED(HAL_ADC_FILTERED)
# define OVERSAMPLENR 1
2020-12-21 18:30:03 -06:00
# elif HAL_ADC_RESOLUTION > 10
# define OVERSAMPLENR (20 - HAL_ADC_RESOLUTION)
2019-11-06 17:49:17 -06:00
# else
# define OVERSAMPLENR 16
# endif
# define MAX_RAW_THERMISTOR_VALUE (HAL_ADC_RANGE * (OVERSAMPLENR) - 1)
// Currently Marlin stores all oversampled ADC values as int16_t, make sure the HAL settings do not overflow 15bit
# if MAX_RAW_THERMISTOR_VALUE > ((1 << 15) - 1)
# error "MAX_RAW_THERMISTOR_VALUE is too large for int16_t. Reduce OVERSAMPLENR or HAL_ADC_RESOLUTION."
# endif
2020-01-30 18:00:37 -06:00
# define OV_SCALE(N) (N)
# define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE))
2011-08-12 15:28:35 -05:00
2021-03-06 14:13:28 -06:00
# define ANY_THERMISTOR_IS(n) (TEMP_SENSOR_0_THERMISTOR_ID == n || TEMP_SENSOR_1_THERMISTOR_ID == n || TEMP_SENSOR_2_THERMISTOR_ID == n || TEMP_SENSOR_3_THERMISTOR_ID == n || TEMP_SENSOR_4_THERMISTOR_ID == n || TEMP_SENSOR_5_THERMISTOR_ID == n || TEMP_SENSOR_6_THERMISTOR_ID == n || TEMP_SENSOR_7_THERMISTOR_ID == n || TEMP_SENSOR_BED_THERMISTOR_ID == n || TEMP_SENSOR_CHAMBER_THERMISTOR_ID == n || TEMP_SENSOR_COOLER_THERMISTOR_ID == n || TEMP_SENSOR_PROBE_THERMISTOR_ID == n)
2016-07-08 21:54:45 -05:00
2020-07-01 16:27:28 -05:00
typedef struct { int16_t value , celsius ; } temp_entry_t ;
2016-12-19 16:27:39 -06:00
// Pt1000 and Pt100 handling
//
// Rt=R0*(1+a*T+b*T*T) [for T>0]
// a=3.9083E-3, b=-5.775E-7
# define PtA 3.9083E-3
# define PtB -5.775E-7
2018-11-04 02:25:55 -06:00
# define PtRt(T,R0) ((R0) * (1.0 + (PtA) * (T) + (PtB) * (T) * (T)))
# define PtAdVal(T,R0,Rup) (short)(1024 / (Rup / PtRt(T, R0) + 1))
# define PtLine(T,R0,Rup) { OV(PtAdVal(T, R0, Rup)), T }
2016-12-19 16:27:39 -06:00
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(1) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "EPCOS"
2017-09-06 06:28:32 -05:00
# include "thermistor_1.h"
2011-08-12 15:28:35 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(2) // 4338 K, R25 = 200 kOhm, Pull-up = 4.7 kOhm, "ATC Semitec 204GT-2"
2017-09-06 06:28:32 -05:00
# include "thermistor_2.h"
2011-08-12 15:28:35 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(3) // beta25 = 4120 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Mendel-parts"
2017-09-06 06:28:32 -05:00
# include "thermistor_3.h"
2011-08-12 15:28:35 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(4) // beta25 = 3950 K, R25 = 10 kOhm, Pull-up = 4.7 kOhm, "Generic"
2017-09-06 06:28:32 -05:00
# include "thermistor_4.h"
2011-11-04 16:51:14 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(5) // beta25 = 4267 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "ParCan, ATC 104GT-2"
2017-09-06 06:28:32 -05:00
# include "thermistor_5.h"
2011-11-04 16:51:14 -05:00
# endif
2018-07-03 17:52:06 -05:00
# if ANY_THERMISTOR_IS(501) // 100K Zonestar thermistor
# include "thermistor_501.h"
# endif
2020-08-26 02:15:43 -05:00
# if ANY_THERMISTOR_IS(502) // Unknown thermistor used by the Zonestar Průša P802M hot bed
2020-06-14 20:09:25 -05:00
# include "thermistor_502.h"
# endif
2020-11-07 16:59:19 -06:00
# if ANY_THERMISTOR_IS(503) // Zonestar (Z8XM2) Heated Bed thermistor
# include "thermistor_503.h"
# endif
2019-07-05 20:37:05 -05:00
# if ANY_THERMISTOR_IS(512) // 100k thermistor in RPW-Ultra hotend, Pull-up = 4.7 kOhm, "unknown model"
# include "thermistor_512.h"
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(6) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 8.2 kOhm, "EPCOS ?"
2017-09-06 06:28:32 -05:00
# include "thermistor_6.h"
2011-11-04 16:51:14 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(7) // beta25 = 3974 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Honeywell 135-104LAG-J01"
2017-09-06 06:28:32 -05:00
# include "thermistor_7.h"
2011-11-04 16:51:14 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(71) // beta25 = 3974 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Honeywell 135-104LAF-J01"
2017-09-06 06:28:32 -05:00
# include "thermistor_71.h"
2013-07-30 07:01:41 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(8) // beta25 = 3950 K, R25 = 100 kOhm, Pull-up = 10 kOhm, "Vishay E3104FHT"
2017-09-06 06:28:32 -05:00
# include "thermistor_8.h"
2012-12-30 05:09:38 -06:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(9) // beta25 = 3960 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "GE Sensing AL03006-58.2K-97-G1"
2017-09-06 06:28:32 -05:00
# include "thermistor_9.h"
2012-12-30 05:09:38 -06:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(10) // beta25 = 3960 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "RS 198-961"
2017-09-06 06:28:32 -05:00
# include "thermistor_10.h"
2012-12-30 05:09:38 -06:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(11) // beta25 = 3950 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "QU-BD silicone bed, QWG-104F-3950"
2017-09-06 06:28:32 -05:00
# include "thermistor_11.h"
2014-04-13 10:03:20 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(13) // beta25 = 4100 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Hisens"
2017-09-06 06:28:32 -05:00
# include "thermistor_13.h"
2014-09-26 14:49:07 -05:00
# endif
2018-01-21 17:12:37 -06:00
# if ANY_THERMISTOR_IS(15) // JGAurora A5 thermistor calibration
# include "thermistor_15.h"
# endif
2020-10-29 20:02:29 -05:00
# if ANY_THERMISTOR_IS(17) // Dagoma NTC 100k white thermistor
# include "thermistor_17.h"
# endif
2019-06-04 19:25:00 -05:00
# if ANY_THERMISTOR_IS(18) // ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327
# include "thermistor_18.h"
# endif
2019-08-03 20:57:56 -05:00
# if ANY_THERMISTOR_IS(20) // Pt100 with INA826 amp on Ultimaker v2.0 electronics
2017-09-06 06:28:32 -05:00
# include "thermistor_20.h"
2015-01-23 16:13:06 -06:00
# endif
2020-01-30 18:00:37 -06:00
# if ANY_THERMISTOR_IS(21) // Pt100 with INA826 amp with 3.3v excitation based on "Pt100 with INA826 amp on Ultimaker v2.0 electronics"
# include "thermistor_21.h"
# endif
2020-05-02 18:45:54 -05:00
# if ANY_THERMISTOR_IS(22) // Thermistor in a Rostock 301 hot end, calibrated with a multimeter
2020-05-05 01:24:20 -05:00
# include "thermistor_22.h"
2020-05-02 18:45:54 -05:00
# endif
# if ANY_THERMISTOR_IS(23) // By AluOne #12622. Formerly 22 above. May need calibration/checking.
# include "thermistor_23.h"
# endif
2020-09-27 21:38:30 -05:00
# if ANY_THERMISTOR_IS(30) // Kis3d Silicone mat 24V 200W/300W with 6mm Precision cast plate (EN AW 5083)
# include "thermistor_30.h"
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(51) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 1 kOhm, "EPCOS"
2017-09-06 06:28:32 -05:00
# include "thermistor_51.h"
2012-05-19 06:52:12 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(52) // beta25 = 4338 K, R25 = 200 kOhm, Pull-up = 1 kOhm, "ATC Semitec 204GT-2"
2017-09-06 06:28:32 -05:00
# include "thermistor_52.h"
2012-05-20 05:35:28 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(55) // beta25 = 4267 K, R25 = 100 kOhm, Pull-up = 1 kOhm, "ATC Semitec 104GT-2 (Used on ParCan)"
2017-09-06 06:28:32 -05:00
# include "thermistor_55.h"
2012-05-20 14:18:45 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(60) // beta25 = 3950 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Maker's Tool Works Kapton Bed"
2017-09-06 06:28:32 -05:00
# include "thermistor_60.h"
2013-03-18 22:53:37 -05:00
# endif
2018-12-20 17:04:17 -06:00
# if ANY_THERMISTOR_IS(61) // beta25 = 3950 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Formbot 350°C Thermistor"
# include "thermistor_61.h"
# endif
2018-07-26 05:52:22 -05:00
# if ANY_THERMISTOR_IS(66) // beta25 = 4500 K, R25 = 2.5 MOhm, Pull-up = 4.7 kOhm, "DyzeDesign 500 °C Thermistor"
2017-09-06 06:28:32 -05:00
# include "thermistor_66.h"
2016-07-08 21:28:37 -05:00
# endif
2019-02-28 19:44:17 -06:00
# if ANY_THERMISTOR_IS(67) // R25 = 500 KOhm, beta25 = 3800 K, 4.7 kOhm pull-up, SliceEngineering 450 °C Thermistor
# include "thermistor_67.h"
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(12) // beta25 = 4700 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Personal calibration for Makibox hot bed"
2017-09-06 06:28:32 -05:00
# include "thermistor_12.h"
2014-04-24 03:49:42 -05:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(70) // beta25 = 4100 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Hephestos 2, bqh2 stock thermistor"
2017-09-06 06:28:32 -05:00
# include "thermistor_70.h"
2016-02-27 13:17:07 -06:00
# endif
2018-02-04 06:06:21 -06:00
# if ANY_THERMISTOR_IS(75) // beta25 = 4100 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "MGB18-104F39050L32 thermistor"
2017-09-06 06:28:32 -05:00
# include "thermistor_75.h"
2017-03-18 10:17:44 -05:00
# endif
2019-09-21 15:45:35 -05:00
# if ANY_THERMISTOR_IS(99) // 100k bed thermistor with a 10K pull-up resistor (on some Wanhao i3 models)
# include "thermistor_99.h"
# endif
2016-07-08 21:54:45 -05:00
# if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
2017-09-06 06:28:32 -05:00
# include "thermistor_110.h"
2014-02-14 05:15:31 -06:00
# endif
2016-07-08 21:54:45 -05:00
# if ANY_THERMISTOR_IS(147) // Pt100 with 4k7 pullup
2017-09-06 06:28:32 -05:00
# include "thermistor_147.h"
2014-02-14 05:15:31 -06:00
# endif
2019-08-03 20:57:56 -05:00
# if ANY_THERMISTOR_IS(201) // Pt100 with LMV324 Overlord
# include "thermistor_201.h"
# endif
2020-03-17 15:25:10 -05:00
# if ANY_THERMISTOR_IS(202) // 200K thermistor in Copymaker3D hotend
# include "thermistor_202.h"
# endif
2020-01-21 01:10:31 -06:00
# if ANY_THERMISTOR_IS(331) // Like table 1, but with 3V3 as input voltage for MEGA
2019-08-20 03:40:48 -05:00
# include "thermistor_331.h"
# endif
2020-01-21 01:10:31 -06:00
# if ANY_THERMISTOR_IS(332) // Like table 1, but with 3V3 as input voltage for DUE
# include "thermistor_332.h"
# endif
2018-07-26 05:52:22 -05:00
# if ANY_THERMISTOR_IS(666) // beta25 = UNK, R25 = 200K, Pull-up = 10 kOhm, "Unidentified 200K NTC thermistor (Einstart S)"
# include "thermistor_666.h"
# endif
2016-07-08 21:54:45 -05:00
# if ANY_THERMISTOR_IS(1010) // Pt1000 with 1k0 pullup
2017-09-06 06:28:32 -05:00
# include "thermistor_1010.h"
2014-02-14 05:15:31 -06:00
# endif
2016-07-08 21:54:45 -05:00
# if ANY_THERMISTOR_IS(1047) // Pt1000 with 4k7 pullup
2017-09-06 06:28:32 -05:00
# include "thermistor_1047.h"
2014-02-14 05:15:31 -06:00
# endif
2016-12-19 16:27:39 -06:00
# if ANY_THERMISTOR_IS(998) // User-defined table 1
2017-09-06 06:28:32 -05:00
# include "thermistor_998.h"
2015-02-22 08:02:04 -06:00
# endif
2016-12-19 16:27:39 -06:00
# if ANY_THERMISTOR_IS(999) // User-defined table 2
2017-09-06 06:28:32 -05:00
# include "thermistor_999.h"
2015-02-24 04:02:16 -06:00
# endif
2019-05-26 01:30:15 -05:00
# if ANY_THERMISTOR_IS(1000) // Custom
2020-07-01 16:27:28 -05:00
const temp_entry_t temptable_1000 [ ] PROGMEM = { { 0 , 0 } } ;
2019-05-26 01:30:15 -05:00
# endif
2015-02-22 08:02:04 -06:00
2011-12-05 22:33:33 -06:00
# define _TT_NAME(_N) temptable_ ## _N
# define TT_NAME(_N) _TT_NAME(_N)
2011-11-04 16:51:14 -05:00
2020-07-01 16:27:28 -05:00
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_0_THERMISTOR_ID
# define TEMPTABLE_0 TT_NAME(TEMP_SENSOR_0_THERMISTOR_ID)
# define TEMPTABLE_0_LEN COUNT(TEMPTABLE_0)
# elif TEMP_SENSOR_0_IS_THERMISTOR
2016-12-19 16:27:39 -06:00
# error "No heater 0 thermistor table specified"
2011-12-05 22:33:33 -06:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_0 nullptr
# define TEMPTABLE_0_LEN 0
2016-12-19 16:27:39 -06:00
# endif
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_1_THERMISTOR_ID
# define TEMPTABLE_1 TT_NAME(TEMP_SENSOR_1_THERMISTOR_ID)
# define TEMPTABLE_1_LEN COUNT(TEMPTABLE_1)
# elif TEMP_SENSOR_1_IS_THERMISTOR
2016-12-19 16:27:39 -06:00
# error "No heater 1 thermistor table specified"
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_1 nullptr
# define TEMPTABLE_1_LEN 0
2012-12-09 16:00:06 -06:00
# endif
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_2_THERMISTOR_ID
# define TEMPTABLE_2 TT_NAME(TEMP_SENSOR_2_THERMISTOR_ID)
# define TEMPTABLE_2_LEN COUNT(TEMPTABLE_2)
# elif TEMP_SENSOR_2_IS_THERMISTOR
2016-12-19 16:27:39 -06:00
# error "No heater 2 thermistor table specified"
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_2 nullptr
# define TEMPTABLE_2_LEN 0
2016-12-19 16:27:39 -06:00
# endif
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_3_THERMISTOR_ID
# define TEMPTABLE_3 TT_NAME(TEMP_SENSOR_3_THERMISTOR_ID)
# define TEMPTABLE_3_LEN COUNT(TEMPTABLE_3)
# elif TEMP_SENSOR_3_IS_THERMISTOR
2016-12-19 16:27:39 -06:00
# error "No heater 3 thermistor table specified"
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_3 nullptr
# define TEMPTABLE_3_LEN 0
2016-12-19 16:27:39 -06:00
# endif
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_4_THERMISTOR_ID
# define TEMPTABLE_4 TT_NAME(TEMP_SENSOR_4_THERMISTOR_ID)
# define TEMPTABLE_4_LEN COUNT(TEMPTABLE_4)
# elif TEMP_SENSOR_4_IS_THERMISTOR
2017-04-06 16:46:30 -05:00
# error "No heater 4 thermistor table specified"
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_4 nullptr
# define TEMPTABLE_4_LEN 0
2017-04-06 16:46:30 -05:00
# endif
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_5_THERMISTOR_ID
# define TEMPTABLE_5 TT_NAME(TEMP_SENSOR_5_THERMISTOR_ID)
# define TEMPTABLE_5_LEN COUNT(TEMPTABLE_5)
# elif TEMP_SENSOR_5_IS_THERMISTOR
2019-03-07 01:00:44 -06:00
# error "No heater 5 thermistor table specified"
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_5 nullptr
# define TEMPTABLE_5_LEN 0
2019-03-07 01:00:44 -06:00
# endif
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_6_THERMISTOR_ID
# define TEMPTABLE_6 TT_NAME(TEMP_SENSOR_6_THERMISTOR_ID)
# define TEMPTABLE_6_LEN COUNT(TEMPTABLE_6)
# elif TEMP_SENSOR_6_IS_THERMISTOR
2020-01-25 02:13:39 -06:00
# error "No heater 6 thermistor table specified"
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_6 nullptr
# define TEMPTABLE_6_LEN 0
2020-01-25 02:13:39 -06:00
# endif
2021-02-07 16:58:06 -06:00
# if TEMP_SENSOR_7_THERMISTOR_ID
# define TEMPTABLE_7 TT_NAME(TEMP_SENSOR_7_THERMISTOR_ID)
# define TEMPTABLE_7_LEN COUNT(TEMPTABLE_7)
# elif TEMP_SENSOR_7_IS_THERMISTOR
2020-01-25 02:13:39 -06:00
# error "No heater 7 thermistor table specified"
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_7 nullptr
# define TEMPTABLE_7_LEN 0
2020-01-25 02:13:39 -06:00
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMP_SENSOR_BED_THERMISTOR_ID
# define TEMPTABLE_BED TT_NAME(TEMP_SENSOR_BED_THERMISTOR_ID)
# define TEMPTABLE_BED_LEN COUNT(TEMPTABLE_BED)
# elif TEMP_SENSOR_BED_IS_THERMISTOR
2018-05-28 06:18:11 -05:00
# error "No bed thermistor table specified"
2016-12-19 16:27:39 -06:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_BED_LEN 0
2016-12-19 16:27:39 -06:00
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMP_SENSOR_CHAMBER_THERMISTOR_ID
# define TEMPTABLE_CHAMBER TT_NAME(TEMP_SENSOR_CHAMBER_THERMISTOR_ID)
# define TEMPTABLE_CHAMBER_LEN COUNT(TEMPTABLE_CHAMBER)
# elif TEMP_SENSOR_CHAMBER_IS_THERMISTOR
2018-05-28 06:18:11 -05:00
# error "No chamber thermistor table specified"
2018-02-24 00:38:58 -06:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_CHAMBER_LEN 0
2018-02-24 00:38:58 -06:00
# endif
2020-07-01 16:27:28 -05:00
2021-03-06 14:13:28 -06:00
# ifdef TEMP_SENSOR_COOLER_THERMISTOR_ID
# define TEMPTABLE_COOLER TT_NAME(TEMP_SENSOR_COOLER_THERMISTOR_ID)
# define TEMPTABLE_COOLER_LEN COUNT(TEMPTABLE_COOLER)
# elif TEMP_SENSOR_COOLER_IS_THERMISTOR
# error "No cooler thermistor table specified"
# else
# define TEMPTABLE_COOLER_LEN 0
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMP_SENSOR_PROBE_THERMISTOR_ID
# define TEMPTABLE_PROBE TT_NAME(TEMP_SENSOR_PROBE_THERMISTOR_ID)
# define TEMPTABLE_PROBE_LEN COUNT(TEMPTABLE_PROBE)
# elif TEMP_SENSOR_PROBE_IS_THERMISTOR
2020-07-01 16:27:28 -05:00
# error "No probe thermistor table specified"
2020-01-17 17:16:45 -06:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_PROBE_LEN 0
2020-01-17 17:16:45 -06:00
# endif
2018-02-24 00:38:58 -06:00
2018-05-28 06:18:11 -05:00
// The SCAN_THERMISTOR_TABLE macro needs alteration?
2019-05-26 01:30:15 -05:00
static_assert (
2021-02-07 16:58:06 -06:00
TEMPTABLE_0_LEN < 256 & & TEMPTABLE_1_LEN < 256
& & TEMPTABLE_2_LEN < 256 & & TEMPTABLE_3_LEN < 256
& & TEMPTABLE_4_LEN < 256 & & TEMPTABLE_5_LEN < 256
& & TEMPTABLE_6_LEN < 256 & & TEMPTABLE_7_LEN < 256
& & TEMPTABLE_BED_LEN < 256 & & TEMPTABLE_CHAMBER_LEN < 256
2021-03-06 14:13:28 -06:00
& & TEMPTABLE_COOLER_LEN < 256 & & TEMPTABLE_PROBE_LEN < 256 ,
2018-07-11 19:44:06 -05:00
" Temperature conversion tables over 255 entries need special consideration. "
2018-05-28 06:18:11 -05:00
) ;
2016-12-19 16:27:39 -06:00
// Set the high and low raw values for the heaters
// For thermistors the highest temperature results in the lowest ADC value
// For thermocouples the highest temperature results in the highest ADC value
2020-07-01 16:27:28 -05:00
2021-02-07 16:58:06 -06:00
# define _TT_REV(N) REVERSE_TEMP_SENSOR_RANGE_##N
# define TT_REV(N) _TT_REV(TEMP_SENSOR_##N##_THERMISTOR_ID)
# define _TT_REVRAW(N) !TEMP_SENSOR_##N##_IS_THERMISTOR
# define TT_REVRAW(N) (TT_REV(N) || _TT_REVRAW(N))
2020-07-01 16:27:28 -05:00
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_0
# if TT_REV(0)
# define TEMP_SENSOR_0_MINTEMP_IND 0
# define TEMPTABLE_0_MAXTEMP_IND HEATER_0_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_0_MINTEMP_IND HEATER_0_LEN - 1
# define TEMP_SENSOR_0_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_1
# if TT_REV(1)
# define TEMP_SENSOR_1_MINTEMP_IND 0
# define TEMPTABLE_1_MAXTEMP_IND HEATER_1_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_1_MINTEMP_IND HEATER_1_LEN - 1
# define TEMP_SENSOR_1_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_2
# if TT_REV(2)
# define TEMP_SENSOR_2_MINTEMP_IND 0
# define TEMPTABLE_2_MAXTEMP_IND HEATER_2_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_2_MINTEMP_IND HEATER_2_LEN - 1
# define TEMP_SENSOR_2_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_3
# if TT_REV(3)
# define TEMP_SENSOR_3_MINTEMP_IND 0
# define TEMPTABLE_3_MAXTEMP_IND HEATER_3_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_3_MINTEMP_IND HEATER_3_LEN - 1
# define TEMP_SENSOR_3_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_4
# if TT_REV(4)
# define TEMP_SENSOR_4_MINTEMP_IND 0
# define TEMPTABLE_4_MAXTEMP_IND HEATER_4_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_4_MINTEMP_IND HEATER_4_LEN - 1
# define TEMP_SENSOR_4_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_5
# if TT_REV(5)
# define TEMP_SENSOR_5_MINTEMP_IND 0
# define TEMPTABLE_5_MAXTEMP_IND HEATER_5_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_5_MINTEMP_IND HEATER_5_LEN - 1
# define TEMP_SENSOR_5_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_6
# if TT_REV(6)
# define TEMP_SENSOR_6_MINTEMP_IND 0
# define TEMPTABLE_6_MAXTEMP_IND HEATER_6_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_6_MINTEMP_IND HEATER_6_LEN - 1
# define TEMP_SENSOR_6_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifdef TEMPTABLE_7
# if TT_REV(7)
# define TEMP_SENSOR_7_MINTEMP_IND 0
# define TEMPTABLE_7_MAXTEMP_IND HEATER_7_LEN - 1
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMPTABLE_7_MINTEMP_IND HEATER_7_LEN - 1
# define TEMP_SENSOR_7_MAXTEMP_IND 0
2020-07-01 16:27:28 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_0_RAW_HI_TEMP
# if TT_REVRAW(0)
# define TEMP_SENSOR_0_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_0_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_0_RAW_HI_TEMP 0
# define TEMP_SENSOR_0_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2015-10-03 01:08:58 -05:00
# endif
2011-11-05 13:21:36 -05:00
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_1_RAW_HI_TEMP
# if TT_REVRAW(1)
# define TEMP_SENSOR_1_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_1_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_1_RAW_HI_TEMP 0
# define TEMP_SENSOR_1_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2015-10-03 01:08:58 -05:00
# endif
2011-11-04 16:51:14 -05:00
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_2_RAW_HI_TEMP
# if TT_REVRAW(2)
# define TEMP_SENSOR_2_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_2_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_2_RAW_HI_TEMP 0
# define TEMP_SENSOR_2_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2015-10-03 01:08:58 -05:00
# endif
2011-12-05 22:33:33 -06:00
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_3_RAW_HI_TEMP
# if TT_REVRAW(3)
# define TEMP_SENSOR_3_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_3_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_3_RAW_HI_TEMP 0
# define TEMP_SENSOR_3_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2015-10-03 01:08:58 -05:00
# endif
2015-01-23 16:13:06 -06:00
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_4_RAW_HI_TEMP
# if TT_REVRAW(4)
# define TEMP_SENSOR_4_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_4_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_4_RAW_HI_TEMP 0
# define TEMP_SENSOR_4_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2017-04-14 17:14:14 -05:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_5_RAW_HI_TEMP
# if TT_REVRAW(5)
# define TEMP_SENSOR_5_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_5_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_5_RAW_HI_TEMP 0
# define TEMP_SENSOR_5_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2019-03-07 02:09:39 -06:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_6_RAW_HI_TEMP
# if TT_REVRAW(6)
# define TEMP_SENSOR_6_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_6_RAW_LO_TEMP 0
2020-01-25 02:13:39 -06:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_6_RAW_HI_TEMP 0
# define TEMP_SENSOR_6_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2020-01-25 02:13:39 -06:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_7_RAW_HI_TEMP
# if TT_REVRAW(7)
# define TEMP_SENSOR_7_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_7_RAW_LO_TEMP 0
2020-01-25 02:13:39 -06:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_7_RAW_HI_TEMP 0
# define TEMP_SENSOR_7_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2020-01-25 02:13:39 -06:00
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_BED_RAW_HI_TEMP
# if TT_REVRAW(BED)
# define TEMP_SENSOR_BED_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_BED_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_BED_RAW_HI_TEMP 0
# define TEMP_SENSOR_BED_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2015-10-03 01:08:58 -05:00
# endif
2012-12-09 16:00:06 -06:00
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_CHAMBER_RAW_HI_TEMP
# if TT_REVRAW(CHAMBER)
# define TEMP_SENSOR_CHAMBER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_CHAMBER_RAW_LO_TEMP 0
2019-08-03 20:57:56 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_CHAMBER_RAW_HI_TEMP 0
# define TEMP_SENSOR_CHAMBER_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2018-02-24 00:38:58 -06:00
# endif
# endif
2021-03-06 14:13:28 -06:00
# ifndef TEMP_SENSOR_COOLER_RAW_HI_TEMP
# if TT_REVRAW(COOLER)
# define TEMP_SENSOR_COOLER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_COOLER_RAW_LO_TEMP 0
# else
# define TEMP_SENSOR_COOLER_RAW_HI_TEMP 0
# define TEMP_SENSOR_COOLER_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
# endif
# endif
2021-02-07 16:58:06 -06:00
# ifndef TEMP_SENSOR_PROBE_RAW_HI_TEMP
# if TT_REVRAW(PROBE)
# define TEMP_SENSOR_PROBE_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
# define TEMP_SENSOR_PROBE_RAW_LO_TEMP 0
2020-07-01 16:27:28 -05:00
# else
2021-02-07 16:58:06 -06:00
# define TEMP_SENSOR_PROBE_RAW_HI_TEMP 0
# define TEMP_SENSOR_PROBE_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
2020-07-01 16:27:28 -05:00
# endif
# endif
2019-08-03 20:57:56 -05:00
2020-07-01 16:27:28 -05:00
# undef _TT_REV
# undef TT_REV
2021-02-07 16:58:06 -06:00
# undef _TT_REVRAW
# undef TT_REVRAW