Skip to content

Commit f17a07d

Browse files
thisiskeithbthinkyhead
authored andcommitted
🔧 Thermistor (66) sanity-check (MarlinFirmware#24803)
1 parent a58f277 commit f17a07d

File tree

9 files changed

+43
-10
lines changed

9 files changed

+43
-10
lines changed

Marlin/Configuration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@
496496
* 30 : 100kΩ Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K - beta 3950
497497
* 60 : 100kΩ Maker's Tool Works Kapton Bed Thermistor - beta 3950
498498
* 61 : 100kΩ Formbot/Vivedino 350°C Thermistor - beta 3950
499-
* 66 : 4.7MΩ Dyze Design High Temperature Thermistor
499+
* 66 : 4.7MΩ Dyze Design / Trianglelab T-D500 500°C High Temperature Thermistor
500500
* 67 : 500kΩ SliceEngineering 450°C Thermistor
501501
* 68 : PT100 amplifier board from Dyze Design
502502
* 70 : 100kΩ bq Hephestos 2

Marlin/src/core/macros.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@
738738
#define MAPLIST(OP,V...) EVAL(_MAPLIST(OP,V))
739739

740740
// Temperature Sensor Config
741-
#define _HAS_E_TEMP(N) || (TEMP_SENSOR_##N != 0)
741+
#define TEMP_SENSOR(N) TEMP_SENSOR_##N
742+
#define _HAS_E_TEMP(N) || TEMP_SENSOR(N)
742743
#define HAS_E_TEMP_SENSOR (0 REPEAT(EXTRUDERS, _HAS_E_TEMP))
743-
#define TEMP_SENSOR_IS_MAX_TC(T) (TEMP_SENSOR_##T == -5 || TEMP_SENSOR_##T == -3 || TEMP_SENSOR_##T == -2)
744+
#define TEMP_SENSOR_IS_MAX_TC(T) (TEMP_SENSOR(T) == -5 || TEMP_SENSOR(T) == -3 || TEMP_SENSOR(T) == -2)

Marlin/src/inc/Conditionals_adv.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@
161161
#define HID_E6 6
162162
#define HID_E7 7
163163

164-
#define _SENSOR_IS(I,N) || (TEMP_SENSOR_##N == I)
164+
#define _SENSOR_IS(I,N) || (TEMP_SENSOR(N) == I)
165165
#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I)
166-
#define ANY_THERMISTOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N) \
166+
#define ANY_E_SENSOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N))
167+
#define ANY_THERMISTOR_IS(N) ( ANY_E_SENSOR_IS(N) \
167168
_SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \
168169
_SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) )
169170

Marlin/src/inc/Conditionals_post.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,7 @@
26562656
//
26572657
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
26582658
//
2659-
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && !TEMP_SENSOR_IS_MAX_TC(P) && !TEMP_SENSOR_##P##_IS_DUMMY)
2659+
#define HAS_ADC_TEST(P) (TEMP_SENSOR(P) && PIN_EXISTS(TEMP_##P) && !TEMP_SENSOR_IS_MAX_TC(P) && !TEMP_SENSOR_##P##_IS_DUMMY)
26602660
#if HOTENDS > 0 && HAS_ADC_TEST(0)
26612661
#define HAS_TEMP_ADC_0 1
26622662
#endif

Marlin/src/inc/SanityCheck.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,37 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
22722272
#error "TEMP_SENSOR_REDUNDANT 1000 requires REDUNDANT_PULLUP_RESISTOR_OHMS, REDUNDANT_RESISTANCE_25C_OHMS and REDUNDANT_BETA in Configuration_adv.h."
22732273
#endif
22742274

2275+
/**
2276+
* Required thermistor 66 (Dyze Design / Trianglelab T-D500) settings
2277+
* https://docs.dyzedesign.com/hotends.html#_500-%C2%B0c-thermistor
2278+
*/
2279+
#if ANY_E_SENSOR_IS(66)
2280+
#define _BAD_MINTEMP(N) (TEMP_SENSOR(N) == 66 && HEATER_##N##_MINTEMP <= 20)
2281+
#if _BAD_MINTEMP(0)
2282+
#error "Thermistor 66 requires HEATER_0_MINTEMP > 20."
2283+
#elif _BAD_MINTEMP(1)
2284+
#error "Thermistor 66 requires HEATER_1_MINTEMP > 20."
2285+
#elif _BAD_MINTEMP(2)
2286+
#error "Thermistor 66 requires HEATER_2_MINTEMP > 20."
2287+
#elif _BAD_MINTEMP(3)
2288+
#error "Thermistor 66 requires HEATER_3_MINTEMP > 20."
2289+
#elif _BAD_MINTEMP(4)
2290+
#error "Thermistor 66 requires HEATER_4_MINTEMP > 20."
2291+
#elif _BAD_MINTEMP(5)
2292+
#error "Thermistor 66 requires HEATER_5_MINTEMP > 20."
2293+
#elif _BAD_MINTEMP(6)
2294+
#error "Thermistor 66 requires HEATER_6_MINTEMP > 20."
2295+
#elif _BAD_MINTEMP(7)
2296+
#error "Thermistor 66 requires HEATER_7_MINTEMP > 20."
2297+
#endif
2298+
#if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED < 5
2299+
#error "Thermistor 66 requires MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED ≥ 5."
2300+
#elif MILLISECONDS_PREHEAT_TIME < 30000
2301+
#error "Thermistor 66 requires MILLISECONDS_PREHEAT_TIME ≥ 30000."
2302+
#endif
2303+
#undef _BAD_MINTEMP
2304+
#endif
2305+
22752306
/**
22762307
* Required MAX31865 settings
22772308
*/

Marlin/src/lcd/thermistornames.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
#elif THERMISTOR_ID == 61
142142
#define THERMISTOR_NAME "Formbot 350°C"
143143
#elif THERMISTOR_ID == 66
144-
#define THERMISTOR_NAME "Dyze 4.7M"
144+
#define THERMISTOR_NAME "Dyze / TL 4.7M"
145145
#elif THERMISTOR_ID == 67
146146
#define THERMISTOR_NAME "SliceEng 450°C"
147147

Marlin/src/module/temperature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2649,7 +2649,7 @@ void Temperature::init() {
26492649
temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \
26502650
}while(0)
26512651

2652-
#define _MINMAX_TEST(N,M) (HOTENDS > N && TEMP_SENSOR_##N > 0 && TEMP_SENSOR_##N != 998 && TEMP_SENSOR_##N != 999 && defined(HEATER_##N##_##M##TEMP))
2652+
#define _MINMAX_TEST(N,M) (HOTENDS > N && TEMP_SENSOR(N) > 0 && TEMP_SENSOR(N) != 998 && TEMP_SENSOR(N) != 999 && defined(HEATER_##N##_##M##TEMP))
26532653

26542654
#if _MINMAX_TEST(0, MIN)
26552655
_TEMP_MIN_E(0);

Marlin/src/module/thermistor/thermistor_66.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
#pragma once
2323

24-
// R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign 500 °C Thermistor
24+
// R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign / Trianglelab T-D500 500 °C Thermistor
2525
constexpr temp_entry_t temptable_66[] PROGMEM = {
2626
{ OV( 17.5), 850 },
2727
{ OV( 17.9), 500 },

Marlin/src/module/thermistor/thermistors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static_assert(255 > TEMPTABLE_0_LEN || 255 > TEMPTABLE_1_LEN || 255 > TEMPTABLE_
338338
// For thermocouples the highest temperature results in the highest ADC value
339339

340340
#define _TT_REV(N) REVERSE_TEMP_SENSOR_RANGE_##N
341-
#define TT_REV(N) TERN0(TEMP_SENSOR_##N##_IS_THERMISTOR, DEFER4(_TT_REV)(TEMP_SENSOR_##N))
341+
#define TT_REV(N) TERN0(TEMP_SENSOR_##N##_IS_THERMISTOR, DEFER4(_TT_REV)(TEMP_SENSOR(N)))
342342
#define _TT_REVRAW(N) !TEMP_SENSOR_##N##_IS_THERMISTOR
343343
#define TT_REVRAW(N) (TT_REV(N) || _TT_REVRAW(N))
344344

0 commit comments

Comments
 (0)