Skip to content

Commit 968f04d

Browse files
ellenspthinkyhead
authored andcommitted
🩹 Fix 2 thermocouples (MarlinFirmware#24982)
Followup to MarlinFirmware#24898
1 parent 30a885a commit 968f04d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Marlin/src/module/temperature.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,8 +3076,13 @@ void Temperature::disable_all_heaters() {
30763076
// Needed to return the correct temp when this is called between readings
30773077
static raw_adc_t max_tc_temp_previous[MAX_TC_COUNT] = { 0 };
30783078
#define THERMO_TEMP(I) max_tc_temp_previous[I]
3079-
#define THERMO_SEL(A,B,C) (hindex > 1 ? (C) : hindex == 1 ? (B) : (A))
3080-
#define MAXTC_CS_WRITE(V) do{ switch (hindex) { case 1: WRITE(TEMP_1_CS_PIN, V); break; case 2: WRITE(TEMP_2_CS_PIN, V); break; default: WRITE(TEMP_0_CS_PIN, V); } }while(0)
3079+
#if MAX_TC_COUNT > 2
3080+
#define THERMO_SEL(A,B,C) (hindex > 1 ? (C) : hindex == 1 ? (B) : (A))
3081+
#define MAXTC_CS_WRITE(V) do{ switch (hindex) { case 1: WRITE(TEMP_1_CS_PIN, V); break; case 2: WRITE(TEMP_2_CS_PIN, V); break; default: WRITE(TEMP_0_CS_PIN, V); } }while(0)
3082+
#elif MAX_TC_COUNT > 1
3083+
#define THERMO_SEL(A,B,C) ( hindex == 1 ? (B) : (A))
3084+
#define MAXTC_CS_WRITE(V) do{ switch (hindex) { case 1: WRITE(TEMP_1_CS_PIN, V); break; default: WRITE(TEMP_0_CS_PIN, V); } }while(0)
3085+
#endif
30813086
#else
30823087
// When we have only 1 max tc, THERMO_SEL will pick the appropriate sensor
30833088
// variable, and MAXTC_*() macros will be hardcoded to the correct CS pin.

0 commit comments

Comments
 (0)