diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 12db8005a..4e5848e5e 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -306,13 +306,13 @@ /** * ARRAY_BY_EXTRUDERS based on EXTRUDERS */ - #define ARRAY_BY_EXTRUDERS(args...) ARRAY_N(EXTRUDERS, args) + #define ARRAY_BY_EXTRUDERS(...) ARRAY_N(EXTRUDERS, __VA_ARGS__) #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1) /** * ARRAY_BY_HOTENDS based on HOTENDS */ - #define ARRAY_BY_HOTENDS(args...) ARRAY_N(HOTENDS, args) + #define ARRAY_BY_HOTENDS(...) ARRAY_N(HOTENDS, __VA_ARGS__) #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1) /** diff --git a/Marlin/macros.h b/Marlin/macros.h index 56b5c8bba..470596bac 100644 --- a/Marlin/macros.h +++ b/Marlin/macros.h @@ -80,15 +80,15 @@ #define COUNT(a) (sizeof(a)/sizeof(*a)) // Macros for initializing arrays -#define ARRAY_6(v1, v2, v3, v4, v5, v6, args...) { v1, v2, v3, v4, v5, v6 } -#define ARRAY_5(v1, v2, v3, v4, v5, args...) { v1, v2, v3, v4, v5 } -#define ARRAY_4(v1, v2, v3, v4, args...) { v1, v2, v3, v4 } -#define ARRAY_3(v1, v2, v3, args...) { v1, v2, v3 } -#define ARRAY_2(v1, v2, args...) { v1, v2 } -#define ARRAY_1(v1, args...) { v1 } +#define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 } +#define ARRAY_5(v1, v2, v3, v4, v5, ...) { v1, v2, v3, v4, v5 } +#define ARRAY_4(v1, v2, v3, v4, ...) { v1, v2, v3, v4 } +#define ARRAY_3(v1, v2, v3, ...) { v1, v2, v3 } +#define ARRAY_2(v1, v2, ...) { v1, v2 } +#define ARRAY_1(v1, ...) { v1 } -#define _ARRAY_N(N, args...) ARRAY_ ##N(args) -#define ARRAY_N(N, args...) _ARRAY_N(N, args) +#define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__) +#define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__) // Macros for adding #define INC_0 1 diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index ece18bbfe..88dbd60d5 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -281,35 +281,35 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedrate_percentage, 10, 999) * */ - #define _MENU_ITEM_PART_1(TYPE, LABEL, ARGS...) \ + #define _MENU_ITEM_PART_1(TYPE, LABEL, ...) \ if (_menuLineNr == _thisItemNr) { \ if (lcdDrawUpdate) \ - lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PSTR(LABEL), ## ARGS); \ + lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PSTR(LABEL), ## __VA_ARGS__); \ if (wasClicked && encoderLine == _thisItemNr) { \ lcd_quick_feedback() - #define _MENU_ITEM_PART_2(TYPE, ARGS...) \ - menu_action_ ## TYPE(ARGS); \ + #define _MENU_ITEM_PART_2(TYPE, ...) \ + menu_action_ ## TYPE(__VA_ARGS__); \ return; \ } \ } \ ++_thisItemNr - #define MENU_ITEM(TYPE, LABEL, ARGS...) do { \ + #define MENU_ITEM(TYPE, LABEL, ...) do { \ _skipStatic = false; \ - _MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \ - _MENU_ITEM_PART_2(TYPE, ## ARGS); \ + _MENU_ITEM_PART_1(TYPE, LABEL, ## __VA_ARGS__); \ + _MENU_ITEM_PART_2(TYPE, ## __VA_ARGS__); \ } while(0) // Used to print static text with no visible cursor. - #define STATIC_ITEM(LABEL, ARGS...) \ + #define STATIC_ITEM(LABEL, ...) \ if (_menuLineNr == _thisItemNr) { \ if (_skipStatic && encoderLine <= _thisItemNr) { \ encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \ } \ if (lcdDrawUpdate) \ - lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## ARGS); \ + lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## __VA_ARGS__); \ } \ ++_thisItemNr @@ -329,24 +329,24 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to /** * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item */ - #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ - _MENU_ITEM_PART_1(type, label, ## args); \ + #define MENU_MULTIPLIER_ITEM(type, label, ...) do { \ + _MENU_ITEM_PART_1(type, label, ## __VA_ARGS__); \ encoderRateMultiplierEnabled = true; \ lastEncoderMovementMillis = 0; \ - _MENU_ITEM_PART_2(type, ## args); \ + _MENU_ITEM_PART_2(type, ## __VA_ARGS__); \ } while(0) #endif //ENCODER_RATE_MULTIPLIER #define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0) - #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) - #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) + #define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__) + #define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__) #if ENABLED(ENCODER_RATE_MULTIPLIER) - #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__) #else //!ENCODER_RATE_MULTIPLIER - #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__) #endif //!ENCODER_RATE_MULTIPLIER /** Used variables to keep track of the menu */