From fa4c36df689518262e1051242003f97d32cdc5fd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 23 Feb 2015 19:40:57 -0800 Subject: [PATCH] Fix menu callback issue wrt LCD_CLICKED --- Marlin/ultralcd.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 9218d8429..312eb9f8e 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1025,19 +1025,20 @@ void lcd_sdcard_menu() { } #define menu_edit_type(_type, _name, _strFunc, scale) \ - void menu_edit_ ## _name () { \ + bool menu_edit_ ## _name () { \ + bool isClicked = LCD_CLICKED; if ((int32_t)encoderPosition < 0) encoderPosition = 0; \ if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \ if (lcdDrawUpdate) \ lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \ - if (LCD_CLICKED) { \ + if (isClicked) { \ *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \ lcd_goto_menu(prevMenu, prevEncoderPosition); \ } \ + return isClicked; } \ void menu_edit_callback_ ## _name () { \ - menu_edit_ ## _name (); \ - if (LCD_CLICKED) (*callbackFunc)(); \ + if (menu_edit_ ## _name ()) (*callbackFunc)(); \ } \ static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \ prevMenu = currentMenu; \