Browse Source

Allow #defined TYPE arg to ultralcd menu macros (#12041)

Previously, it was not possible for the TYPE argument to ultralcd menu macros to itself be a #defined value. This made it difficult to create variables to set many related menu items to a common precision that could be easily changed.
pull/1/head
Marcio Teixeira 6 years ago
committed by Scott Lahteine
parent
commit
d6d48e63fb
  1. 14
      Marlin/src/lcd/ultralcd.cpp

14
Marlin/src/lcd/ultralcd.cpp

@ -376,14 +376,14 @@ millis_t next_lcd_update_ms;
#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, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) #define MENU_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(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__) #define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(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, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(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__) #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
#else // !ENCODER_RATE_MULTIPLIER #else // !ENCODER_RATE_MULTIPLIER
#define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__) #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(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__) #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
#endif // !ENCODER_RATE_MULTIPLIER #endif // !ENCODER_RATE_MULTIPLIER
#define SCREEN_OR_MENU_LOOP() \ #define SCREEN_OR_MENU_LOOP() \
@ -986,7 +986,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
END_MENU(); END_MENU();
} }
#endif #endif
#if ENABLED(MENU_ITEM_CASE_LIGHT) #if ENABLED(MENU_ITEM_CASE_LIGHT)
#include "../feature/caselight.h" #include "../feature/caselight.h"

Loading…
Cancel
Save