2016-03-25 06:19:46 +00:00
/**
2016-03-24 18:01:20 +00:00
* Marlin 3 D Printer Firmware
2019-02-12 21:06:53 +00:00
* Copyright ( C ) 2019 MarlinFirmware [ https : //github.com/MarlinFirmware/Marlin]
2016-03-24 18:01:20 +00:00
*
* Based on Sprinter and grbl .
* Copyright ( C ) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*
*/
2018-11-04 08:25:55 +00:00
# pragma once
2011-08-12 20:28:35 +00:00
2017-09-06 11:28:32 +00:00
# include "../../inc/MarlinConfig.h"
2011-11-15 21:50:43 +00:00
2011-11-04 17:02:56 +00:00
# define OVERSAMPLENR 16
2017-11-15 09:14:55 +00:00
# define OV(N) int16_t((N) * (OVERSAMPLENR))
2011-08-12 20:28:35 +00:00
2019-05-06 23:51:06 +00:00
# define ANY_THERMISTOR_IS(n) (THERMISTOR_HEATER_0 == n || THERMISTOR_HEATER_1 == n || THERMISTOR_HEATER_2 == n || THERMISTOR_HEATER_3 == n || THERMISTOR_HEATER_4 == n || THERMISTOR_HEATER_5 == n || THERMISTORBED == n || THERMISTORCHAMBER == n)
2016-07-09 02:54:45 +00:00
2016-12-19 22:27:39 +00: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 08:25:55 +00: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 22:27:39 +00:00
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(1) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "EPCOS"
2017-09-06 11:28:32 +00:00
# include "thermistor_1.h"
2011-08-12 20:28:35 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(2) // 4338 K, R25 = 200 kOhm, Pull-up = 4.7 kOhm, "ATC Semitec 204GT-2"
2017-09-06 11:28:32 +00:00
# include "thermistor_2.h"
2011-08-12 20:28:35 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(3) // beta25 = 4120 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Mendel-parts"
2017-09-06 11:28:32 +00:00
# include "thermistor_3.h"
2011-08-12 20:28:35 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(4) // beta25 = 3950 K, R25 = 10 kOhm, Pull-up = 4.7 kOhm, "Generic"
2017-09-06 11:28:32 +00:00
# include "thermistor_4.h"
2011-11-04 21:51:14 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(5) // beta25 = 4267 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "ParCan, ATC 104GT-2"
2017-09-06 11:28:32 +00:00
# include "thermistor_5.h"
2011-11-04 21:51:14 +00:00
# endif
2018-07-03 22:52:06 +00:00
# if ANY_THERMISTOR_IS(501) // 100K Zonestar thermistor
# include "thermistor_501.h"
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(6) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 8.2 kOhm, "EPCOS ?"
2017-09-06 11:28:32 +00:00
# include "thermistor_6.h"
2011-11-04 21:51:14 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(7) // beta25 = 3974 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Honeywell 135-104LAG-J01"
2017-09-06 11:28:32 +00:00
# include "thermistor_7.h"
2011-11-04 21:51:14 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(71) // beta25 = 3974 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Honeywell 135-104LAF-J01"
2017-09-06 11:28:32 +00:00
# include "thermistor_71.h"
2013-07-30 12:01:41 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(8) // beta25 = 3950 K, R25 = 100 kOhm, Pull-up = 10 kOhm, "Vishay E3104FHT"
2017-09-06 11:28:32 +00:00
# include "thermistor_8.h"
2012-12-30 11:09:38 +00:00
# endif
2018-02-04 12:06:21 +00: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 11:28:32 +00:00
# include "thermistor_9.h"
2012-12-30 11:09:38 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(10) // beta25 = 3960 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "RS 198-961"
2017-09-06 11:28:32 +00:00
# include "thermistor_10.h"
2012-12-30 11:09:38 +00:00
# endif
2018-02-04 12:06:21 +00: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 11:28:32 +00:00
# include "thermistor_11.h"
2014-04-13 15:03:20 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(13) // beta25 = 4100 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Hisens"
2017-09-06 11:28:32 +00:00
# include "thermistor_13.h"
2014-09-26 19:49:07 +00:00
# endif
2018-01-21 23:12:37 +00:00
# if ANY_THERMISTOR_IS(15) // JGAurora A5 thermistor calibration
# include "thermistor_15.h"
# endif
2016-07-09 02:54:45 +00:00
# if ANY_THERMISTOR_IS(20) // PT100 with INA826 amp on Ultimaker v2.0 electronics
2017-09-06 11:28:32 +00:00
# include "thermistor_20.h"
2015-01-23 22:13:06 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(51) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 1 kOhm, "EPCOS"
2017-09-06 11:28:32 +00:00
# include "thermistor_51.h"
2012-05-19 11:52:12 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(52) // beta25 = 4338 K, R25 = 200 kOhm, Pull-up = 1 kOhm, "ATC Semitec 204GT-2"
2017-09-06 11:28:32 +00:00
# include "thermistor_52.h"
2012-05-20 10:35:28 +00:00
# endif
2018-02-04 12:06:21 +00: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 11:28:32 +00:00
# include "thermistor_55.h"
2012-05-20 19:18:45 +00:00
# endif
2018-02-04 12:06:21 +00: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 11:28:32 +00:00
# include "thermistor_60.h"
2013-03-19 03:53:37 +00:00
# endif
2018-12-20 23:04:17 +00: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 10:52:22 +00: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 11:28:32 +00:00
# include "thermistor_66.h"
2016-07-09 02:28:37 +00:00
# endif
2019-03-01 01:44:17 +00: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 12:06:21 +00: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 11:28:32 +00:00
# include "thermistor_12.h"
2014-04-24 08:49:42 +00:00
# endif
2018-02-04 12:06:21 +00: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 11:28:32 +00:00
# include "thermistor_70.h"
2016-02-27 19:17:07 +00:00
# endif
2018-02-04 12:06:21 +00:00
# if ANY_THERMISTOR_IS(75) // beta25 = 4100 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "MGB18-104F39050L32 thermistor"
2017-09-06 11:28:32 +00:00
# include "thermistor_75.h"
2017-03-18 15:17:44 +00:00
# endif
2016-07-09 02:54:45 +00:00
# if ANY_THERMISTOR_IS(110) // Pt100 with 1k0 pullup
2017-09-06 11:28:32 +00:00
# include "thermistor_110.h"
2014-02-14 11:15:31 +00:00
# endif
2016-07-09 02:54:45 +00:00
# if ANY_THERMISTOR_IS(147) // Pt100 with 4k7 pullup
2017-09-06 11:28:32 +00:00
# include "thermistor_147.h"
2014-02-14 11:15:31 +00:00
# endif
2018-07-26 10:52:22 +00: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-09 02:54:45 +00:00
# if ANY_THERMISTOR_IS(1010) // Pt1000 with 1k0 pullup
2017-09-06 11:28:32 +00:00
# include "thermistor_1010.h"
2014-02-14 11:15:31 +00:00
# endif
2016-07-09 02:54:45 +00:00
# if ANY_THERMISTOR_IS(1047) // Pt1000 with 4k7 pullup
2017-09-06 11:28:32 +00:00
# include "thermistor_1047.h"
2014-02-14 11:15:31 +00:00
# endif
2016-12-19 22:27:39 +00:00
# if ANY_THERMISTOR_IS(998) // User-defined table 1
2017-09-06 11:28:32 +00:00
# include "thermistor_998.h"
2015-02-22 14:02:04 +00:00
# endif
2016-12-19 22:27:39 +00:00
# if ANY_THERMISTOR_IS(999) // User-defined table 2
2017-09-06 11:28:32 +00:00
# include "thermistor_999.h"
2015-02-24 10:02:16 +00:00
# endif
2015-02-22 14:02:04 +00:00
2011-12-06 04:33:33 +00:00
# define _TT_NAME(_N) temptable_ ## _N
# define TT_NAME(_N) _TT_NAME(_N)
2011-11-04 21:51:14 +00:00
2019-05-06 23:51:06 +00:00
# if THERMISTOR_HEATER_0
# define HEATER_0_TEMPTABLE TT_NAME(THERMISTOR_HEATER_0)
2015-10-03 06:08:58 +00:00
# define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
2016-12-19 22:27:39 +00:00
# elif defined(HEATER_0_USES_THERMISTOR)
# error "No heater 0 thermistor table specified"
2011-12-06 04:33:33 +00:00
# else
2019-05-09 16:45:55 +00:00
# define HEATER_0_TEMPTABLE nullptr
2016-12-19 22:27:39 +00:00
# define HEATER_0_TEMPTABLE_LEN 0
# endif
2019-05-06 23:51:06 +00:00
# if THERMISTOR_HEATER_1
# define HEATER_1_TEMPTABLE TT_NAME(THERMISTOR_HEATER_1)
2016-12-19 22:27:39 +00:00
# define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE)
# elif defined(HEATER_1_USES_THERMISTOR)
# error "No heater 1 thermistor table specified"
# else
2019-05-09 16:45:55 +00:00
# define HEATER_1_TEMPTABLE nullptr
2016-12-19 22:27:39 +00:00
# define HEATER_1_TEMPTABLE_LEN 0
2012-12-09 22:00:06 +00:00
# endif
2019-05-06 23:51:06 +00:00
# if THERMISTOR_HEATER_2
# define HEATER_2_TEMPTABLE TT_NAME(THERMISTOR_HEATER_2)
2016-12-19 22:27:39 +00:00
# define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE)
# elif defined(HEATER_2_USES_THERMISTOR)
# error "No heater 2 thermistor table specified"
# else
2019-05-09 16:45:55 +00:00
# define HEATER_2_TEMPTABLE nullptr
2016-12-19 22:27:39 +00:00
# define HEATER_2_TEMPTABLE_LEN 0
# endif
2019-05-06 23:51:06 +00:00
# if THERMISTOR_HEATER_3
# define HEATER_3_TEMPTABLE TT_NAME(THERMISTOR_HEATER_3)
2016-12-19 22:27:39 +00:00
# define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE)
# elif defined(HEATER_3_USES_THERMISTOR)
# error "No heater 3 thermistor table specified"
# else
2019-05-09 16:45:55 +00:00
# define HEATER_3_TEMPTABLE nullptr
2016-12-19 22:27:39 +00:00
# define HEATER_3_TEMPTABLE_LEN 0
# endif
2019-05-06 23:51:06 +00:00
# if THERMISTOR_HEATER_4
# define HEATER_4_TEMPTABLE TT_NAME(THERMISTOR_HEATER_4)
2017-04-06 21:46:30 +00:00
# define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE)
# elif defined(HEATER_4_USES_THERMISTOR)
# error "No heater 4 thermistor table specified"
# else
2019-05-09 16:45:55 +00:00
# define HEATER_4_TEMPTABLE nullptr
2017-04-06 21:46:30 +00:00
# define HEATER_4_TEMPTABLE_LEN 0
# endif
2019-05-06 23:51:06 +00:00
# if THERMISTOR_HEATER_5
# define HEATER_5_TEMPTABLE TT_NAME(THERMISTOR_HEATER_5)
2019-03-07 07:00:44 +00:00
# define HEATER_5_TEMPTABLE_LEN COUNT(HEATER_5_TEMPTABLE)
# elif defined(HEATER_5_USES_THERMISTOR)
# error "No heater 5 thermistor table specified"
# else
2019-05-09 16:45:55 +00:00
# define HEATER_5_TEMPTABLE nullptr
2019-03-07 07:00:44 +00:00
# define HEATER_5_TEMPTABLE_LEN 0
# endif
2016-12-19 22:27:39 +00:00
# ifdef THERMISTORBED
# define BEDTEMPTABLE TT_NAME(THERMISTORBED)
# define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
2018-05-28 11:18:11 +00:00
# elif defined(HEATER_BED_USES_THERMISTOR)
# error "No bed thermistor table specified"
2016-12-19 22:27:39 +00:00
# else
2018-05-28 11:18:11 +00:00
# define BEDTEMPTABLE_LEN 0
2016-12-19 22:27:39 +00:00
# endif
2018-02-24 06:38:58 +00:00
# ifdef THERMISTORCHAMBER
# define CHAMBERTEMPTABLE TT_NAME(THERMISTORCHAMBER)
# define CHAMBERTEMPTABLE_LEN COUNT(CHAMBERTEMPTABLE)
2018-05-28 11:18:11 +00:00
# elif defined(HEATER_CHAMBER_USES_THERMISTOR)
# error "No chamber thermistor table specified"
2018-02-24 06:38:58 +00:00
# else
2018-05-28 11:18:11 +00:00
# define CHAMBERTEMPTABLE_LEN 0
2018-02-24 06:38:58 +00:00
# endif
2018-05-28 11:18:11 +00:00
// The SCAN_THERMISTOR_TABLE macro needs alteration?
2018-07-12 00:44:06 +00:00
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 ,
" Temperature conversion tables over 255 entries need special consideration. "
2018-05-28 11:18:11 +00:00
) ;
2016-12-19 22:27:39 +00: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
2012-12-09 22:00:06 +00:00
# ifndef HEATER_0_RAW_HI_TEMP
2016-12-19 22:27:39 +00:00
# ifdef HEATER_0_USES_THERMISTOR
2015-10-03 06:08:58 +00:00
# define HEATER_0_RAW_HI_TEMP 0
# define HEATER_0_RAW_LO_TEMP 16383
2016-12-19 22:27:39 +00:00
# else
2015-10-03 06:08:58 +00:00
# define HEATER_0_RAW_HI_TEMP 16383
# define HEATER_0_RAW_LO_TEMP 0
# endif
2011-11-05 18:21:36 +00:00
# endif
2012-12-09 22:00:06 +00:00
# ifndef HEATER_1_RAW_HI_TEMP
2016-12-19 22:27:39 +00:00
# ifdef HEATER_1_USES_THERMISTOR
2015-10-03 06:08:58 +00:00
# define HEATER_1_RAW_HI_TEMP 0
# define HEATER_1_RAW_LO_TEMP 16383
2016-12-19 22:27:39 +00:00
# else
2015-10-03 06:08:58 +00:00
# define HEATER_1_RAW_HI_TEMP 16383
# define HEATER_1_RAW_LO_TEMP 0
# endif
2011-11-04 21:51:14 +00:00
# endif
2012-12-09 22:00:06 +00:00
# ifndef HEATER_2_RAW_HI_TEMP
2016-12-19 22:27:39 +00:00
# ifdef HEATER_2_USES_THERMISTOR
2015-10-03 06:08:58 +00:00
# define HEATER_2_RAW_HI_TEMP 0
# define HEATER_2_RAW_LO_TEMP 16383
2016-12-19 22:27:39 +00:00
# else
2015-10-03 06:08:58 +00:00
# define HEATER_2_RAW_HI_TEMP 16383
# define HEATER_2_RAW_LO_TEMP 0
# endif
2011-12-06 04:33:33 +00:00
# endif
2015-01-23 22:13:06 +00:00
# ifndef HEATER_3_RAW_HI_TEMP
2016-12-19 22:27:39 +00:00
# ifdef HEATER_3_USES_THERMISTOR
2015-10-03 06:08:58 +00:00
# define HEATER_3_RAW_HI_TEMP 0
# define HEATER_3_RAW_LO_TEMP 16383
2016-12-19 22:27:39 +00:00
# else
2015-10-03 06:08:58 +00:00
# define HEATER_3_RAW_HI_TEMP 16383
# define HEATER_3_RAW_LO_TEMP 0
# endif
2015-01-23 22:13:06 +00:00
# endif
2017-04-14 22:14:14 +00:00
# ifndef HEATER_4_RAW_HI_TEMP
# ifdef HEATER_4_USES_THERMISTOR
# define HEATER_4_RAW_HI_TEMP 0
# define HEATER_4_RAW_LO_TEMP 16383
# else
# define HEATER_4_RAW_HI_TEMP 16383
# define HEATER_4_RAW_LO_TEMP 0
# endif
# endif
2019-03-07 08:09:39 +00:00
# ifndef HEATER_5_RAW_HI_TEMP
# ifdef HEATER_5_USES_THERMISTOR
# define HEATER_5_RAW_HI_TEMP 0
# define HEATER_5_RAW_LO_TEMP 16383
# else
# define HEATER_5_RAW_HI_TEMP 16383
# define HEATER_5_RAW_LO_TEMP 0
# endif
# endif
2012-12-09 22:00:06 +00:00
# ifndef HEATER_BED_RAW_HI_TEMP
2018-05-11 06:01:51 +00:00
# ifdef HEATER_BED_USES_THERMISTOR
2015-10-03 06:08:58 +00:00
# define HEATER_BED_RAW_HI_TEMP 0
# define HEATER_BED_RAW_LO_TEMP 16383
2016-12-19 22:27:39 +00:00
# else
2015-10-03 06:08:58 +00:00
# define HEATER_BED_RAW_HI_TEMP 16383
# define HEATER_BED_RAW_LO_TEMP 0
# endif
2012-12-09 22:00:06 +00:00
# endif
2018-02-24 06:38:58 +00:00
# ifndef HEATER_CHAMBER_RAW_HI_TEMP
2018-05-11 06:01:51 +00:00
# ifdef HEATER_CHAMBER_USES_THERMISTOR
2018-02-24 06:38:58 +00:00
# define HEATER_CHAMBER_RAW_HI_TEMP 0
# define HEATER_CHAMBER_RAW_LO_TEMP 16383
# else
# define HEATER_CHAMBER_RAW_HI_TEMP 16383
# define HEATER_CHAMBER_RAW_LO_TEMP 0
# endif
# endif