diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ea77b4e429..b22a04fffc 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -130,7 +130,6 @@ #ifndef MOTHERBOARD #define MOTHERBOARD BOARD_RAMPS_14_EFB #endif - // Name displayed in the LCD "Ready" message and Info menu //#define CUSTOM_MACHINE_NAME "3D Printer" @@ -795,7 +794,7 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -//#define CLASSIC_JERK +#define CLASSIC_JERK #if ENABLED(CLASSIC_JERK) #define DEFAULT_XJERK 10.0 #define DEFAULT_YJERK 10.0 diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index a91dd82a2a..832920ff38 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -62,11 +62,44 @@ #include "../../core/debug_out.h" #if ENABLED(QUICK_HOME) - + #if IS_SCARA + extern Planner planner; + static void mWork_Home_EndStop(double _theta,double _psi,feedRate_t feedRate){ + float e_tam = 0; + uint8_t extruder = 0; + float mm = 360; + planner.buffer_segment(_theta, _psi, delta.c, e_tam, feedRate, extruder, mm); + millis_t time_end = millis() + 1000; + while (!endstops.any()) { + const millis_t ms = millis(); + if (ELAPSED(ms, time_end)) { // check + time_end = ms + 1000; + const float x_tam = planner.get_axis_position_degrees(A_AXIS), + y_tam = planner.get_axis_position_degrees(B_AXIS); + if (NEAR(x_tam, _theta) && NEAR(y_tam, _psi)) break; + } + idle(); + } + endstops.validate_homing_move(); + } + static void mWork_Set_Pos_Frome_angles(double _theta, double _psi){ + forward_kinematics_SCARA( _theta, _psi ); + current_position.set(cartes.x, cartes.y); + sync_plan_position(); + } + static void quick_home_xy() { + endstops.hit_on_purpose(); + mWork_Set_Pos_Frome_angles(0,0); + mWork_Home_EndStop(360.0 * X_HOME_DIR,360.0* X_HOME_DIR,homing_feedrate(X_AXIS)); //Move X 360 angles and wait endstop + mWork_Set_Pos_Frome_angles(0,0); + mWork_Home_EndStop( 0 , 360.0* Y_HOME_DIR , homing_feedrate(Y_AXIS)); //Move Y 360 angles and wait endstop + mWork_Set_Pos_Frome_angles(THETA_ANGLE_AT_HOME,PSI_ANGLE_AT_HOME); // Set Home position + } + #else static void quick_home_xy() { // Pretend the current position is 0,0 - current_position.set(0.0, 0.0); + current_position.set(0.0, 0.0); // Error with scara. x=0 y=0 -> theta = nul and psi = nul sync_plan_position(); const int x_axis_home_dir = x_home_dir(active_extruder); @@ -109,7 +142,7 @@ #endif #endif } - + #endif #endif // QUICK_HOME #if ENABLED(Z_SAFE_HOMING) diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index 888d25a8bd..f804b9bb90 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -138,6 +138,7 @@ class Endstops { #if ENABLED(VALIDATE_HOMING_ENDSTOPS) // If the last move failed to trigger an endstop, call kill static void validate_homing_move(); + FORCE_INLINE static bool any() { return trigger_state() != 0; } #else FORCE_INLINE static void validate_homing_move() { hit_on_purpose(); } #endif diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index c4e11490b1..7284a3dade 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -704,13 +704,6 @@ class Planner { */ static void buffer_sync_block(); - #if IS_KINEMATIC - private: - - // Allow do_homing_move to access internal functions, such as buffer_segment. - friend void do_homing_move(const AxisEnum, const float, const feedRate_t); - #endif - /** * Planner::buffer_segment * @@ -722,7 +715,11 @@ class Planner { * fr_mm_s - (target) speed of the move * extruder - target extruder * millimeters - the length of the movement, if known + * */ + + TERN_(DELTA, private:) + static bool buffer_segment(const float &a, const float &b, const float &c, const float &e #if HAS_DIST_MM_ARG , const xyze_float_t &cart_dist_mm @@ -730,6 +727,13 @@ class Planner { , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0 ); + + private: + + #if IS_KINEMATIC + friend void do_homing_move(const AxisEnum, const float, const feedRate_t); + #endif + FORCE_INLINE static bool buffer_segment(abce_pos_t &abce #if HAS_DIST_MM_ARG , const xyze_float_t &cart_dist_mm