Skip to content

Commit

Permalink
🔧 Thermistor (66) sanity-check (MarlinFirmware#24803)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisiskeithb authored and thinkyhead committed Dec 16, 2022
1 parent a58f277 commit f17a07d
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
* 30 : 100kΩ Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K - beta 3950
* 60 : 100kΩ Maker's Tool Works Kapton Bed Thermistor - beta 3950
* 61 : 100kΩ Formbot/Vivedino 350°C Thermistor - beta 3950
* 66 : 4.7MΩ Dyze Design High Temperature Thermistor
* 66 : 4.7MΩ Dyze Design / Trianglelab T-D500 500°C High Temperature Thermistor
* 67 : 500kΩ SliceEngineering 450°C Thermistor
* 68 : PT100 amplifier board from Dyze Design
* 70 : 100kΩ bq Hephestos 2
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@
#define MAPLIST(OP,V...) EVAL(_MAPLIST(OP,V))

// Temperature Sensor Config
#define _HAS_E_TEMP(N) || (TEMP_SENSOR_##N != 0)
#define TEMP_SENSOR(N) TEMP_SENSOR_##N
#define _HAS_E_TEMP(N) || TEMP_SENSOR(N)
#define HAS_E_TEMP_SENSOR (0 REPEAT(EXTRUDERS, _HAS_E_TEMP))
#define TEMP_SENSOR_IS_MAX_TC(T) (TEMP_SENSOR_##T == -5 || TEMP_SENSOR_##T == -3 || TEMP_SENSOR_##T == -2)
#define TEMP_SENSOR_IS_MAX_TC(T) (TEMP_SENSOR(T) == -5 || TEMP_SENSOR(T) == -3 || TEMP_SENSOR(T) == -2)
5 changes: 3 additions & 2 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@
#define HID_E6 6
#define HID_E7 7

#define _SENSOR_IS(I,N) || (TEMP_SENSOR_##N == I)
#define _SENSOR_IS(I,N) || (TEMP_SENSOR(N) == I)
#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I)
#define ANY_THERMISTOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N) \
#define ANY_E_SENSOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N))
#define ANY_THERMISTOR_IS(N) ( ANY_E_SENSOR_IS(N) \
_SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \
_SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) )

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2656,7 +2656,7 @@
//
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
//
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && !TEMP_SENSOR_IS_MAX_TC(P) && !TEMP_SENSOR_##P##_IS_DUMMY)
#define HAS_ADC_TEST(P) (TEMP_SENSOR(P) && PIN_EXISTS(TEMP_##P) && !TEMP_SENSOR_IS_MAX_TC(P) && !TEMP_SENSOR_##P##_IS_DUMMY)
#if HOTENDS > 0 && HAS_ADC_TEST(0)
#define HAS_TEMP_ADC_0 1
#endif
Expand Down
31 changes: 31 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2272,6 +2272,37 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TEMP_SENSOR_REDUNDANT 1000 requires REDUNDANT_PULLUP_RESISTOR_OHMS, REDUNDANT_RESISTANCE_25C_OHMS and REDUNDANT_BETA in Configuration_adv.h."
#endif

/**
* Required thermistor 66 (Dyze Design / Trianglelab T-D500) settings
* https://docs.dyzedesign.com/hotends.html#_500-%C2%B0c-thermistor
*/
#if ANY_E_SENSOR_IS(66)
#define _BAD_MINTEMP(N) (TEMP_SENSOR(N) == 66 && HEATER_##N##_MINTEMP <= 20)
#if _BAD_MINTEMP(0)
#error "Thermistor 66 requires HEATER_0_MINTEMP > 20."
#elif _BAD_MINTEMP(1)
#error "Thermistor 66 requires HEATER_1_MINTEMP > 20."
#elif _BAD_MINTEMP(2)
#error "Thermistor 66 requires HEATER_2_MINTEMP > 20."
#elif _BAD_MINTEMP(3)
#error "Thermistor 66 requires HEATER_3_MINTEMP > 20."
#elif _BAD_MINTEMP(4)
#error "Thermistor 66 requires HEATER_4_MINTEMP > 20."
#elif _BAD_MINTEMP(5)
#error "Thermistor 66 requires HEATER_5_MINTEMP > 20."
#elif _BAD_MINTEMP(6)
#error "Thermistor 66 requires HEATER_6_MINTEMP > 20."
#elif _BAD_MINTEMP(7)
#error "Thermistor 66 requires HEATER_7_MINTEMP > 20."
#endif
#if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED < 5
#error "Thermistor 66 requires MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED ≥ 5."
#elif MILLISECONDS_PREHEAT_TIME < 30000
#error "Thermistor 66 requires MILLISECONDS_PREHEAT_TIME ≥ 30000."
#endif
#undef _BAD_MINTEMP
#endif

/**
* Required MAX31865 settings
*/
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/thermistornames.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
#elif THERMISTOR_ID == 61
#define THERMISTOR_NAME "Formbot 350°C"
#elif THERMISTOR_ID == 66
#define THERMISTOR_NAME "Dyze 4.7M"
#define THERMISTOR_NAME "Dyze / TL 4.7M"
#elif THERMISTOR_ID == 67
#define THERMISTOR_NAME "SliceEng 450°C"

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2649,7 +2649,7 @@ void Temperature::init() {
temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \
}while(0)

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

#if _MINMAX_TEST(0, MIN)
_TEMP_MIN_E(0);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/thermistor/thermistor_66.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
#pragma once

// R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign 500 °C Thermistor
// R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign / Trianglelab T-D500 500 °C Thermistor
constexpr temp_entry_t temptable_66[] PROGMEM = {
{ OV( 17.5), 850 },
{ OV( 17.9), 500 },
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/thermistor/thermistors.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ static_assert(255 > TEMPTABLE_0_LEN || 255 > TEMPTABLE_1_LEN || 255 > TEMPTABLE_
// For thermocouples the highest temperature results in the highest ADC value

#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_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))

Expand Down

0 comments on commit f17a07d

Please sign in to comment.