More flexible redundant temp sensor (#22085)

This commit is contained in:
Katelyn Schiesser
2021-06-11 13:51:29 -07:00
committed by Scott Lahteine
parent 5d80f7006a
commit d322e495b2
65 changed files with 573 additions and 254 deletions

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
const temp_entry_t temptable_1[] PROGMEM = {
constexpr temp_entry_t temptable_1[] PROGMEM = {
{ OV( 23), 300 },
{ OV( 25), 295 },
{ OV( 27), 290 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, RS thermistor 198-961
const temp_entry_t temptable_10[] PROGMEM = {
constexpr temp_entry_t temptable_10[] PROGMEM = {
{ OV( 1), 929 },
{ OV( 36), 299 },
{ OV( 71), 246 },

View File

@ -24,7 +24,7 @@
#define REVERSE_TEMP_SENSOR_RANGE_1010 1
// Pt1000 with 1k0 pullup
const temp_entry_t temptable_1010[] PROGMEM = {
constexpr temp_entry_t temptable_1010[] PROGMEM = {
PtLine( 0, 1000, 1000),
PtLine( 25, 1000, 1000),
PtLine( 50, 1000, 1000),

View File

@ -24,7 +24,7 @@
#define REVERSE_TEMP_SENSOR_RANGE_1047 1
// Pt1000 with 4k7 pullup
const temp_entry_t temptable_1047[] PROGMEM = {
constexpr temp_entry_t temptable_1047[] PROGMEM = {
// only a few values are needed as the curve is very flat
PtLine( 0, 1000, 4700),
PtLine( 50, 1000, 4700),

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, QU-BD silicone bed QWG-104F-3950 thermistor
const temp_entry_t temptable_11[] PROGMEM = {
constexpr temp_entry_t temptable_11[] PROGMEM = {
{ OV( 1), 938 },
{ OV( 31), 314 },
{ OV( 41), 290 },

View File

@ -24,7 +24,7 @@
#define REVERSE_TEMP_SENSOR_RANGE_110 1
// Pt100 with 1k0 pullup
const temp_entry_t temptable_110[] PROGMEM = {
constexpr temp_entry_t temptable_110[] PROGMEM = {
// only a few values are needed as the curve is very flat
PtLine( 0, 100, 1000),
PtLine( 50, 100, 1000),

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 4700 K, 4.7 kOhm pull-up, (personal calibration for Makibox hot bed)
const temp_entry_t temptable_12[] PROGMEM = {
constexpr temp_entry_t temptable_12[] PROGMEM = {
{ OV( 35), 180 }, // top rating 180C
{ OV( 211), 140 },
{ OV( 233), 135 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, Hisens thermistor
const temp_entry_t temptable_13[] PROGMEM = {
constexpr temp_entry_t temptable_13[] PROGMEM = {
{ OV( 20.04), 300 },
{ OV( 23.19), 290 },
{ OV( 26.71), 280 },

View File

@ -24,7 +24,7 @@
#define REVERSE_TEMP_SENSOR_RANGE_147 1
// Pt100 with 4k7 pullup
const temp_entry_t temptable_147[] PROGMEM = {
constexpr temp_entry_t temptable_147[] PROGMEM = {
// only a few values are needed as the curve is very flat
PtLine( 0, 100, 4700),
PtLine( 50, 100, 4700),

View File

@ -22,7 +22,7 @@
#pragma once
// 100k bed thermistor in JGAurora A5. Calibrated by Sam Pinches 21st Jan 2018 using cheap k-type thermocouple inserted into heater block, using TM-902C meter.
const temp_entry_t temptable_15[] PROGMEM = {
constexpr temp_entry_t temptable_15[] PROGMEM = {
{ OV( 31), 275 },
{ OV( 33), 270 },
{ OV( 35), 260 },

View File

@ -22,7 +22,7 @@
#pragma once
// Dagoma NTC 100k white thermistor
const temp_entry_t temptable_17[] PROGMEM = {
constexpr temp_entry_t temptable_17[] PROGMEM = {
{ OV( 16), 309 },
{ OV( 18), 307 },
{ OV( 20), 300 },

View File

@ -22,7 +22,7 @@
#pragma once
// ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 - version (measured/tested/approved)
const temp_entry_t temptable_18[] PROGMEM = {
constexpr temp_entry_t temptable_18[] PROGMEM = {
{ OV( 1), 713 },
{ OV( 17), 284 },
{ OV( 20), 275 },

View File

@ -26,7 +26,7 @@
// Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
// Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
//
const temp_entry_t temptable_2[] PROGMEM = {
constexpr temp_entry_t temptable_2[] PROGMEM = {
{ OV( 1), 848 },
{ OV( 30), 300 }, // top rating 300C
{ OV( 34), 290 },

View File

@ -24,7 +24,7 @@
#define REVERSE_TEMP_SENSOR_RANGE_20 1
// Pt100 with INA826 amp on Ultimaker v2.0 electronics
const temp_entry_t temptable_20[] PROGMEM = {
constexpr temp_entry_t temptable_20[] PROGMEM = {
{ OV( 0), 0 },
{ OV(227), 1 },
{ OV(236), 10 },

View File

@ -24,7 +24,7 @@
#define REVERSE_TEMP_SENSOR_RANGE_201 1
// Pt100 with LMV324 amp on Overlord v1.1 electronics
const temp_entry_t temptable_201[] PROGMEM = {
constexpr temp_entry_t temptable_201[] PROGMEM = {
{ OV( 0), 0 },
{ OV( 8), 1 },
{ OV( 23), 6 },

View File

@ -3,7 +3,7 @@
// Temptable sent from dealer technologyoutlet.co.uk
//
const temp_entry_t temptable_202[] PROGMEM = {
constexpr temp_entry_t temptable_202[] PROGMEM = {
{ OV( 1), 864 },
{ OV( 35), 300 },
{ OV( 38), 295 },

View File

@ -28,7 +28,7 @@
// Pt100 with INA826 amplifier board with 5v supply based on Thermistor 20, with 3v3 ADC reference on the mainboard.
// If the ADC reference and INA826 board supply voltage are identical, Thermistor 20 instead.
const temp_entry_t temptable_21[] PROGMEM = {
constexpr temp_entry_t temptable_21[] PROGMEM = {
{ OV( 0), 0 },
{ OV(227), 1 },
{ OV(236), 10 },

View File

@ -21,7 +21,7 @@
*/
// 100k hotend thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
const temp_entry_t temptable_22[] PROGMEM = {
constexpr temp_entry_t temptable_22[] PROGMEM = {
{ OV( 1), 352 },
{ OV( 6), 341 },
{ OV( 11), 330 },

View File

@ -21,7 +21,7 @@
*/
// 100k hotbed thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
const temp_entry_t temptable_23[] PROGMEM = {
constexpr temp_entry_t temptable_23[] PROGMEM = {
{ OV( 1), 938 },
{ OV( 11), 423 },
{ OV( 21), 351 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 4120 K, 4.7 kOhm pull-up, mendel-parts
const temp_entry_t temptable_3[] PROGMEM = {
constexpr temp_entry_t temptable_3[] PROGMEM = {
{ OV( 1), 864 },
{ OV( 21), 300 },
{ OV( 25), 290 },

View File

@ -28,7 +28,7 @@
// B Value Tolerance + / - 1%
// Kis3d Silicone Heater 24V 200W/300W with 6mm Precision cast plate (EN AW 5083)
// Temperature setting time 10 min to determine the 12Bit ADC value on the surface. (le3tspeak)
const temp_entry_t temptable_30[] PROGMEM = {
constexpr temp_entry_t temptable_30[] PROGMEM = {
{ OV( 1), 938 },
{ OV( 298), 125 }, // 1193 - 125°
{ OV( 321), 121 }, // 1285 - 121°

View File

@ -24,7 +24,7 @@
#define OVM(V) OV((V)*(0.327/0.5))
// R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
const temp_entry_t temptable_331[] PROGMEM = {
constexpr temp_entry_t temptable_331[] PROGMEM = {
{ OVM( 23), 300 },
{ OVM( 25), 295 },
{ OVM( 27), 290 },

View File

@ -24,7 +24,7 @@
#define OVM(V) OV((V)*(0.327/0.327))
// R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
const temp_entry_t temptable_332[] PROGMEM = {
constexpr temp_entry_t temptable_332[] PROGMEM = {
{ OVM( 268), 150 },
{ OVM( 293), 145 },
{ OVM( 320), 141 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 10 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, Generic 10k thermistor
const temp_entry_t temptable_4[] PROGMEM = {
constexpr temp_entry_t temptable_4[] PROGMEM = {
{ OV( 1), 430 },
{ OV( 54), 137 },
{ OV( 107), 107 },

View File

@ -26,7 +26,7 @@
// ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan)
// Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
// Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
const temp_entry_t temptable_5[] PROGMEM = {
constexpr temp_entry_t temptable_5[] PROGMEM = {
{ OV( 1), 713 },
{ OV( 17), 300 }, // top rating 300C
{ OV( 20), 290 },

View File

@ -22,7 +22,7 @@
#pragma once
// 100k Zonestar thermistor. Adjusted By Hally
const temp_entry_t temptable_501[] PROGMEM = {
constexpr temp_entry_t temptable_501[] PROGMEM = {
{ OV( 1), 713 },
{ OV( 14), 300 }, // Top rating 300C
{ OV( 16), 290 },

View File

@ -23,7 +23,7 @@
// Unknown thermistor for the Zonestar P802M hot bed. Adjusted By Nerseth
// These were the shipped settings from Zonestar in original firmware: P802M_8_Repetier_V1.6_Zonestar.zip
const temp_entry_t temptable_502[] PROGMEM = {
constexpr temp_entry_t temptable_502[] PROGMEM = {
{ OV( 56.0 / 4), 300 },
{ OV( 187.0 / 4), 250 },
{ OV( 615.0 / 4), 190 },

View File

@ -23,7 +23,7 @@
// Zonestar (Z8XM2) Heated Bed thermistor. Added By AvanOsch
// These are taken from the Zonestar settings in original Repetier firmware: Z8XM2_ZRIB_LCD12864_V51.zip
const temp_entry_t temptable_503[] PROGMEM = {
constexpr temp_entry_t temptable_503[] PROGMEM = {
{ OV( 12), 300 },
{ OV( 27), 270 },
{ OV( 47), 250 },

View File

@ -26,7 +26,7 @@
// Verified by linagee.
// Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
// Advantage: Twice the resolution and better linearity from 150C to 200C
const temp_entry_t temptable_51[] PROGMEM = {
constexpr temp_entry_t temptable_51[] PROGMEM = {
{ OV( 1), 350 },
{ OV( 190), 250 }, // top rating 250C
{ OV( 203), 245 },

View File

@ -22,7 +22,7 @@
// 100k thermistor supplied with RPW-Ultra hotend, 4.7k pullup
const temp_entry_t temptable_512[] PROGMEM = {
constexpr temp_entry_t temptable_512[] PROGMEM = {
{ OV(26), 300 },
{ OV(28), 295 },
{ OV(30), 290 },

View File

@ -26,7 +26,7 @@
// Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
// Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
// Advantage: More resolution and better linearity from 150C to 200C
const temp_entry_t temptable_52[] PROGMEM = {
constexpr temp_entry_t temptable_52[] PROGMEM = {
{ OV( 1), 500 },
{ OV( 125), 300 }, // top rating 300C
{ OV( 142), 290 },

View File

@ -26,7 +26,7 @@
// Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
// Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
// Advantage: More resolution and better linearity from 150C to 200C
const temp_entry_t temptable_55[] PROGMEM = {
constexpr temp_entry_t temptable_55[] PROGMEM = {
{ OV( 1), 500 },
{ OV( 76), 300 },
{ OV( 87), 290 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 4092 K, 8.2 kOhm pull-up, 100k Epcos (?) thermistor
const temp_entry_t temptable_6[] PROGMEM = {
constexpr temp_entry_t temptable_6[] PROGMEM = {
{ OV( 1), 350 },
{ OV( 28), 250 }, // top rating 250C
{ OV( 31), 245 },

View File

@ -31,7 +31,7 @@
// beta: 3950
// min adc: 1 at 0.0048828125 V
// max adc: 1023 at 4.9951171875 V
const temp_entry_t temptable_60[] PROGMEM = {
constexpr temp_entry_t temptable_60[] PROGMEM = {
{ OV( 51), 272 },
{ OV( 61), 258 },
{ OV( 71), 247 },

View File

@ -30,7 +30,7 @@
// Resistance Tolerance + / -1%
// B Value 3950K at 25/50 deg. C
// B Value Tolerance + / - 1%
const temp_entry_t temptable_61[] PROGMEM = {
constexpr temp_entry_t temptable_61[] PROGMEM = {
{ OV( 2.00), 420 }, // Guestimate to ensure we dont lose a reading and drop temps to -50 when over
{ OV( 12.07), 350 },
{ OV( 12.79), 345 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign 500 °C Thermistor
const temp_entry_t temptable_66[] PROGMEM = {
constexpr temp_entry_t temptable_66[] PROGMEM = {
{ OV( 17.5), 850 },
{ OV( 17.9), 500 },
{ OV( 21.7), 480 },

View File

@ -33,7 +33,7 @@
* B: 0.00031362
* C: -2.03978e-07
*/
const temp_entry_t temptable_666[] PROGMEM = {
constexpr temp_entry_t temptable_666[] PROGMEM = {
{ OV( 1), 794 },
{ OV( 18), 288 },
{ OV( 35), 234 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 500 KOhm, beta25 = 3800 K, 4.7 kOhm pull-up, SliceEngineering 450 °C Thermistor
const temp_entry_t temptable_67[] PROGMEM = {
constexpr temp_entry_t temptable_67[] PROGMEM = {
{ OV( 22 ), 500 },
{ OV( 23 ), 490 },
{ OV( 25 ), 480 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 3974 K, 4.7 kOhm pull-up, Honeywell 135-104LAG-J01
const temp_entry_t temptable_7[] PROGMEM = {
constexpr temp_entry_t temptable_7[] PROGMEM = {
{ OV( 1), 941 },
{ OV( 19), 362 },
{ OV( 37), 299 }, // top rating 300C

View File

@ -26,7 +26,7 @@
// ANENG AN8009 DMM with a K-type probe used for measurements.
// R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, bqh2 stock thermistor
const temp_entry_t temptable_70[] PROGMEM = {
constexpr temp_entry_t temptable_70[] PROGMEM = {
{ OV( 18), 270 },
{ OV( 27), 248 },
{ OV( 34), 234 },

View File

@ -27,7 +27,7 @@
// Beta = 3974
// R1 = 0 Ohm
// R2 = 4700 Ohm
const temp_entry_t temptable_71[] PROGMEM = {
constexpr temp_entry_t temptable_71[] PROGMEM = {
{ OV( 35), 300 },
{ OV( 51), 269 },
{ OV( 59), 258 },

View File

@ -34,7 +34,7 @@
//#define HIGH_TEMP_RANGE_75
const temp_entry_t temptable_75[] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
constexpr temp_entry_t temptable_75[] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
{ OV(111.06), 200 }, // v=0.542 r=571.747 res=0.501 degC/count
#ifdef HIGH_TEMP_RANGE_75

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 3950 K, 10 kOhm pull-up, NTCS0603E3104FHT
const temp_entry_t temptable_8[] PROGMEM = {
constexpr temp_entry_t temptable_8[] PROGMEM = {
{ OV( 1), 704 },
{ OV( 54), 216 },
{ OV( 107), 175 },

View File

@ -22,7 +22,7 @@
#pragma once
// R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, GE Sensing AL03006-58.2K-97-G1
const temp_entry_t temptable_9[] PROGMEM = {
constexpr temp_entry_t temptable_9[] PROGMEM = {
{ OV( 1), 936 },
{ OV( 36), 300 },
{ OV( 71), 246 },

View File

@ -24,7 +24,7 @@
// 100k bed thermistor with a 10K pull-up resistor - made by $ buildroot/share/scripts/createTemperatureLookupMarlin.py --rp=10000
const temp_entry_t temptable_99[] PROGMEM = {
constexpr temp_entry_t temptable_99[] PROGMEM = {
{ OV( 5.81), 350 }, // v=0.028 r= 57.081 res=13.433 degC/count
{ OV( 6.54), 340 }, // v=0.032 r= 64.248 res=11.711 degC/count
{ OV( 7.38), 330 }, // v=0.036 r= 72.588 res=10.161 degC/count

View File

@ -27,7 +27,7 @@
#define DUMMY_THERMISTOR_998_VALUE 25
#endif
const temp_entry_t temptable_998[] PROGMEM = {
constexpr temp_entry_t temptable_998[] PROGMEM = {
{ OV( 1), DUMMY_THERMISTOR_998_VALUE },
{ OV(1023), DUMMY_THERMISTOR_998_VALUE }
};

View File

@ -27,7 +27,7 @@
#define DUMMY_THERMISTOR_999_VALUE 25
#endif
const temp_entry_t temptable_999[] PROGMEM = {
constexpr temp_entry_t temptable_999[] PROGMEM = {
{ OV( 1), DUMMY_THERMISTOR_999_VALUE },
{ OV(1023), DUMMY_THERMISTOR_999_VALUE }
};

View File

@ -42,7 +42,16 @@
#define OV_SCALE(N) (N)
#define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE))
#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)
#define TEMP_SENSOR_IS(n,H) (n == TEMP_SENSOR_##H)
#define ANY_THERMISTOR_IS(n) ( TEMP_SENSOR_IS(n, 0) || TEMP_SENSOR_IS(n, 1) \
|| TEMP_SENSOR_IS(n, 2) || TEMP_SENSOR_IS(n, 3) \
|| TEMP_SENSOR_IS(n, 4) || TEMP_SENSOR_IS(n, 5) \
|| TEMP_SENSOR_IS(n, 6) || TEMP_SENSOR_IS(n, 7) \
|| TEMP_SENSOR_IS(n, BED) \
|| TEMP_SENSOR_IS(n, CHAMBER) \
|| TEMP_SENSOR_IS(n, COOLER) \
|| TEMP_SENSOR_IS(n, PROBE) \
|| TEMP_SENSOR_IS(n, REDUNDANT) )
typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
@ -198,146 +207,128 @@ typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
#include "thermistor_999.h"
#endif
#if ANY_THERMISTOR_IS(1000) // Custom
const temp_entry_t temptable_1000[] PROGMEM = { { 0, 0 } };
constexpr temp_entry_t temptable_1000[] PROGMEM = { { 0, 0 } };
#endif
#define _TT_NAME(_N) temptable_ ## _N
#define TT_NAME(_N) _TT_NAME(_N)
#if TEMP_SENSOR_0_THERMISTOR_ID
#define TEMPTABLE_0 TT_NAME(TEMP_SENSOR_0_THERMISTOR_ID)
#if TEMP_SENSOR_0 > 0
#define TEMPTABLE_0 TT_NAME(TEMP_SENSOR_0)
#define TEMPTABLE_0_LEN COUNT(TEMPTABLE_0)
#elif TEMP_SENSOR_0_IS_THERMISTOR
#error "No heater 0 thermistor table specified"
#else
#define TEMPTABLE_0 nullptr
#define TEMPTABLE_0_LEN 0
#endif
#if TEMP_SENSOR_1_THERMISTOR_ID
#define TEMPTABLE_1 TT_NAME(TEMP_SENSOR_1_THERMISTOR_ID)
#if TEMP_SENSOR_1 > 0
#define TEMPTABLE_1 TT_NAME(TEMP_SENSOR_1)
#define TEMPTABLE_1_LEN COUNT(TEMPTABLE_1)
#elif TEMP_SENSOR_1_IS_THERMISTOR
#error "No heater 1 thermistor table specified"
#else
#define TEMPTABLE_1 nullptr
#define TEMPTABLE_1_LEN 0
#endif
#if TEMP_SENSOR_2_THERMISTOR_ID
#define TEMPTABLE_2 TT_NAME(TEMP_SENSOR_2_THERMISTOR_ID)
#if TEMP_SENSOR_2 > 0
#define TEMPTABLE_2 TT_NAME(TEMP_SENSOR_2)
#define TEMPTABLE_2_LEN COUNT(TEMPTABLE_2)
#elif TEMP_SENSOR_2_IS_THERMISTOR
#error "No heater 2 thermistor table specified"
#else
#define TEMPTABLE_2 nullptr
#define TEMPTABLE_2_LEN 0
#endif
#if TEMP_SENSOR_3_THERMISTOR_ID
#define TEMPTABLE_3 TT_NAME(TEMP_SENSOR_3_THERMISTOR_ID)
#if TEMP_SENSOR_3 > 0
#define TEMPTABLE_3 TT_NAME(TEMP_SENSOR_3)
#define TEMPTABLE_3_LEN COUNT(TEMPTABLE_3)
#elif TEMP_SENSOR_3_IS_THERMISTOR
#error "No heater 3 thermistor table specified"
#else
#define TEMPTABLE_3 nullptr
#define TEMPTABLE_3_LEN 0
#endif
#if TEMP_SENSOR_4_THERMISTOR_ID
#define TEMPTABLE_4 TT_NAME(TEMP_SENSOR_4_THERMISTOR_ID)
#if TEMP_SENSOR_4 > 0
#define TEMPTABLE_4 TT_NAME(TEMP_SENSOR_4)
#define TEMPTABLE_4_LEN COUNT(TEMPTABLE_4)
#elif TEMP_SENSOR_4_IS_THERMISTOR
#error "No heater 4 thermistor table specified"
#else
#define TEMPTABLE_4 nullptr
#define TEMPTABLE_4_LEN 0
#endif
#if TEMP_SENSOR_5_THERMISTOR_ID
#define TEMPTABLE_5 TT_NAME(TEMP_SENSOR_5_THERMISTOR_ID)
#if TEMP_SENSOR_5 > 0
#define TEMPTABLE_5 TT_NAME(TEMP_SENSOR_5)
#define TEMPTABLE_5_LEN COUNT(TEMPTABLE_5)
#elif TEMP_SENSOR_5_IS_THERMISTOR
#error "No heater 5 thermistor table specified"
#else
#define TEMPTABLE_5 nullptr
#define TEMPTABLE_5_LEN 0
#endif
#if TEMP_SENSOR_6_THERMISTOR_ID
#define TEMPTABLE_6 TT_NAME(TEMP_SENSOR_6_THERMISTOR_ID)
#if TEMP_SENSOR_6 > 0
#define TEMPTABLE_6 TT_NAME(TEMP_SENSOR_6)
#define TEMPTABLE_6_LEN COUNT(TEMPTABLE_6)
#elif TEMP_SENSOR_6_IS_THERMISTOR
#error "No heater 6 thermistor table specified"
#else
#define TEMPTABLE_6 nullptr
#define TEMPTABLE_6_LEN 0
#endif
#if TEMP_SENSOR_7_THERMISTOR_ID
#define TEMPTABLE_7 TT_NAME(TEMP_SENSOR_7_THERMISTOR_ID)
#if TEMP_SENSOR_7 > 0
#define TEMPTABLE_7 TT_NAME(TEMP_SENSOR_7)
#define TEMPTABLE_7_LEN COUNT(TEMPTABLE_7)
#elif TEMP_SENSOR_7_IS_THERMISTOR
#error "No heater 7 thermistor table specified"
#else
#define TEMPTABLE_7 nullptr
#define TEMPTABLE_7_LEN 0
#endif
#ifdef TEMP_SENSOR_BED_THERMISTOR_ID
#define TEMPTABLE_BED TT_NAME(TEMP_SENSOR_BED_THERMISTOR_ID)
#if TEMP_SENSOR_BED > 0
#define TEMPTABLE_BED TT_NAME(TEMP_SENSOR_BED)
#define TEMPTABLE_BED_LEN COUNT(TEMPTABLE_BED)
#elif TEMP_SENSOR_BED_IS_THERMISTOR
#error "No bed thermistor table specified"
#else
#define TEMPTABLE_BED_LEN 0
#endif
#ifdef TEMP_SENSOR_CHAMBER_THERMISTOR_ID
#define TEMPTABLE_CHAMBER TT_NAME(TEMP_SENSOR_CHAMBER_THERMISTOR_ID)
#if TEMP_SENSOR_CHAMBER > 0
#define TEMPTABLE_CHAMBER TT_NAME(TEMP_SENSOR_CHAMBER)
#define TEMPTABLE_CHAMBER_LEN COUNT(TEMPTABLE_CHAMBER)
#elif TEMP_SENSOR_CHAMBER_IS_THERMISTOR
#error "No chamber thermistor table specified"
#else
#define TEMPTABLE_CHAMBER_LEN 0
#endif
#ifdef TEMP_SENSOR_COOLER_THERMISTOR_ID
#define TEMPTABLE_COOLER TT_NAME(TEMP_SENSOR_COOLER_THERMISTOR_ID)
#if TEMP_SENSOR_COOLER > 0
#define TEMPTABLE_COOLER TT_NAME(TEMP_SENSOR_COOLER)
#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
#ifdef TEMP_SENSOR_PROBE_THERMISTOR_ID
#define TEMPTABLE_PROBE TT_NAME(TEMP_SENSOR_PROBE_THERMISTOR_ID)
#if TEMP_SENSOR_PROBE > 0
#define TEMPTABLE_PROBE TT_NAME(TEMP_SENSOR_PROBE)
#define TEMPTABLE_PROBE_LEN COUNT(TEMPTABLE_PROBE)
#elif TEMP_SENSOR_PROBE_IS_THERMISTOR
#error "No probe thermistor table specified"
#else
#define TEMPTABLE_PROBE_LEN 0
#endif
#if TEMP_SENSOR_REDUNDANT > 0
#define TEMPTABLE_REDUNDANT TT_NAME(TEMP_SENSOR_REDUNDANT)
#define TEMPTABLE_REDUNDANT_LEN COUNT(TEMPTABLE_REDUNDANT)
#else
#define TEMPTABLE_REDUNDANT_LEN 0
#endif
// The SCAN_THERMISTOR_TABLE macro needs alteration?
static_assert(
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
&& TEMPTABLE_COOLER_LEN < 256 && TEMPTABLE_PROBE_LEN < 256,
"Temperature conversion tables over 255 entries need special consideration."
static_assert(255 > TEMPTABLE_0_LEN || 255 > TEMPTABLE_1_LEN || 255 > TEMPTABLE_2_LEN || 255 > TEMPTABLE_3_LEN
|| 255 > TEMPTABLE_4_LEN || 255 > TEMPTABLE_5_LEN || 255 > TEMPTABLE_6_LEN || 255 > TEMPTABLE_7_LEN
|| 255 > TEMPTABLE_BED_LEN
|| 255 > TEMPTABLE_CHAMBER_LEN
|| 255 > TEMPTABLE_COOLER_LEN
|| 255 > TEMPTABLE_PROBE_LEN
|| 255 > TEMPTABLE_REDUNDANT_LEN
, "Temperature conversion tables over 255 entries need special consideration."
);
// 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
#define __TT_REV(N) REVERSE_TEMP_SENSOR_RANGE_##N
#define _TT_REV(N) __TT_REV(N)
#define TT_REV(N) _TT_REV(TEMP_SENSOR_##N##_THERMISTOR_ID)
#define _TT_REV(N) REVERSE_TEMP_SENSOR_RANGE_##N
#define TT_REV(N) TERN0(TEMP_SENSOR_##N##_IS_THERMISTOR, DEFER4(_TT_REV)(TEMP_SENSOR_##N))
#define _TT_REVRAW(N) !TEMP_SENSOR_##N##_IS_THERMISTOR
#define TT_REVRAW(N) (TT_REV(N) || _TT_REVRAW(N))
@ -522,6 +513,15 @@ static_assert(
#define TEMP_SENSOR_PROBE_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
#endif
#endif
#ifndef TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP
#if TT_REVRAW(REDUNDANT)
#define TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define TEMP_SENSOR_REDUNDANT_RAW_LO_TEMP 0
#else
#define TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP 0
#define TEMP_SENSOR_REDUNDANT_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
#endif
#endif
#undef __TT_REV
#undef _TT_REV