Skip to content

Commit

Permalink
Limit speed and flow menu ranges.
Browse files Browse the repository at this point in the history
  • Loading branch information
vovodroid committed Nov 21, 2023
1 parent 3d3be15 commit d9125c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3397,6 +3397,13 @@
#if ENABLED(TFT_COLOR_UI)
//#define SINGLE_TOUCH_NAVIGATION
#endif

//Range for speed and flow adjustment sliders (expressed in percents)
#define TOUCH_SPEED_TUNE_MIN 10
#define TOUCH_SPEED_TUNE_MAX 999

#define TOUCH_FLOW_TUNE_MIN 10
#define TOUCH_FLOW_TUNE_MAX 999
#endif

//
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/tft/touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,17 @@ void Touch::touch(touch_control_t *control) {
break;
case FEEDRATE:
ui.clear_lcd();
MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, 10, 999);
MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, TOUCH_SPEED_TUNE_MIN, TOUCH_SPEED_TUNE_MAX);
break;

#if HAS_EXTRUDERS
case FLOWRATE:
ui.clear_lcd();
MenuItemBase::itemIndex = control->data;
#if EXTRUDERS == 1
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], TOUCH_FLOW_TUNE_MIN, TOUCH_FLOW_TUNE_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
#else
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], TOUCH_FLOW_TUNE_MIN, TOUCH_FLOW_TUNE_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
#endif
break;
#endif
Expand Down

0 comments on commit d9125c5

Please sign in to comment.