Skip to content

Commit

Permalink
misc. cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 6, 2023
1 parent a0799ab commit 9308443
Show file tree
Hide file tree
Showing 10 changed files with 327 additions and 333 deletions.
4 changes: 1 addition & 3 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@
#define THERMAL_PROTECTION_BOARD // Halt the printer if the board sensor leaves the temp range below.
#define BOARD_MINTEMP 8 // (°C)
#define BOARD_MAXTEMP 70 // (°C)
#if !defined(TEMP_BOARD_PIN) && TEMP_SENSOR_BOARD != -100
//#define TEMP_BOARD_PIN -1 // Board temp sensor pin, if not set in pins file.
#endif
//#define TEMP_BOARD_PIN -1 // Board temp sensor pin override.
#endif

/**
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware."
#endif

#if TEMP_SENSOR_BOARD_IS_INTERNAL && TEMP_BOARD_PIN != ATEMP
#error "TEMP_SENSOR_BOARD=-100 requires 'TEMP_BOARD_PIN ATEMP' on STM32."
#if TEMP_SENSOR_BOARD_IS_INTERNAL && defined(ATEMP) && TEMP_BOARD_PIN != ATEMP
#error "TEMP_SENSOR_BOARD -100 requires 'TEMP_BOARD_PIN ATEMP' on STM32."
#endif

/**
Expand Down
558 changes: 280 additions & 278 deletions Marlin/src/HAL/STM32/internal_temp.h

Large diffs are not rendered by default.

50 changes: 12 additions & 38 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@
#define _SENSOR_IS(I,N) || (TEMP_SENSOR(N) == I)
#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I)
#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) )
#define ANY_EXT_THERMISTOR_IS(N) ( ANY_E_SENSOR_IS(N) _SENSOR_IS(N,REDUNDANT) \
_SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) _SENSOR_IS(N,COOLER) )
#define ANY_THERMISTOR_IS(N) ( ANY_EXT_THERMISTOR_IS(N) _SENSOR_IS(N,BOARD) )

#if ANY_THERMISTOR_IS(1000)
#define HAS_USER_THERMISTORS 1
Expand Down Expand Up @@ -320,8 +320,6 @@
#define TEMP_SENSOR_0_IS_AD8495 1
#elif TEMP_SENSOR_0 == -1
#define TEMP_SENSOR_0_IS_AD595 1
#elif TEMP_SENSOR_0 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_0."
#elif TEMP_SENSOR_0 == 1000
#define TEMP_SENSOR_0_IS_CUSTOM 1
#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
Expand Down Expand Up @@ -367,8 +365,6 @@
#define TEMP_SENSOR_1_IS_AD8495 1
#elif TEMP_SENSOR_1 == -1
#define TEMP_SENSOR_1_IS_AD595 1
#elif TEMP_SENSOR_1 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_1."
#elif TEMP_SENSOR_1 == 1000
#define TEMP_SENSOR_1_IS_CUSTOM 1
#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
Expand Down Expand Up @@ -414,8 +410,6 @@
#define TEMP_SENSOR_2_IS_AD8495 1
#elif TEMP_SENSOR_2 == -1
#define TEMP_SENSOR_2_IS_AD595 1
#elif TEMP_SENSOR_2 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_2."
#elif TEMP_SENSOR_2 == 1000
#define TEMP_SENSOR_2_IS_CUSTOM 1
#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
Expand Down Expand Up @@ -543,8 +537,6 @@
#define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
#elif TEMP_SENSOR_REDUNDANT == -1
#define TEMP_SENSOR_REDUNDANT_IS_AD595 1
#elif TEMP_SENSOR_REDUNDANT == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_REDUNDANT."
#elif TEMP_SENSOR_REDUNDANT > 0
#define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
#if TEMP_SENSOR_REDUNDANT == 1000
Expand All @@ -567,9 +559,7 @@
#define HAS_MAX31865 1
#endif

#if TEMP_SENSOR_3 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -4
#if TEMP_SENSOR_3 == -4
#define TEMP_SENSOR_3_IS_AD8495 1
#elif TEMP_SENSOR_3 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
Expand All @@ -589,9 +579,7 @@
#undef HEATER_3_MAXTEMP
#endif

#if TEMP_SENSOR_4 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -4
#if TEMP_SENSOR_4 == -4
#define TEMP_SENSOR_4_IS_AD8495 1
#elif TEMP_SENSOR_4 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
Expand All @@ -611,9 +599,7 @@
#undef HEATER_4_MAXTEMP
#endif

#if TEMP_SENSOR_5 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -4
#if TEMP_SENSOR_5 == -4
#define TEMP_SENSOR_5_IS_AD8495 1
#elif TEMP_SENSOR_5 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
Expand All @@ -633,9 +619,7 @@
#undef HEATER_5_MAXTEMP
#endif

#if TEMP_SENSOR_6 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -4
#if TEMP_SENSOR_6 == -4
#define TEMP_SENSOR_6_IS_AD8495 1
#elif TEMP_SENSOR_6 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
Expand All @@ -655,9 +639,7 @@
#undef HEATER_6_MAXTEMP
#endif

#if TEMP_SENSOR_7 == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -4
#if TEMP_SENSOR_7 == -4
#define TEMP_SENSOR_7_IS_AD8495 1
#elif TEMP_SENSOR_7 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
Expand All @@ -677,9 +659,7 @@
#undef HEATER_7_MAXTEMP
#endif

#if TEMP_SENSOR_BED == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -4
#if TEMP_SENSOR_BED == -4
#define TEMP_SENSOR_BED_IS_AD8495 1
#elif TEMP_SENSOR_BED == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
Expand All @@ -701,9 +681,7 @@
#undef BED_MAXTEMP
#endif

#if TEMP_SENSOR_CHAMBER == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -4
#if TEMP_SENSOR_CHAMBER == -4
#define TEMP_SENSOR_CHAMBER_IS_AD8495 1
#elif TEMP_SENSOR_CHAMBER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
Expand All @@ -724,9 +702,7 @@
#undef CHAMBER_MAXTEMP
#endif

#if TEMP_SENSOR_COOLER == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_COOLER."
#elif TEMP_SENSOR_COOLER == -4
#if TEMP_SENSOR_COOLER == -4
#define TEMP_SENSOR_COOLER_IS_AD8495 1
#elif TEMP_SENSOR_COOLER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
Expand All @@ -747,9 +723,7 @@
#undef COOLER_MAXTEMP
#endif

#if TEMP_SENSOR_PROBE == -100
#error "Board Internal Temperature Sensor (-100) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -4
#if TEMP_SENSOR_PROBE == -4
#define TEMP_SENSOR_PROBE_IS_AD8495 1
#elif TEMP_SENSOR_PROBE == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
Expand Down
7 changes: 6 additions & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,11 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#undef _ISMAX_1
#undef _ISSNS_1

// Internal Temperature Sensor
#if ANY_EXT_THERMISTOR_IS(-100)
#error "Board Internal Temperature Sensor (-100) is only supported for TEMP_SENSOR_BOARD."
#endif

/**
* Hephestos 2 Heated Bed Kit requirements
*/
Expand Down Expand Up @@ -2728,7 +2733,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
#elif ENABLED(THERMAL_PROTECTION_BOARD) && (!defined(BOARD_MINTEMP) || !defined(BOARD_MAXTEMP))
#error "THERMAL_PROTECTION_BOARD requires BOARD_MINTEMP and BOARD_MAXTEMP."
#elif TEMP_SENSOR_BOARD_IS_INTERNAL && !defined(TEMP_INTERNAL_SENSOR)
#error "TEMP_SENSOR_BOARD=-100 requires TEMP_INTERNAL_SENSOR(RAW) to be defined. It may not be implemented for your specific board."
#error "TEMP_SENSOR_BOARD -100 requires TEMP_INTERNAL_SENSOR(RAW) to be defined. It may not be implemented for your specific board."
#endif
#elif CONTROLLER_FAN_MIN_BOARD_TEMP
#error "CONTROLLER_FAN_MIN_BOARD_TEMP requires TEMP_SENSOR_BOARD."
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@
#define TEMP_0_PIN P0_24
#define TEMP_1_PIN P0_23
#define TEMP_BED_PIN P0_25
#define TEMP_BOARD_PIN P1_30 // Onboard thermistor, NTC100K
#ifndef TEMP_BOARD_PIN
#define TEMP_BOARD_PIN P1_30 // Onboard thermistor, NTC100K
#endif

//
// Heaters / Fans
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/pins/rambo/pins_EINSY_RAMBO.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@
//
#define TEMP_0_PIN 0 // Analog Input, Header J2
#define TEMP_1_PIN 1 // Analog Input, Header J3
#define TEMP_BOARD_PIN 91 // Onboard thermistor, 100k TDK NTCG104LH104JT1
#define TEMP_BED_PIN 2 // Analog Input, Header J6
#define TEMP_PROBE_PIN 3 // Analog Input, Header J15

#ifndef TEMP_BOARD_PIN
#define TEMP_BOARD_PIN 91 // Onboard thermistor, 100k TDK NTCG104LH104JT1
#endif

//
// Heaters / Fans
//
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/pins/sam/pins_DUE3DOM_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@
#define TEMP_0_PIN 0 // Analog Input (HOTEND0 thermistor)
#define TEMP_1_PIN 2 // Analog Input (unused)
#define TEMP_BED_PIN 1 // Analog Input (BED thermistor)
#define TEMP_BOARD_PIN 5 // Analog Input (OnBoard thermistor beta 3950)

#ifndef TEMP_BOARD_PIN
#define TEMP_BOARD_PIN 5 // Analog Input (OnBoard thermistor beta 3950)
#endif

// SPI for MAX Thermocouple
#if DISABLED(SDSUPPORT)
Expand Down
18 changes: 11 additions & 7 deletions Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,22 @@
#define E0_SLAVE_ADDRESS 0
#endif
#endif

//
// Temperature Sensors
//
#define TEMP_BED_PIN PC2 //TB
#define TEMP_0_PIN PC1 //TH1
//#define TEMP_1_PIN PC3 //TH2
#define TEMP_BOARD_PIN PC3
#ifndef TEMP_SENSOR_BOARD
#define TEMP_SENSOR_BOARD 13
#endif
#define TEMP_BED_PIN PC2 // TB
#define TEMP_0_PIN PC1 // TH1
//#define TEMP_1_PIN PC3 // TH2
#define FIL_RUNOUT_PIN PA10 // MT_DET

#ifndef TEMP_BOARD_PIN
#define TEMP_BOARD_PIN PC3
#endif
#if defined(TEMP_SENSOR_BOARD) && TEMP_SENSOR_BOARD != 13
#warning "The built-in TEMP_SENSOR_BOARD is 13 for ERYONE Ery32 mini."
#endif

//
// LCD Pins
//
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,13 @@
//
#define TEMP_0_PIN PA2 // T0 <-> E0
#define TEMP_1_PIN PA0 // T1 <-> E1
#define TEMP_BOARD_PIN PC2 // Onboard thermistor, NTC100K
#define TEMP_BED_PIN PA1 // T2 <-> Bed
#define TEMP_PROBE_PIN PC3 // Shares J4 connector with PD1

#ifndef TEMP_BOARD_PIN
#define TEMP_BOARD_PIN PC2 // Onboard thermistor, NTC100K
#endif

//
// Heaters / Fans
//
Expand Down

0 comments on commit 9308443

Please sign in to comment.