From 981a5912845673289f3f53635bfa82f115b526a6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 22 Nov 2023 23:15:01 -0600 Subject: [PATCH] apply to more things --- Marlin/Configuration.h | 7 ------- Marlin/Configuration_adv.h | 11 ++++++++++- Marlin/src/lcd/e3v2/creality/dwin.cpp | 6 +----- Marlin/src/lcd/e3v2/proui/dwin.cpp | 24 +++++++++++------------- Marlin/src/lcd/extui/malyan/malyan.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/menu/menu_item.h | 6 +++--- Marlin/src/lcd/menu/menu_tune.cpp | 6 +++--- Marlin/src/lcd/tft/touch.cpp | 6 +++--- 9 files changed, 33 insertions(+), 37 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e6367da249d80..6374760db54a7 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -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 // diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 275bcaa66926a..fa5fb02308efc 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1254,7 +1254,7 @@ */ //#define XY_FREQUENCY_LIMIT 10 // (Hz) Maximum frequency of small zigzag infill moves. Set with M201 F. #ifdef XY_FREQUENCY_LIMIT - #define XY_FREQUENCY_MIN_PERCENT 5 // (percent) Minimum FR percentage to apply. Set with M201 G. + #define XY_FREQUENCY_MIN_PERCENT 5 // (%) Minimum FR percentage to apply. Set with M201 G. #endif // @@ -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) diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index c71ab8cff2804..f3935f39dd5e6 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -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) @@ -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); } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 843009c274617..820fc11558bc7 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -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 @@ -2243,8 +2241,8 @@ 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) @@ -2252,7 +2250,7 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, 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); } @@ -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 diff --git a/Marlin/src/lcd/extui/malyan/malyan.cpp b/Marlin/src/lcd/extui/malyan/malyan.cpp index d1c2387682ffd..f748e477d7123 100644 --- a/Marlin/src/lcd/extui/malyan/malyan.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan.cpp @@ -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': diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 49b9fecad8ae3..4dbc87a13f868 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -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; diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index ea26b48907a2b..4d3e33db4c5a5 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -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) diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index c36ac013b86fc..ecd4e5f342fc0 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -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: @@ -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 diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 310c23cc84ce0..8e79e397adeaf 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -220,7 +220,7 @@ 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 @@ -228,9 +228,9 @@ void Touch::touch(touch_control_t *control) { 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