Skip to content

Commit c57a435

Browse files
committed
Use REPEAT, ignore sensor 1000
1 parent f24d316 commit c57a435

File tree

1 file changed

+8
-44
lines changed

1 file changed

+8
-44
lines changed

Marlin/src/module/temperature.cpp

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -317,52 +317,16 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
317317

318318
#if HAS_HOTEND
319319
hotend_info_t Temperature::temp_hotend[HOTENDS];
320-
#define _HMT(N) HEATER_##N##_MAXTEMP,
321320
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);
322-
#define CHECK_MAXTEMP__(SENSOR,TTABLE) static_assert(HEATER_ ##SENSOR## _MAXTEMP <= _MAX(temptable_ ##TTABLE [0].celsius,temptable_ ##TTABLE [(sizeof(temptable_ ##TTABLE) / sizeof(temptable_ ##TTABLE [0]))-1].celsius) - HOTEND_OVERSHOOT, "HEATER_" STRINGIFY(SENSOR) "_MAXTEMP must be less than the maximum temperature listed in the file thermistor_" STRINGIFY(TTABLE) ".h minus HOTEND_OVERSHOOT of " STRINGIFY(HOTEND_OVERSHOOT) ".")
323-
#define CHECK_MAXTEMP_(SENSOR,TTABLE) CHECK_MAXTEMP__( SENSOR, TTABLE )
324-
#define CHECK_MAXTEMP(HOTEND) CHECK_MAXTEMP_(HOTEND,TEMP_SENSOR_ ##HOTEND)
325321

326-
#if HOTENDS > 0
327-
#if TEMP_SENSOR_0 > 0
328-
CHECK_MAXTEMP(0);
329-
#endif
330-
#endif
331-
#if HOTENDS > 1
332-
#if TEMP_SENSOR_1 > 0
333-
CHECK_MAXTEMP(1);
334-
#endif
335-
#endif
336-
#if HOTENDS > 2
337-
#if TEMP_SENSOR_2 > 0
338-
CHECK_MAXTEMP(2);
339-
#endif
340-
#endif
341-
#if HOTENDS > 3
342-
#if TEMP_SENSOR_3 > 0
343-
CHECK_MAXTEMP(3);
344-
#endif
345-
#endif
346-
#if HOTENDS > 4
347-
#if TEMP_SENSOR_4 > 0
348-
CHECK_MAXTEMP(4);
349-
#endif
350-
#endif
351-
#if HOTENDS > 5
352-
#if TEMP_SENSOR_5 > 0
353-
CHECK_MAXTEMP(5);
354-
#endif
355-
#endif
356-
#if HOTENDS > 6
357-
#if TEMP_SENSOR_6 > 0
358-
CHECK_MAXTEMP(6);
359-
#endif
360-
#endif
361-
#if HOTENDS > 7
362-
#if TEMP_SENSOR_7 > 0
363-
CHECK_MAXTEMP(7);
364-
#endif
365-
#endif
322+
#define CHECK_MAXTEMP__(N,S) static_assert( \
323+
S == 1000 || HEATER_##N##_MAXTEMP <= _MAX(temptable_##S [0].celsius, temptable_##S [COUNT(temptable_##S) - 1].celsius) - HOTEND_OVERSHOOT, \
324+
"HEATER_" STRINGIFY(N) "_MAXTEMP (" STRINGIFY(HEATER_##N##_MAXTEMP) ") is too high for thermistor_" STRINGIFY(S) ".h with HOTEND_OVERSHOOT=" STRINGIFY(HOTEND_OVERSHOOT) ".");
325+
#define CHECK_MAXTEMP_(N,S) CHECK_MAXTEMP__(N, S)
326+
#define CHECK_MAXTEMP(N) CHECK_MAXTEMP_(N, TEMP_SENSOR_##N)
327+
328+
REPEAT(HOTENDS, CHECK_MAXTEMP);
329+
366330
#undef CHECK_MAXTEMP__
367331
#undef CHECK_MAXTEMP_
368332
#undef CHECK_MAXTEMP

0 commit comments

Comments
 (0)