Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix value edit click bug #3116

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions Marlin/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui
}
}

inline void lcd_save_previous_menu() { prevMenu = currentMenu; prevEncoderPosition = encoderPosition; }

static void lcd_goto_previous_menu() { lcd_goto_menu(prevMenu, true, prevEncoderPosition); }

/**
*
* "Info Screen"
Expand Down Expand Up @@ -466,7 +470,7 @@ void lcd_set_home_offsets() {
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, "");
if (LCD_CLICKED) lcd_goto_menu(lcd_tune_menu);
if (LCD_CLICKED) lcd_goto_previous_menu();
}
static void lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
static void lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
Expand Down Expand Up @@ -837,7 +841,7 @@ static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
if (LCD_CLICKED) {
line_to_current(axis);
lcd_goto_menu(lcd_move_menu_axis);
lcd_goto_previous_menu();
}
}
#if ENABLED(DELTA)
Expand Down Expand Up @@ -883,7 +887,7 @@ static void lcd_move_e(
#endif //EXTRUDERS > 1
lcd_implementation_drawedit(pos_label, ftostr31(current_position[E_AXIS]));
}
if (LCD_CLICKED) lcd_goto_menu(lcd_move_menu_axis);
if (LCD_CLICKED) lcd_goto_previous_menu();
#if EXTRUDERS > 1
active_extruder = original_active_extruder;
#endif
Expand Down Expand Up @@ -1282,7 +1286,7 @@ static void lcd_control_volumetric_menu() {
lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
#endif
}
if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
if (LCD_CLICKED) lcd_goto_previous_menu();
}
#endif // HAS_LCD_CONTRAST

Expand Down Expand Up @@ -1381,15 +1385,14 @@ static void lcd_control_volumetric_menu() {
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
if (isClicked) { \
*((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
lcd_goto_menu(prevMenu, prevEncoderPosition); \
lcd_goto_previous_menu(); \
} \
return isClicked; \
} \
void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \
void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \
static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
prevMenu = currentMenu; \
prevEncoderPosition = encoderPosition; \
lcd_save_previous_menu(); \
\
lcdDrawUpdate = 2; \
currentMenu = menu_edit_ ## _name; \
Expand Down Expand Up @@ -1506,7 +1509,7 @@ void lcd_quick_feedback() {
*
*/
static void menu_action_back(menuFunc_t func) { lcd_goto_menu(func); }
static void menu_action_submenu(menuFunc_t func) { lcd_goto_menu(func); }
static void menu_action_submenu(menuFunc_t func) { lcd_save_previous_menu(); lcd_goto_menu(func); }
static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); }
static void menu_action_function(menuFunc_t func) { (*func)(); }

Expand Down