From 7f9c62437e5c72947acc3310d94829f132697c81 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 3 Feb 2020 00:00:35 -0600 Subject: [PATCH] Corner Leveling: Add inset for each side (#16759) --- Marlin/Configuration.h | 8 +++---- Marlin/src/feature/joystick.cpp | 2 +- Marlin/src/inc/SanityCheck.h | 6 +++-- Marlin/src/lcd/extensible_ui/ui_api.cpp | 4 ++-- Marlin/src/lcd/menu/menu.cpp | 2 +- Marlin/src/lcd/menu/menu_bed_corners.cpp | 29 +++++++++--------------- Marlin/src/lcd/ultralcd.cpp | 2 +- Marlin/src/module/planner.h | 3 ++- 8 files changed, 26 insertions(+), 30 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 998055b72..ba07d3f08 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1313,10 +1313,10 @@ //#define LEVEL_BED_CORNERS #if ENABLED(LEVEL_BED_CORNERS) - #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling - #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners - #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points - //#define LEVEL_CENTER_TOO // Move to the center after the last corner + #define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points + #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points + //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif /** diff --git a/Marlin/src/feature/joystick.cpp b/Marlin/src/feature/joystick.cpp index acf6c13a1..7a8e40f50 100644 --- a/Marlin/src/feature/joystick.cpp +++ b/Marlin/src/feature/joystick.cpp @@ -164,7 +164,7 @@ Joystick joystick; LOOP_XYZ(i) if (norm_jog[i]) { move_dist[i] = seg_time * norm_jog[i] * #if ENABLED(EXTENSIBLE_UI) - MMM_TO_MMS(manual_feedrate_mm_m[i]); + manual_feedrate_mm_s[i]; #else planner.settings.max_feedrate_mm_s[i]; #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index ea66232ff..210c6c897 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -312,8 +312,10 @@ #error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration." #elif defined(FILAMENT_CHANGE_LOAD_LENGTH) #error "FILAMENT_CHANGE_LOAD_LENGTH is now FILAMENT_CHANGE_FAST_LOAD_LENGTH. Please update your configuration." -#elif ENABLED(LEVEL_BED_CORNERS) && !defined(LEVEL_CORNERS_INSET) - #error "LEVEL_BED_CORNERS requires a LEVEL_CORNERS_INSET value. Please update your Configuration.h." +#elif defined(LEVEL_CORNERS_INSET) + #error "LEVEL_CORNERS_INSET is now LEVEL_CORNERS_INSET_LFRB . Please update your Configuration.h." +#elif ENABLED(LEVEL_BED_CORNERS) && !defined(LEVEL_CORNERS_INSET_LFRB) + #error "LEVEL_BED_CORNERS requires LEVEL_CORNERS_INSET_LFRB values. Please update your Configuration.h." #elif defined(BEZIER_JERK_CONTROL) #error "BEZIER_JERK_CONTROL is now S_CURVE_ACCELERATION. Please update your configuration." #elif DISABLED(CLASSIC_JERK) && defined(JUNCTION_DEVIATION_FACTOR) diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 0e0a1171a..f8db5c820 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -389,14 +389,14 @@ namespace ExtUI { #endif current_position[axis] = constrain(position, min, max); - line_to_current_position(MMM_TO_MMS(manual_feedrate_mm_m[axis])); + line_to_current_position(manual_feedrate_mm_s[axis]); } void setAxisPosition_mm(const float position, const extruder_t extruder) { setActiveTool(extruder, true); current_position.e = position; - line_to_current_position(MMM_TO_MMS(manual_feedrate_mm_m.e)); + line_to_current_position(manual_feedrate_mm_s.e); } void setActiveTool(const extruder_t extruder, bool no_move) { diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 9c3cf057d..269709bf2 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -384,7 +384,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) { void line_to_z(const float &z) { current_position.z = z; - line_to_current_position(MMM_TO_MMS(manual_feedrate_mm_m.z)); + line_to_current_position(manual_feedrate_mm_s.z); } #endif diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index a7fffb1e0..f09ac1551 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -55,33 +55,26 @@ static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Pleas */ static int8_t bed_corner; static inline void _lcd_goto_next_corner() { + constexpr float lfrb[4] = LEVEL_CORNERS_INSET_LFRB; + constexpr xy_pos_t lf { (X_MIN_BED) + lfrb[0], (Y_MIN_BED) + lfrb[1] }, + rb { (X_MAX_BED) - lfrb[2], (Y_MAX_BED) - lfrb[3] }; line_to_z(LEVEL_CORNERS_Z_HOP); switch (bed_corner) { - case 0: - current_position.set(X_MIN_BED + LEVEL_CORNERS_INSET, Y_MIN_BED + LEVEL_CORNERS_INSET); - break; - case 1: - current_position.x = X_MAX_BED - (LEVEL_CORNERS_INSET); - break; - case 2: - current_position.y = Y_MAX_BED - (LEVEL_CORNERS_INSET); - break; - case 3: - current_position.x = X_MIN_BED + LEVEL_CORNERS_INSET; - break; + case 0: current_position = lf; break; // copy xy + case 1: current_position.x = rb.x; break; + case 2: current_position.y = rb.y; break; + case 3: current_position.x = lf.x; break; #if ENABLED(LEVEL_CENTER_TOO) - case 4: - current_position.set(X_CENTER, Y_CENTER); - break; + case 4: current_position.set(X_CENTER, Y_CENTER); break; #endif } - line_to_current_position(MMM_TO_MMS(manual_feedrate_mm_m.x)); + line_to_current_position(manual_feedrate_mm_s.x); line_to_z(LEVEL_CORNERS_HEIGHT); - if (++bed_corner > 3 + if (++bed_corner > (3 #if ENABLED(LEVEL_CENTER_TOO) + 1 #endif - ) bed_corner = 0; + )) bed_corner = 0; } static inline void _lcd_level_bed_corners_homing() { diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 35366d761..eaeddcd10 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -673,7 +673,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) { if (manual_move_axis != (int8_t)NO_AXIS && ELAPSED(millis(), manual_move_start_time) && !planner.is_full()) { - const feedRate_t fr_mm_s = MMM_TO_MMS(manual_feedrate_mm_m[manual_move_axis]); + const feedRate_t fr_mm_s = manual_feedrate_mm_s[manual_move_axis]; #if IS_KINEMATIC #if EXTRUDERS > 1 diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 52b6bc1ea..5f70c06cc 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -57,7 +57,8 @@ // Feedrate for manual moves #ifdef MANUAL_FEEDRATE - constexpr xyze_feedrate_t manual_feedrate_mm_m = MANUAL_FEEDRATE; + constexpr xyze_feedrate_t _mf = MANUAL_FEEDRATE, + manual_feedrate_mm_s { _mf.x / 60.0f, _mf.y / 60.0f, _mf.z / 60.0f, _mf.e / 60.0f }; #endif enum BlockFlagBit : char {