Skip to content

Commit 1748abd

Browse files
committed
πŸ§‘β€πŸ’» Fix preheat tests (nested macro limit ~256)
Followup to #25407
1 parent 7afd823 commit 1748abd

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

β€ŽMarlin/src/core/macros.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,9 @@
634634
#define DEFER4(M) M EMPTY EMPTY EMPTY EMPTY()()()()
635635

636636
// Force define expansion
637-
#define EVAL(V...) EVAL16(V)
637+
#define EVAL EVAL16
638+
#define EVAL4096(V...) EVAL2048(EVAL2048(V))
639+
#define EVAL2048(V...) EVAL1024(EVAL1024(V))
638640
#define EVAL1024(V...) EVAL512(EVAL512(V))
639641
#define EVAL512(V...) EVAL256(EVAL256(V))
640642
#define EVAL256(V...) EVAL128(EVAL128(V))

β€ŽMarlin/src/module/temperature.cpp

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
317317

318318
#if HAS_HOTEND
319319
hotend_info_t Temperature::temp_hotend[HOTENDS];
320-
const celsius_t Temperature::hotend_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
320+
constexpr celsius_t Temperature::hotend_maxtemp[HOTENDS];
321321

322322
// Sanity-check max readable temperatures
323323
#define CHECK_MAXTEMP_(N,M,S) static_assert( \
@@ -328,12 +328,41 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
328328

329329
#if HAS_PREHEAT
330330
#define CHECK_PREHEAT__(N,P,T,M) static_assert(T <= M - HOTEND_OVERSHOOT, "PREHEAT_" STRINGIFY(P) "_TEMP_HOTEND (" STRINGIFY(T) ") must be less than HEATER_" STRINGIFY(N) "_MAXTEMP (" STRINGIFY(M) ") - " STRINGIFY(HOTEND_OVERSHOOT) ".");
331-
#define CHECK_PREHEAT_(N,P) CHECK_PREHEAT__(N, P, PREHEAT_##P##_TEMP_HOTEND, HEATER_##N##_MAXTEMP);
332-
#define CHECK_PREHEAT(P) REPEAT2(HOTENDS, CHECK_PREHEAT_, P);
333-
RREPEAT_1(PREHEAT_COUNT, CHECK_PREHEAT)
334-
#endif
331+
#define CHECK_PREHEAT_(N,P) CHECK_PREHEAT__(N, P, PREHEAT_##P##_TEMP_HOTEND, HEATER_##N##_MAXTEMP)
332+
#define CHECK_PREHEAT(P) REPEAT2(HOTENDS, CHECK_PREHEAT_, P)
333+
#if PREHEAT_COUNT >= 1
334+
CHECK_PREHEAT(1)
335+
#endif
336+
#if PREHEAT_COUNT >= 2
337+
CHECK_PREHEAT(2)
338+
#endif
339+
#if PREHEAT_COUNT >= 3
340+
CHECK_PREHEAT(3)
341+
#endif
342+
#if PREHEAT_COUNT >= 4
343+
CHECK_PREHEAT(4)
344+
#endif
345+
#if PREHEAT_COUNT >= 5
346+
CHECK_PREHEAT(5)
347+
#endif
348+
#if PREHEAT_COUNT >= 6
349+
CHECK_PREHEAT(6)
350+
#endif
351+
#if PREHEAT_COUNT >= 7
352+
CHECK_PREHEAT(7)
353+
#endif
354+
#if PREHEAT_COUNT >= 8
355+
CHECK_PREHEAT(8)
356+
#endif
357+
#if PREHEAT_COUNT >= 9
358+
CHECK_PREHEAT(9)
359+
#endif
360+
#if PREHEAT_COUNT >= 10
361+
CHECK_PREHEAT(10)
362+
#endif
363+
#endif // HAS_PREHEAT
335364

336-
#endif
365+
#endif // HAS_HOTEND
337366

338367
#if HAS_TEMP_REDUNDANT
339368
redundant_info_t Temperature::temp_redundant;

β€ŽMarlin/src/module/temperature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ class Temperature {
580580

581581
#if HAS_HOTEND
582582
static hotend_info_t temp_hotend[HOTENDS];
583-
static const celsius_t hotend_maxtemp[HOTENDS];
583+
static constexpr celsius_t hotend_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
584584
static celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
585585
#endif
586586

0 commit comments

Comments
Β (0)