Skip to content

Commit

Permalink
apply to more things
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 23, 2023
1 parent d9125c5 commit 981a591
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 37 deletions.
7 changes: 0 additions & 7 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3397,13 +3397,6 @@
#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
11 changes: 10 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@
*/
//#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F<hertz>.
#ifdef XY_FREQUENCY_LIMIT
#define XY_FREQUENCY_MIN_PERCENT 5 // (percent) Minimum FR percentage to apply. Set with M201 G<min%>.
#define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 G<min%>.
#endif

//
Expand Down Expand Up @@ -1625,6 +1625,15 @@

#endif // HAS_DISPLAY

#if ANY(HAS_MARLINUI_MENU, TOUCH_SCREEN, DWIN_CREALITY_LCD, DWIN_LCD_PROUI)
#define SPEED_EDIT_MIN 10 // (%)
#define SPEED_EDIT_MAX 999 // (%)
#if HAS_EXTRUDERS
#define FLOW_EDIT_MIN 10 // (%)
#define FLOW_EDIT_MAX 999 // (%)
#endif
#endif

// Add 'M73' to set print job progress, overrides Marlin's built-in estimate
//#define SET_PROGRESS_MANUALLY
#if ENABLED(SET_PROGRESS_MANUALLY)
Expand Down
6 changes: 1 addition & 5 deletions Marlin/src/lcd/e3v2/creality/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@
#define MENU_CHAR_LIMIT 24
#define STATUS_Y 354

// Print speed limit
#define MIN_PRINT_SPEED 10
#define MAX_PRINT_SPEED 999

#define FEEDRATE_E (60)

// Minimum unit (0.1) : multiple (10)
Expand Down Expand Up @@ -1559,7 +1555,7 @@ void hmiPrintSpeed() {
return;
}
// printSpeed limit
LIMIT(hmiValues.printSpeed, MIN_PRINT_SPEED, MAX_PRINT_SPEED);
LIMIT(hmiValues.printSpeed, SPEED_EDIT_MIN, SPEED_EDIT_MAX);
// printSpeed value
drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.printSpeed, true);
}
Expand Down
24 changes: 11 additions & 13 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,14 @@

#define PAUSE_HEAT

// Print speed limit
#define MIN_PRINT_SPEED 10
#define MAX_PRINT_SPEED 999

// Print flow limit
#define MIN_PRINT_FLOW 10
#define MAX_PRINT_FLOW 299

// Load and Unload limits
#define MAX_LOAD_UNLOAD 500
#ifndef EXTRUDE_MAXLENGTH
#ifdef FILAMENT_CHANGE_UNLOAD_LENGTH
#define EXTRUDE_MAXLENGTH (FILAMENT_CHANGE_UNLOAD_LENGTH + 10)
#else
#define EXTRUDE_MAXLENGTH 500
#endif
#endif

// Juntion deviation limits
#define MIN_JD_MM 0.001
Expand Down Expand Up @@ -2243,16 +2241,16 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS,
#endif

#if ENABLED(ADVANCED_PAUSE_FEATURE)
void setFilLoad() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); }
void setFilUnload() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); }
void setFilLoad() { setPFloatOnClick(0, EXTRUDE_MAXLENGTH, UNITFDIGITS); }
void setFilUnload() { setPFloatOnClick(0, EXTRUDE_MAXLENGTH, UNITFDIGITS); }
#endif

#if ENABLED(PREVENT_COLD_EXTRUSION)
void applyExtMinT() { thermalManager.extrude_min_temp = hmiData.extMinT; thermalManager.allow_cold_extrude = (hmiData.extMinT == 0); }
void setExtMinT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP, applyExtMinT); }
#endif

void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); }
void setSpeed() { setPIntOnClick(SPEED_EDIT_MIN, SPEED_EDIT_MAX); }

#if HAS_HOTEND
void applyHotendTemp() { thermalManager.setTargetHotend(menuData.value, 0); }
Expand Down Expand Up @@ -2297,7 +2295,7 @@ void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); }

#endif // ADVANCED_PAUSE_FEATURE

void setFlow() { setPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refresh_e_factor(0); }); }
void setFlow() { setPIntOnClick(FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(0); }); }

// Bed Tramming

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/malyan/malyan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void process_lcd_c_command(const char *command) {
case 'C': // Cope with both V1 early rev and later LCDs.
case 'S':
feedrate_percentage = target_val * 10;
LIMIT(feedrate_percentage, 10, 999);
LIMIT(feedrate_percentage, EDIT_SPEED_MIN, EDIT_SPEED_MAX);
break;

case 'T':
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ void MarlinUI::init() {
else if ((old_frm < 100 && new_frm > 100) || (old_frm > 100 && new_frm < 100))
new_frm = 100;

LIMIT(new_frm, 10, 999);
LIMIT(new_frm, FLOW_EDIT_MIN, FLOW_EDIT_MAX);

if (old_frm != new_frm) {
feedrate_percentage = new_frm;
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/menu/menu_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ class MenuItem_bool : public MenuEditItemBase {
* MenuItem_function::action(flabel, lcd_sdcard_pause)
* MenuItem_function::draw(sel, row, flabel, lcd_sdcard_pause)
*
* EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
* MenuItem_int3::action(flabel, &feedrate_percentage, 10, 999)
* MenuItem_int3::draw(sel, row, flabel, &feedrate_percentage, 10, 999)
* EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX)
* MenuItem_int3::action(flabel, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX)
* MenuItem_int3::draw(sel, row, flabel, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX)
*/

#if ENABLED(ENCODER_RATE_MULTIPLIER)
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/menu/menu_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void menu_tune() {
//
// Speed:
//
EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999);
EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX);

//
// Manual bed leveling, Bed Z:
Expand Down Expand Up @@ -198,11 +198,11 @@ void menu_tune() {
// Flow:
//
#if HAS_EXTRUDERS
EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, []{ planner.refresh_e_factor(active_extruder); });
EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(active_extruder); });
// Flow En:
#if HAS_MULTI_EXTRUDER
EXTRUDER_LOOP()
EDIT_ITEM_N(int3, e, MSG_FLOW_N, &planner.flow_percentage[e], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
EDIT_ITEM_N(int3, e, MSG_FLOW_N, &planner.flow_percentage[e], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
#endif
#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, TOUCH_SPEED_TUNE_MIN, TOUCH_SPEED_TUNE_MAX);
MenuItem_int3::action(GET_TEXT_F(MSG_SPEED), &feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_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], TOUCH_FLOW_TUNE_MIN, TOUCH_FLOW_TUNE_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW), &planner.flow_percentage[MenuItemBase::itemIndex], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
#else
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); });
MenuItem_int3::action(GET_TEXT_F(MSG_FLOW_N), &planner.flow_percentage[MenuItemBase::itemIndex], FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
#endif
break;
#endif
Expand Down

0 comments on commit 981a591

Please sign in to comment.