Skip to content

Commit a306ab7

Browse files
ellenspbsdnomad
authored andcommitted
🐛 Fix Thermocouple flags, allow bed only (MarlinFirmware#27504)
1 parent 7ae7bde commit a306ab7

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

Marlin/src/inc/Conditionals-4-adv.h

+17-17
Original file line numberDiff line numberDiff line change
@@ -610,23 +610,6 @@
610610
#endif
611611
#endif
612612

613-
#if TEMP_SENSOR_IS_MAX_TC(0) || TEMP_SENSOR_IS_MAX_TC(1) || TEMP_SENSOR_IS_MAX_TC(2) || TEMP_SENSOR_IS_MAX_TC(BED) || TEMP_SENSOR_IS_MAX_TC(REDUNDANT)
614-
#define HAS_MAX_TC 1
615-
#endif
616-
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_2_IS_MAX6675 || TEMP_SENSOR_BED_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
617-
#define HAS_MAX6675 1
618-
#endif
619-
#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_2_IS_MAX31855 || TEMP_SENSOR_BED_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
620-
#define HAS_MAX31855 1
621-
#endif
622-
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_2_IS_MAX31865 || TEMP_SENSOR_BED_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
623-
#define HAS_MAX31865 1
624-
#endif
625-
626-
#if !HAS_MAX_TC
627-
#undef THERMOCOUPLE_MAX_ERRORS
628-
#endif
629-
630613
#if TEMP_SENSOR_3 == -4
631614
#define TEMP_SENSOR_3_IS_AD8495 1
632615
#elif TEMP_SENSOR_3 == -3
@@ -745,6 +728,23 @@
745728
#endif
746729
#endif
747730

731+
#if TEMP_SENSOR_IS_MAX_TC(0) || TEMP_SENSOR_IS_MAX_TC(1) || TEMP_SENSOR_IS_MAX_TC(2) || TEMP_SENSOR_IS_MAX_TC(BED) || TEMP_SENSOR_IS_MAX_TC(REDUNDANT)
732+
#define HAS_MAX_TC 1
733+
#endif
734+
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_2_IS_MAX6675 || TEMP_SENSOR_BED_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
735+
#define HAS_MAX6675 1
736+
#endif
737+
#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_2_IS_MAX31855 || TEMP_SENSOR_BED_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
738+
#define HAS_MAX31855 1
739+
#endif
740+
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_2_IS_MAX31865 || TEMP_SENSOR_BED_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
741+
#define HAS_MAX31865 1
742+
#endif
743+
744+
#if !HAS_MAX_TC
745+
#undef THERMOCOUPLE_MAX_ERRORS
746+
#endif
747+
748748
#if TEMP_SENSOR_CHAMBER == -4
749749
#define TEMP_SENSOR_CHAMBER_IS_AD8495 1
750750
#elif TEMP_SENSOR_CHAMBER == -3

Marlin/src/module/temperature.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -3466,13 +3466,14 @@ void Temperature::disable_all_heaters() {
34663466
#endif // SINGLENOZZLE_STANDBY_TEMP || SINGLENOZZLE_STANDBY_FAN
34673467

34683468
#if HAS_MAX_TC
3469-
34703469
typedef TERN(HAS_MAX31855, uint32_t, uint16_t) max_tc_temp_t;
34713470

34723471
#ifndef THERMOCOUPLE_MAX_ERRORS
34733472
#define THERMOCOUPLE_MAX_ERRORS 15
34743473
#endif
3474+
#endif
34753475

3476+
#if TEMP_SENSOR_IS_MAX_TC(0) || TEMP_SENSOR_IS_MAX_TC(1) || TEMP_SENSOR_IS_MAX_TC(2)
34763477
/**
34773478
* @brief Read MAX Thermocouple temperature.
34783479
*
@@ -3729,7 +3730,7 @@ void Temperature::disable_all_heaters() {
37293730
#endif
37303731

37313732
// Set thermocouple above max temperature (TMAX)
3732-
max_tc_temp = TEMP_SENSOR_BED_MAX_TC_TMAX << (BED_MAX_TC_DISCARD_BITS + 1);
3733+
max_tc_temp = max_tc_temp_t(TEMP_SENSOR_BED_MAX_TC_TMAX) << (BED_MAX_TC_DISCARD_BITS + 1);
37333734
}
37343735
}
37353736
else {

0 commit comments

Comments
 (0)