瀏覽代碼

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.
Marcio Teixeira 6 年之前
父節點
當前提交
d6d48e63fb
共有 1 個檔案被更改,包括 7 行新增7 行删除
  1. 7
    7
      Marlin/src/lcd/ultralcd.cpp

+ 7
- 7
Marlin/src/lcd/ultralcd.cpp 查看文件

376
   #endif // !ENCODER_RATE_MULTIPLIER
376
   #endif // !ENCODER_RATE_MULTIPLIER
377
 
377
 
378
   #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
378
   #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
379
-  #define MENU_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
380
-  #define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
379
+  #define MENU_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
380
+  #define MENU_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
381
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
381
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
382
-    #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
383
-    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
382
+    #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
383
+    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_MULTIPLIER_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
384
   #else // !ENCODER_RATE_MULTIPLIER
384
   #else // !ENCODER_RATE_MULTIPLIER
385
-    #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(setting_edit_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
386
-    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(setting_edit_callback_ ## TYPE, LABEL, PSTR(LABEL), ## __VA_ARGS__)
385
+    #define MENU_MULTIPLIER_ITEM_EDIT(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
386
+    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(TYPE, LABEL, ...) MENU_ITEM(_CAT(setting_edit_callback_,TYPE), LABEL, PSTR(LABEL), ## __VA_ARGS__)
387
   #endif // !ENCODER_RATE_MULTIPLIER
387
   #endif // !ENCODER_RATE_MULTIPLIER
388
 
388
 
389
   #define SCREEN_OR_MENU_LOOP() \
389
   #define SCREEN_OR_MENU_LOOP() \
986
       END_MENU();
986
       END_MENU();
987
     }
987
     }
988
   #endif
988
   #endif
989
-  
989
+
990
   #if ENABLED(MENU_ITEM_CASE_LIGHT)
990
   #if ENABLED(MENU_ITEM_CASE_LIGHT)
991
 
991
 
992
     #include "../feature/caselight.h"
992
     #include "../feature/caselight.h"

Loading…
取消
儲存