Browse Source

Fix menu callback issue wrt LCD_CLICKED

Scott Lahteine 10 years ago
parent
commit
fa4c36df68
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      Marlin/ultralcd.cpp

+ 5
- 4
Marlin/ultralcd.cpp View File

1025
 }
1025
 }
1026
 
1026
 
1027
 #define menu_edit_type(_type, _name, _strFunc, scale) \
1027
 #define menu_edit_type(_type, _name, _strFunc, scale) \
1028
-  void menu_edit_ ## _name () { \
1028
+  bool menu_edit_ ## _name () { \
1029
+    bool isClicked = LCD_CLICKED;
1029
     if ((int32_t)encoderPosition < 0) encoderPosition = 0; \
1030
     if ((int32_t)encoderPosition < 0) encoderPosition = 0; \
1030
     if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \
1031
     if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \
1031
     if (lcdDrawUpdate) \
1032
     if (lcdDrawUpdate) \
1032
         lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1033
         lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1033
-    if (LCD_CLICKED) { \
1034
+    if (isClicked) { \
1034
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1035
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1035
       lcd_goto_menu(prevMenu, prevEncoderPosition); \
1036
       lcd_goto_menu(prevMenu, prevEncoderPosition); \
1036
     } \
1037
     } \
1038
+    return isClicked;
1037
   } \
1039
   } \
1038
   void menu_edit_callback_ ## _name () { \
1040
   void menu_edit_callback_ ## _name () { \
1039
-    menu_edit_ ## _name (); \
1040
-    if (LCD_CLICKED) (*callbackFunc)(); \
1041
+    if (menu_edit_ ## _name ()) (*callbackFunc)(); \
1041
   } \
1042
   } \
1042
   static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
1043
   static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
1043
     prevMenu = currentMenu; \
1044
     prevMenu = currentMenu; \

Loading…
Cancel
Save