From 9b3462f73f5e0e3cadefd2f64eff55c758dd96d5 Mon Sep 17 00:00:00 2001 From: Josef Larsson Date: Sun, 22 Mar 2015 00:32:22 +0100 Subject: [PATCH 1/4] Refactor SCARA calibration. Save some lines of code and possibly ROM. --- Marlin/Marlin_main.cpp | 76 +++++++++--------------------------------- 1 file changed, 15 insertions(+), 61 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4ef5d59f1..cb7434ef4 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3967,18 +3967,16 @@ inline void gcode_M303() { } #ifdef SCARA - /** * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration) */ - inline bool gcode_M360() { - SERIAL_ECHOLN(" Cal: Theta 0 "); + bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) { //SoftEndsEnabled = false; // Ignore soft endstops during calibration //SERIAL_ECHOLN(" Soft endstops disabled "); if (! Stopped) { //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 0; - delta[Y_AXIS] = 120; + delta[X_AXIS] = delta_x; + delta[Y_AXIS] = delta_y; calculate_SCARA_forward_Transform(delta); destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; @@ -3989,25 +3987,20 @@ inline void gcode_M303() { return false; } + /** + * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration) + */ + inline bool gcode_M360() { + SERIAL_ECHOLN(" Cal: Theta 0 "); + return SCARA_move_to_cal(0, 120); + } + /** * M361: SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree) */ inline bool gcode_M361() { SERIAL_ECHOLN(" Cal: Theta 90 "); - //SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 90; - delta[Y_AXIS] = 130; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(90, 130); } /** @@ -4015,20 +4008,7 @@ inline void gcode_M303() { */ inline bool gcode_M362() { SERIAL_ECHOLN(" Cal: Psi 0 "); - //SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 60; - delta[Y_AXIS] = 180; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(60, 180); } /** @@ -4036,20 +4016,7 @@ inline void gcode_M303() { */ inline bool gcode_M363() { SERIAL_ECHOLN(" Cal: Psi 90 "); - //SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 50; - delta[Y_AXIS] = 90; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(50, 90); } /** @@ -4057,20 +4024,7 @@ inline void gcode_M303() { */ inline bool gcode_M364() { SERIAL_ECHOLN(" Cal: Theta-Psi 90 "); - // SoftEndsEnabled = false; // Ignore soft endstops during calibration - //SERIAL_ECHOLN(" Soft endstops disabled "); - if (! Stopped) { - //get_coordinates(); // For X Y Z E F - delta[X_AXIS] = 45; - delta[Y_AXIS] = 135; - calculate_SCARA_forward_Transform(delta); - destination[X_AXIS] = delta[X_AXIS] / axis_scaling[X_AXIS]; - destination[Y_AXIS] = delta[Y_AXIS] / axis_scaling[Y_AXIS]; - prepare_move(); - //ClearToSend(); - return true; - } - return false; + return SCARA_move_to_cal(45, 135); } /** From 379348487e423bfb67a1aba1c49c5acdb54d5e43 Mon Sep 17 00:00:00 2001 From: Josef Larsson Date: Sun, 22 Mar 2015 12:21:31 +0100 Subject: [PATCH 2/4] Removed malplaced comment. --- Marlin/Marlin_main.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index cb7434ef4..5c1e46312 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3967,9 +3967,6 @@ inline void gcode_M303() { } #ifdef SCARA - /** - * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration) - */ bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) { //SoftEndsEnabled = false; // Ignore soft endstops during calibration //SERIAL_ECHOLN(" Soft endstops disabled "); From e6f6c6e3a1793fb58d25b8dbe14598dfd2abba4d Mon Sep 17 00:00:00 2001 From: wurstnase Date: Mon, 23 Mar 2015 08:32:48 +0100 Subject: [PATCH 3/4] fix bad insertion config again --- Marlin/example_configurations/Felix/Configuration.h | 1 - Marlin/example_configurations/Felix/Configuration_DUAL.h | 1 - 2 files changed, 2 deletions(-) diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 973fb6354..b03e871ed 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -386,7 +386,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Note: this feature occupies 10'206 byte #ifdef AUTO_BED_LEVELING_GRID -home_offset // set the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define BACK_PROBE_BED_POSITION 180 diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 42dcd3827..be59d340f 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -386,7 +386,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Note: this feature occupies 10'206 byte #ifdef AUTO_BED_LEVELING_GRID -home_offset // set the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define BACK_PROBE_BED_POSITION 180 From 37cde8a19170921774fd95bc4450263966e6c7bb Mon Sep 17 00:00:00 2001 From: nicolas-rambaud Date: Mon, 23 Mar 2015 12:29:12 +0100 Subject: [PATCH 4/4] Report changes from previous PR from old code base including : I've updated the minimum values from the LCD. It has been a while that i want to at least fix this. I have an inductive probe and often i need to set my zOffset to something lower than 0.5. With the current implementation, the default LCD value is set to 0.5 for some reason. On my case i need to be able to set it down to 0.0 as my inductive probe can be lower than 0.5. Before with the LCD we couldn't change this value below 0.5. We had to flash the firmware every time which was painful. Now we are able to change this value down to 0.0 if needed. I've also changed the minimum value for Z min acceleration. In the default configuration it's set to 25 but on the LCD the minimum was 100 which is not coherent. I've changes the minimum to 10. On this axis, depending on the mechanics/motor drivers we might require very low acceleration, so i guess 10 is somehow realistic. --- Marlin/ultralcd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 29b3ca118..19e3d0c50 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -912,9 +912,9 @@ static void lcd_control_motion_menu() { START_MENU(); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); #ifdef ENABLE_AUTO_BED_LEVELING - MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.5, 50); + MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.0, 50); #endif - MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000); + MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000); MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990); MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990); MENU_ITEM_EDIT(float3, MSG_VE_JERK, &max_e_jerk, 1, 990); @@ -926,7 +926,7 @@ static void lcd_control_motion_menu() { MENU_ITEM_EDIT(float3, MSG_VTRAV_MIN, &mintravelfeedrate, 0, 999); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_X, &max_acceleration_units_per_sq_second[X_AXIS], 100, 99000, reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Y, &max_acceleration_units_per_sq_second[Y_AXIS], 100, 99000, reset_acceleration_rates); - MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 100, 99000, reset_acceleration_rates); + MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 10, 99000, reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &max_acceleration_units_per_sq_second[E_AXIS], 100, 99000, reset_acceleration_rates); MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &retract_acceleration, 100, 99000); MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &travel_acceleration, 100, 99000);