From e334efb2a7914b6a39fb3c060790319664d98b2d Mon Sep 17 00:00:00 2001 From: LVD-AC Date: Wed, 8 Nov 2017 10:07:17 +0100 Subject: [PATCH 1/3] PROBE_MANUALLY etc. --- .../FLSUN/auto_calibrate/Configuration.h | 4 +- .../delta/FLSUN/kossel_mini/Configuration.h | 2 +- .../examples/delta/generic/Configuration.h | 2 +- .../delta/kossel_mini/Configuration.h | 2 +- .../examples/delta/kossel_pro/Configuration.h | 2 +- .../examples/delta/kossel_xl/Configuration.h | 2 +- Marlin/src/gcode/calibrate/G33.cpp | 17 ++++--- Marlin/src/gcode/calibrate/M665.cpp | 2 +- Marlin/src/lcd/language/language_en.h | 4 +- Marlin/src/lcd/ultralcd.cpp | 50 ++++++++++--------- Marlin/src/module/configuration_store.cpp | 2 +- Marlin/src/module/delta.cpp | 22 ++++---- Marlin/src/module/delta.h | 2 +- Marlin/src/module/probe.cpp | 23 ++------- 14 files changed, 64 insertions(+), 72 deletions(-) diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h index d28eb7f55..cc63d79ac 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h @@ -487,7 +487,7 @@ // Delta calibration menu // uncomment to add three points calibration menu option. // See http://minow.blogspot.com/index.html#4918805519571907051 - #define DELTA_CALIBRATION_MENU + //#define DELTA_CALIBRATION_MENU // uncomment to add G33 Delta Auto-Calibration (Enable EEPROM_SETTINGS to store results) #define DELTA_AUTO_CALIBRATION @@ -506,7 +506,7 @@ #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) - // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + // Set the radius for the calibration probe points - max 0.9 * DELTA_PRINTABLE_RADIUS for non-eccentric probes #define DELTA_CALIBRATION_RADIUS 73.5 // mm // Set the steprate for papertest probing #define PROBE_MANUALLY_STEP 0.025 diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h index 69c257b04..8a26868c2 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h @@ -506,7 +506,7 @@ #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) - // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + // Set the radius for the calibration probe points - max 0.9 * DELTA_PRINTABLE_RADIUS for non-eccentric probes #define DELTA_CALIBRATION_RADIUS 73.5 // mm // Set the steprate for papertest probing #define PROBE_MANUALLY_STEP 0.025 diff --git a/Marlin/src/config/examples/delta/generic/Configuration.h b/Marlin/src/config/examples/delta/generic/Configuration.h index 44f652974..2bbcf1047 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration.h +++ b/Marlin/src/config/examples/delta/generic/Configuration.h @@ -496,7 +496,7 @@ #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) - // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + // Set the radius for the calibration probe points - max 0.9 * DELTA_PRINTABLE_RADIUS for non-eccentric probes #define DELTA_CALIBRATION_RADIUS 121.5 // mm // Set the steprate for papertest probing #define PROBE_MANUALLY_STEP 0.025 diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h index 57a0fa4c7..1de41f8a2 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -496,7 +496,7 @@ #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) - // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + // Set the radius for the calibration probe points - max 0.9 * DELTA_PRINTABLE_RADIUS for non-eccentric probes #define DELTA_CALIBRATION_RADIUS 78.0 // mm // Set the steprate for papertest probing #define PROBE_MANUALLY_STEP 0.025 diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h index e2cc2966b..a61e16de3 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h @@ -482,7 +482,7 @@ #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) - // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + // Set the radius for the calibration probe points - max 0.9 * DELTA_PRINTABLE_RADIUS for non-eccentric probes #define DELTA_CALIBRATION_RADIUS 110.0 // mm // Set the steprate for papertest probing #define PROBE_MANUALLY_STEP 0.025 diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h index df8d4c453..3d992a299 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h @@ -500,7 +500,7 @@ #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) - // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes + // Set the radius for the calibration probe points - max 0.9 * DELTA_PRINTABLE_RADIUS for non-eccentric probes #define DELTA_CALIBRATION_RADIUS 121.5 // mm // Set the steprate for papertest probing #define PROBE_MANUALLY_STEP 0.025 diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 35f63e6a2..06240eb30 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -180,7 +180,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, r = delta_calibration_radius * 0.1; z_at_pt[CEN] += #if HAS_BED_PROBE - probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1) + probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false) #else lcd_probe_pt(cos(a) * r, sin(a) * r) #endif @@ -209,7 +209,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, interpol = FMOD(axis, 1); const float z_temp = #if HAS_BED_PROBE - probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1) + probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false) #else lcd_probe_pt(cos(a) * r, sin(a) * r) #endif @@ -225,7 +225,6 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, z_at_pt[axis] /= _7P_STEP / steps; } - float S1 = z_at_pt[CEN], S2 = sq(z_at_pt[CEN]); int16_t N = 1; @@ -263,6 +262,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, LOOP_XYZ(axis) { delta_endstop_adj[axis] -= 1.0; + recalc_delta_settings(); endstops.enable(true); if (!home_delta()) return; @@ -276,6 +276,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis]; print_G33_results(z_at_pt, true, true); delta_endstop_adj[axis] += 1.0; + recalc_delta_settings(); switch (axis) { case A_AXIS : h_fac += 4.0 / (Z03(CEN) +Z01(__A) +Z32(_CA) +Z32(_AB)); // Offset by X-tower end-stop @@ -293,7 +294,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, for (int8_t zig_zag = -1; zig_zag < 2; zig_zag += 2) { delta_radius += 1.0 * zig_zag; - recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + recalc_delta_settings(); endstops.enable(true); if (!home_delta()) return; @@ -306,7 +307,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis]; print_G33_results(z_at_pt, true, true); delta_radius -= 1.0 * zig_zag; - recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + recalc_delta_settings(); r_fac -= zig_zag * 6.0 / (Z03(__A) +Z03(__B) +Z03(__C) +Z03(_BC) +Z03(_CA) +Z03(_AB)); // Offset by delta radius } r_fac /= 2.0; @@ -319,7 +320,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]); delta_height -= z_temp; LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp; - recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + recalc_delta_settings(); endstops.enable(true); if (!home_delta()) return; @@ -339,7 +340,7 @@ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]); delta_height -= z_temp; LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp; - recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + recalc_delta_settings(); switch (axis) { case A_AXIS : a_fac += 4.0 / ( Z06(__B) -Z06(__C) +Z06(_CA) -Z06(_AB)); // Offset by alpha tower angle @@ -626,7 +627,7 @@ void GcodeSuite::G33() { delta_height -= z_temp; LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp; } - recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + recalc_delta_settings(); NOMORE(zero_std_dev_min, zero_std_dev); // print report diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index fa2614bea..2f7b4bd2d 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -55,7 +55,7 @@ if (parser.seen('X')) delta_tower_angle_trim[A_AXIS] = parser.value_float(); if (parser.seen('Y')) delta_tower_angle_trim[B_AXIS] = parser.value_float(); if (parser.seen('Z')) delta_tower_angle_trim[C_AXIS] = parser.value_float(); - recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + recalc_delta_settings(); } #elif IS_SCARA diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 3b4027ba3..580d1cb37 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -752,8 +752,8 @@ #ifndef MSG_DELTA_HEIGHT_CALIBRATE #define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Set Delta Height") #endif -#ifndef MSG_DELTA_DIAG_ROG - #define MSG_DELTA_DIAG_ROG _UxGT("Diag Rod") +#ifndef MSG_DELTA_DIAG_ROD + #define MSG_DELTA_DIAG_ROD _UxGT("Diag Rod") #endif #ifndef MSG_DELTA_HEIGHT #define MSG_DELTA_HEIGHT _UxGT("Height") diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index f11c7a315..588fb6889 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -205,7 +205,7 @@ uint16_t max_display_update_time = 0; void lcd_control_retract_menu(); #endif - #if ENABLED(DELTA_CALIBRATION_MENU) + #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) void lcd_delta_calibrate_menu(); #endif @@ -2559,7 +2559,7 @@ void kill_screen(const char* lcd_msg) { // Move Axis // #if ENABLED(DELTA) - if (axis_homed[Z_AXIS]) + if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) #endif MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu); @@ -2674,7 +2674,7 @@ void kill_screen(const char* lcd_msg) { // // Delta Calibration // - #if ENABLED(DELTA_CALIBRATION_MENU) + #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu); #endif @@ -2743,22 +2743,22 @@ void kill_screen(const char* lcd_msg) { void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); } void _goto_center() { _man_probe_pt(0,0); } - void _lcd_set_delta_height() { - update_software_endstops(Z_AXIS); - } + #endif // DELTA_CALIBRATION_MENU + + #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) void lcd_delta_settings() { START_MENU(); MENU_BACK(MSG_DELTA_CALIBRATE); - MENU_ITEM_EDIT(float52, MSG_DELTA_DIAG_ROG, &delta_diagonal_rod, DELTA_DIAGONAL_ROD - 5.0, DELTA_DIAGONAL_ROD + 5.0); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10.0, delta_height + 10.0, _lcd_set_delta_height); - MENU_ITEM_EDIT(float43, "Ex", &delta_endstop_adj[A_AXIS], -5.0, 5.0); - MENU_ITEM_EDIT(float43, "Ey", &delta_endstop_adj[B_AXIS], -5.0, 5.0); - MENU_ITEM_EDIT(float43, "Ez", &delta_endstop_adj[C_AXIS], -5.0, 5.0); - MENU_ITEM_EDIT(float52, MSG_DELTA_RADIUS, &delta_radius, DELTA_RADIUS - 5.0, DELTA_RADIUS + 5.0); - MENU_ITEM_EDIT(float43, "Tx", &delta_tower_angle_trim[A_AXIS], -5.0, 5.0); - MENU_ITEM_EDIT(float43, "Ty", &delta_tower_angle_trim[B_AXIS], -5.0, 5.0); - MENU_ITEM_EDIT(float43, "Tz", &delta_tower_angle_trim[C_AXIS], -5.0, 5.0); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5.0, delta_diagonal_rod + 5.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10.0, delta_height + 10.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float43, "Ex", &delta_endstop_adj[A_AXIS], -5.0, 5.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float43, "Ey", &delta_endstop_adj[B_AXIS], -5.0, 5.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float43, "Ez", &delta_endstop_adj[C_AXIS], -5.0, 5.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_RADIUS, &delta_radius, delta_radius - 5.0, delta_radius + 5.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float43, "Tx", &delta_tower_angle_trim[A_AXIS], -5.0, 5.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float43, "Ty", &delta_tower_angle_trim[B_AXIS], -5.0, 5.0, recalc_delta_settings); + MENU_ITEM_EDIT_CALLBACK(float43, "Tz", &delta_tower_angle_trim[C_AXIS], -5.0, 5.0, recalc_delta_settings); END_MENU(); } @@ -2766,7 +2766,6 @@ void kill_screen(const char* lcd_msg) { START_MENU(); MENU_BACK(MSG_MAIN); #if ENABLED(DELTA_AUTO_CALIBRATION) - MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_settings); MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 P1")); #if ENABLED(EEPROM_SETTINGS) @@ -2774,17 +2773,20 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); #endif #endif - MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); - if (axis_homed[Z_AXIS]) { - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_X, _goto_tower_x); - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Y, _goto_tower_y); - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Z, _goto_tower_z); - MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_CENTER, _goto_center); - } + MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_settings); + #if ENABLED(DELTA_CALIBRATION_MENU) + MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); + if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) { + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_X, _goto_tower_x); + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Y, _goto_tower_y); + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Z, _goto_tower_z); + MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_CENTER, _goto_center); + } + #endif END_MENU(); } - #endif // DELTA_CALIBRATION_MENU + #endif // DELTA_CALIBRATION_MENU || DELTA_AUTO_CALIBRATION /** * If the most recent manual move hasn't been fed to the planner yet, diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 60a5da4da..30e685718 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -225,7 +225,7 @@ void MarlinSettings::postprocess() { // Make sure delta kinematics are updated before refreshing the // planner position so the stepper counts will be set correctly. #if ENABLED(DELTA) - recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + recalc_delta_settings(); #endif // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index 77f91927d..eae9c557a 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -56,18 +56,20 @@ float delta_safe_distance_from_top(); * Recalculate factors used for delta kinematics whenever * settings have been changed (e.g., by M665). */ -void recalc_delta_settings(const float radius, const float diagonal_rod, const float tower_angle_trim[ABC]) { +void recalc_delta_settings() { const float trt[ABC] = DELTA_RADIUS_TRIM_TOWER, drt[ABC] = DELTA_DIAGONAL_ROD_TRIM_TOWER; - delta_tower[A_AXIS][X_AXIS] = cos(RADIANS(210 + tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); // front left tower - delta_tower[A_AXIS][Y_AXIS] = sin(RADIANS(210 + tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); - delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(330 + tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); // front right tower - delta_tower[B_AXIS][Y_AXIS] = sin(RADIANS(330 + tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); - delta_tower[C_AXIS][X_AXIS] = cos(RADIANS( 90 + tower_angle_trim[C_AXIS])) * (radius + trt[C_AXIS]); // back middle tower - delta_tower[C_AXIS][Y_AXIS] = sin(RADIANS( 90 + tower_angle_trim[C_AXIS])) * (radius + trt[C_AXIS]); - delta_diagonal_rod_2_tower[A_AXIS] = sq(diagonal_rod + drt[A_AXIS]); - delta_diagonal_rod_2_tower[B_AXIS] = sq(diagonal_rod + drt[B_AXIS]); - delta_diagonal_rod_2_tower[C_AXIS] = sq(diagonal_rod + drt[C_AXIS]); + delta_tower[A_AXIS][X_AXIS] = cos(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (delta_radius + trt[A_AXIS]); // front left tower + delta_tower[A_AXIS][Y_AXIS] = sin(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (delta_radius + trt[A_AXIS]); + delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (delta_radius + trt[B_AXIS]); // front right tower + delta_tower[B_AXIS][Y_AXIS] = sin(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (delta_radius + trt[B_AXIS]); + delta_tower[C_AXIS][X_AXIS] = cos(RADIANS( 90 + delta_tower_angle_trim[C_AXIS])) * (delta_radius + trt[C_AXIS]); // back middle tower + delta_tower[C_AXIS][Y_AXIS] = sin(RADIANS( 90 + delta_tower_angle_trim[C_AXIS])) * (delta_radius + trt[C_AXIS]); + delta_diagonal_rod_2_tower[A_AXIS] = sq(delta_diagonal_rod + drt[A_AXIS]); + delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]); + delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]); + update_software_endstops(Z_AXIS); + axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false; } /** diff --git a/Marlin/src/module/delta.h b/Marlin/src/module/delta.h index 0c705a0ed..fc98f9e6b 100644 --- a/Marlin/src/module/delta.h +++ b/Marlin/src/module/delta.h @@ -43,7 +43,7 @@ extern float delta_tower[ABC][2], * Recalculate factors used for delta kinematics whenever * settings have been changed (e.g., by M665). */ -void recalc_delta_settings(const float radius, const float diagonal_rod, const float tower_angle_trim[ABC]); +void recalc_delta_settings(); /** * Delta Inverse Kinematics diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 918e89e90..046ae0bcb 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -509,10 +509,9 @@ static bool do_probe_move(const float z, const float fr_mm_m) { * @details Used by probe_pt to do a single Z probe. * Leaves current_position[Z_AXIS] at the height where the probe triggered. * - * @param short_move Flag for a shorter probe move towards the bed * @return The raw Z position where the probe was triggered */ -static float run_z_probe(const bool short_move=true) { +static float run_z_probe() { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position); @@ -549,8 +548,8 @@ static float run_z_probe(const bool short_move=true) { } #endif - // move down slowly to find bed - if (do_probe_move(-10 + (short_move ? 0 : -(Z_MAX_LENGTH)), Z_PROBE_SPEED_SLOW)) return NAN; + // Move down slowly to find bed, not too far + if (do_probe_move(-10, Z_PROBE_SPEED_SLOW)) return NAN; #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position); @@ -589,12 +588,11 @@ float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t const float nx = rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ny = ry - (Y_PROBE_OFFSET_FROM_EXTRUDER); - if (printable + if (!printable ? !position_is_reachable(nx, ny) : !position_is_reachable_by_probe(rx, ry) ) return NAN; - const float old_feedrate_mm_s = feedrate_mm_s; #if ENABLED(DELTA) @@ -602,12 +600,6 @@ float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t do_blocking_move_to_z(delta_clip_start_height); #endif - #if HAS_SOFTWARE_ENDSTOPS - // Store the status of the soft endstops and disable if we're probing a non-printable location - static bool enable_soft_endstops = soft_endstops_enabled; - if (!printable) soft_endstops_enabled = false; - #endif - feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S; // Move the probe to the given XY @@ -615,7 +607,7 @@ float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t float measured_z = NAN; if (!DEPLOY_PROBE()) { - measured_z = run_z_probe(printable); + measured_z = run_z_probe(); if (!stow) do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); @@ -623,11 +615,6 @@ float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t if (STOW_PROBE()) measured_z = NAN; } - #if HAS_SOFTWARE_ENDSTOPS - // Restore the soft endstop status - soft_endstops_enabled = enable_soft_endstops; - #endif - if (verbose_level > 2) { SERIAL_PROTOCOLPGM("Bed X: "); SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 3); From 75a58ee4b875630089574f497026a419d7e66d86 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 9 Nov 2017 23:22:11 -0600 Subject: [PATCH 2/3] Fix position_is_reachable bug in waiting --- Marlin/src/module/motion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 852633482..826091c8c 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -260,7 +260,7 @@ void homeaxis(const AxisEnum axis); // This won't work on SCARA since the probe offset rotates with the arm. return position_is_reachable(rx, ry) - && position_is_reachable(rx - X_PROBE_OFFSET_FROM_EXTRUDER, ry - Y_PROBE_OFFSET_FROM_EXTRUDER); + && position_is_reachable(rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ry - (Y_PROBE_OFFSET_FROM_EXTRUDER)); } #else // CARTESIAN From 1ed86adf9cbcd9199263ef0466a939bb38c96484 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 10 Nov 2017 00:48:00 -0600 Subject: [PATCH 3/3] Cleanup around updatePID --- Marlin/src/gcode/config/M304.cpp | 2 -- Marlin/src/module/temperature.cpp | 16 +++++++--------- Marlin/src/module/temperature.h | 17 ++++++++++++----- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Marlin/src/gcode/config/M304.cpp b/Marlin/src/gcode/config/M304.cpp index a27adfc64..3bc645903 100644 --- a/Marlin/src/gcode/config/M304.cpp +++ b/Marlin/src/gcode/config/M304.cpp @@ -32,8 +32,6 @@ void GcodeSuite::M304() { if (parser.seen('I')) thermalManager.bedKi = scalePID_i(parser.value_float()); if (parser.seen('D')) thermalManager.bedKd = scalePID_d(parser.value_float()); - thermalManager.updatePID(); - SERIAL_ECHO_START(); SERIAL_ECHOPAIR(" p:", thermalManager.bedKp); SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bedKi)); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 34f18858c..f92cd815d 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -217,6 +217,12 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS], #if HAS_PID_HEATING + /** + * PID Autotuning (M303) + * + * Alternately heat and cool the nozzle, observing its behavior to + * determine the best PID values to achieve a stable temperature. + */ void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) { float input = 0.0; int cycles = 0; @@ -466,7 +472,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS], bedKp = workKp; \ bedKi = scalePID_i(workKi); \ bedKd = scalePID_d(workKd); \ - updatePID(); }while(0) + }while(0) #define _SET_EXTRUDER_PID() do { \ PID_PARAM(Kp, hotend) = workKp; \ @@ -502,14 +508,6 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS], Temperature::Temperature() { } -void Temperature::updatePID() { - #if ENABLED(PIDTEMP) - #if ENABLED(PID_EXTRUSION_SCALING) - last_e_position = 0; - #endif - #endif -} - int Temperature::getHeaterPower(int heater) { return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater]; } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 51a9038d2..4fad31759 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -430,12 +430,19 @@ class Temperature { */ #if HAS_PID_HEATING static void PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result=false); - #endif - /** - * Update the temp manager when PID values change - */ - static void updatePID(); + #if ENABLED(PIDTEMP) + /** + * Update the temp manager when PID values change + */ + FORCE_INLINE static void updatePID() { + #if ENABLED(PID_EXTRUSION_SCALING) + last_e_position = 0; + #endif + } + #endif + + #endif #if ENABLED(BABYSTEPPING)