fixed warning: ISO C does not permit named variadic macros

master
Josef Pavlik 8 years ago committed by Scott Lahteine
parent 0d3fc7dd89
commit c2b51af3ba

@ -306,13 +306,13 @@
/** /**
* ARRAY_BY_EXTRUDERS based on EXTRUDERS * 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) #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1)
/** /**
* ARRAY_BY_HOTENDS based on HOTENDS * 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) #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
/** /**

@ -80,15 +80,15 @@
#define COUNT(a) (sizeof(a)/sizeof(*a)) #define COUNT(a) (sizeof(a)/sizeof(*a))
// Macros for initializing arrays // Macros for initializing arrays
#define ARRAY_6(v1, v2, v3, v4, v5, v6, args...) { v1, v2, v3, v4, v5, v6 } #define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 }
#define ARRAY_5(v1, v2, v3, v4, v5, args...) { v1, v2, v3, v4, v5 } #define ARRAY_5(v1, v2, v3, v4, v5, ...) { v1, v2, v3, v4, v5 }
#define ARRAY_4(v1, v2, v3, v4, args...) { v1, v2, v3, v4 } #define ARRAY_4(v1, v2, v3, v4, ...) { v1, v2, v3, v4 }
#define ARRAY_3(v1, v2, v3, args...) { v1, v2, v3 } #define ARRAY_3(v1, v2, v3, ...) { v1, v2, v3 }
#define ARRAY_2(v1, v2, args...) { v1, v2 } #define ARRAY_2(v1, v2, ...) { v1, v2 }
#define ARRAY_1(v1, args...) { v1 } #define ARRAY_1(v1, ...) { v1 }
#define _ARRAY_N(N, args...) ARRAY_ ##N(args) #define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__)
#define ARRAY_N(N, args...) _ARRAY_N(N, args) #define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__)
// Macros for adding // Macros for adding
#define INC_0 1 #define INC_0 1

@ -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) * 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 (_menuLineNr == _thisItemNr) { \
if (lcdDrawUpdate) \ 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) { \ if (wasClicked && encoderLine == _thisItemNr) { \
lcd_quick_feedback() lcd_quick_feedback()
#define _MENU_ITEM_PART_2(TYPE, ARGS...) \ #define _MENU_ITEM_PART_2(TYPE, ...) \
menu_action_ ## TYPE(ARGS); \ menu_action_ ## TYPE(__VA_ARGS__); \
return; \ return; \
} \ } \
} \ } \
++_thisItemNr ++_thisItemNr
#define MENU_ITEM(TYPE, LABEL, ARGS...) do { \ #define MENU_ITEM(TYPE, LABEL, ...) do { \
_skipStatic = false; \ _skipStatic = false; \
_MENU_ITEM_PART_1(TYPE, LABEL, ## ARGS); \ _MENU_ITEM_PART_1(TYPE, LABEL, ## __VA_ARGS__); \
_MENU_ITEM_PART_2(TYPE, ## ARGS); \ _MENU_ITEM_PART_2(TYPE, ## __VA_ARGS__); \
} while(0) } while(0)
// Used to print static text with no visible cursor. // Used to print static text with no visible cursor.
#define STATIC_ITEM(LABEL, ARGS...) \ #define STATIC_ITEM(LABEL, ...) \
if (_menuLineNr == _thisItemNr) { \ if (_menuLineNr == _thisItemNr) { \
if (_skipStatic && encoderLine <= _thisItemNr) { \ if (_skipStatic && encoderLine <= _thisItemNr) { \
encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \ lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
} \ } \
if (lcdDrawUpdate) \ if (lcdDrawUpdate) \
lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## ARGS); \ lcd_implementation_drawmenu_static(_lcdLineNr, PSTR(LABEL), ## __VA_ARGS__); \
} \ } \
++_thisItemNr ++_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 * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
*/ */
#define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ #define MENU_MULTIPLIER_ITEM(type, label, ...) do { \
_MENU_ITEM_PART_1(type, label, ## args); \ _MENU_ITEM_PART_1(type, label, ## __VA_ARGS__); \
encoderRateMultiplierEnabled = true; \ encoderRateMultiplierEnabled = true; \
lastEncoderMovementMillis = 0; \ lastEncoderMovementMillis = 0; \
_MENU_ITEM_PART_2(type, ## args); \ _MENU_ITEM_PART_2(type, ## __VA_ARGS__); \
} while(0) } while(0)
#endif //ENCODER_RATE_MULTIPLIER #endif //ENCODER_RATE_MULTIPLIER
#define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0) #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(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
#if ENABLED(ENCODER_RATE_MULTIPLIER) #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(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_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_CALLBACK(type, label, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
#else //!ENCODER_RATE_MULTIPLIER #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(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_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_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
#endif //!ENCODER_RATE_MULTIPLIER #endif //!ENCODER_RATE_MULTIPLIER
/** Used variables to keep track of the menu */ /** Used variables to keep track of the menu */

Loading…
Cancel
Save