Add and apply REPEAT_1 macro
This commit is contained in:
parent
03184e1c31
commit
ad991734c4
@ -581,6 +581,7 @@
|
||||
// Repeat a macro passing S...N-1.
|
||||
#define REPEAT_S(S,N,OP) EVAL(_REPEAT(S,SUB##S(N),OP))
|
||||
#define REPEAT(N,OP) REPEAT_S(0,N,OP)
|
||||
#define REPEAT_1(N,OP) REPEAT_S(1,INCREMENT(N),OP)
|
||||
|
||||
// Repeat a macro passing 0...N-1 plus additional arguments.
|
||||
#define REPEAT2_S(S,N,OP,V...) EVAL(_REPEAT2(S,SUB##S(N),OP,V))
|
||||
|
@ -119,7 +119,7 @@ extern uint8_t marlin_debug_flags;
|
||||
#define __S_MULTI(N) decltype(SERIAL_LEAF_##N),
|
||||
#define _S_MULTI(N) __S_MULTI(N)
|
||||
|
||||
typedef MultiSerial< REPEAT_S(1, INCREMENT(NUM_SERIAL), _S_MULTI) 0> SerialOutputT;
|
||||
typedef MultiSerial< REPEAT_1(NUM_SERIAL, _S_MULTI) 0> SerialOutputT;
|
||||
|
||||
#undef __S_MULTI
|
||||
#undef _S_MULTI
|
||||
|
@ -207,7 +207,7 @@ class FilamentSensorBase {
|
||||
// Return a bitmask of runout pin states
|
||||
static inline uint8_t poll_runout_pins() {
|
||||
#define _OR_RUNOUT(N) | (READ(FIL_RUNOUT##N##_PIN) ? _BV((N) - 1) : 0)
|
||||
return (0 REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _OR_RUNOUT));
|
||||
return (0 REPEAT_1(NUM_RUNOUT_SENSORS, _OR_RUNOUT));
|
||||
#undef _OR_RUNOUT
|
||||
}
|
||||
|
||||
|
@ -243,9 +243,11 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
|
||||
#endif
|
||||
|
||||
#if STATUS_HOTEND_BITMAPS > 1
|
||||
static const unsigned char* const status_hotend_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, OFF_BMP(1), OFF_BMP(2), OFF_BMP(3), OFF_BMP(4), OFF_BMP(5), OFF_BMP(6));
|
||||
#define _OFF_BMP(N) OFF_BMP(N),
|
||||
#define _ON_BMP(N) ON_BMP(N),
|
||||
static const unsigned char* const status_hotend_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = { REPEAT_1(STATUS_HOTEND_BITMAPS, _OFF_BMP) };
|
||||
#if ANIM_HOTEND
|
||||
static const unsigned char* const status_hotend_on_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, ON_BMP(1), ON_BMP(2), ON_BMP(3), ON_BMP(4), ON_BMP(5), ON_BMP(6));
|
||||
static const unsigned char* const status_hotend_on_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = { REPEAT_1(STATUS_HOTEND_BITMAPS, _ON_BMP) };
|
||||
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr((S) ? &status_hotend_on_gfx[(N) % (STATUS_HOTEND_BITMAPS)] : &status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
||||
#else
|
||||
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr(&status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
||||
|
@ -114,8 +114,8 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||
PGM_P MarlinUI::get_preheat_label(const uint8_t m) {
|
||||
#define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL);
|
||||
#define _PLBL(N) preheat_##N##_label,
|
||||
REPEAT_S(1, INCREMENT(PREHEAT_COUNT), _PDEF);
|
||||
static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_S(1, INCREMENT(PREHEAT_COUNT), _PLBL) };
|
||||
REPEAT_1(PREHEAT_COUNT, _PDEF);
|
||||
static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_1(PREHEAT_COUNT, _PLBL) };
|
||||
return (PGM_P)pgm_read_ptr(&preheat_labels[m]);
|
||||
}
|
||||
#endif
|
||||
|
@ -475,7 +475,7 @@ void _O2 Endstops::report_states() {
|
||||
uint8_t state;
|
||||
switch (i) {
|
||||
default: continue;
|
||||
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_RUNOUT)
|
||||
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT)
|
||||
}
|
||||
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
|
||||
if (i > 1) SERIAL_CHAR(' ', '0' + i);
|
||||
|
Loading…
Reference in New Issue
Block a user