Skip to content

Commit fc2f3cd

Browse files
committed
🩹 MAX Thermocouple followup
Followup to MarlinFirmware#24898
1 parent 7feeffd commit fc2f3cd

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Marlin/src/inc/Conditionals_LCD.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,11 @@
10201020
#endif
10211021

10221022
// Helper macros for extruder and hotend arrays
1023-
#define EXTRUDER_LOOP() for (int8_t e = 0; e < EXTRUDERS; e++)
1024-
#define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
1023+
#define _EXTRUDER_LOOP(E) for (int8_t E = 0; E < EXTRUDERS; E++)
1024+
#define EXTRUDER_LOOP() _EXTRUDER_LOOP(e)
1025+
#define _HOTEND_LOOP(H) for (int8_t H = 0; H < HOTENDS; H++)
1026+
#define HOTEND_LOOP() _HOTEND_LOOP(e)
1027+
10251028
#define ARRAY_BY_EXTRUDERS(V...) ARRAY_N(EXTRUDERS, V)
10261029
#define ARRAY_BY_EXTRUDERS1(v1) ARRAY_N_1(EXTRUDERS, v1)
10271030
#define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)

Marlin/src/module/temperature.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,7 +2374,7 @@ void Temperature::updateTemperaturesFromRawValues() {
23742374
TERN_(HAS_POWER_MONITOR, power_monitor.capture_values());
23752375

23762376
#if HAS_HOTEND
2377-
static constexpr int8_t temp_dir[] = {
2377+
static constexpr int8_t temp_dir[HOTENDS] = {
23782378
#if TEMP_SENSOR_IS_ANY_MAX_TC(0)
23792379
0
23802380
#else
@@ -2386,19 +2386,21 @@ void Temperature::updateTemperaturesFromRawValues() {
23862386
#else
23872387
, TEMPDIR(1)
23882388
#endif
2389+
#endif
2390+
#if HOTENDS > 2
23892391
#if TEMP_SENSOR_IS_ANY_MAX_TC(2)
23902392
, 0
23912393
#else
23922394
, TEMPDIR(2)
23932395
#endif
2394-
#if HOTENDS > 3
2395-
#define _TEMPDIR(N) , TEMPDIR(N)
2396-
REPEAT_S(3, HOTENDS, _TEMPDIR)
2397-
#endif
2396+
#endif
2397+
#if HOTENDS > 3
2398+
#define _TEMPDIR(N) , TEMPDIR(N)
2399+
REPEAT_S(3, HOTENDS, _TEMPDIR)
23982400
#endif
23992401
};
24002402

2401-
LOOP_L_N(e, COUNT(temp_dir)) {
2403+
HOTEND_LOOP() {
24022404
const raw_adc_t r = temp_hotend[e].getraw();
24032405
const bool neg = temp_dir[e] < 0, pos = temp_dir[e] > 0;
24042406
if ((neg && r < temp_range[e].raw_max) || (pos && r > temp_range[e].raw_max))

0 commit comments

Comments
 (0)