This commit is contained in:
NhanPham 2020-11-11 00:54:21 -04:00 committed by GitHub
commit 6ba1eaf894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 12 deletions

View file

@ -130,7 +130,6 @@
#ifndef MOTHERBOARD #ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_RAMPS_14_EFB #define MOTHERBOARD BOARD_RAMPS_14_EFB
#endif #endif
// Name displayed in the LCD "Ready" message and Info menu // Name displayed in the LCD "Ready" message and Info menu
//#define CUSTOM_MACHINE_NAME "3D Printer" //#define CUSTOM_MACHINE_NAME "3D Printer"
@ -795,7 +794,7 @@
* When changing speed and direction, if the difference is less than the * When changing speed and direction, if the difference is less than the
* value set here, it may happen instantaneously. * value set here, it may happen instantaneously.
*/ */
//#define CLASSIC_JERK #define CLASSIC_JERK
#if ENABLED(CLASSIC_JERK) #if ENABLED(CLASSIC_JERK)
#define DEFAULT_XJERK 10.0 #define DEFAULT_XJERK 10.0
#define DEFAULT_YJERK 10.0 #define DEFAULT_YJERK 10.0

View file

@ -62,11 +62,44 @@
#include "../../core/debug_out.h" #include "../../core/debug_out.h"
#if ENABLED(QUICK_HOME) #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() { static void quick_home_xy() {
// Pretend the current position is 0,0 // 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(); sync_plan_position();
const int x_axis_home_dir = x_home_dir(active_extruder); const int x_axis_home_dir = x_home_dir(active_extruder);
@ -109,7 +142,7 @@
#endif #endif
#endif #endif
} }
#endif
#endif // QUICK_HOME #endif // QUICK_HOME
#if ENABLED(Z_SAFE_HOMING) #if ENABLED(Z_SAFE_HOMING)

View file

@ -138,6 +138,7 @@ class Endstops {
#if ENABLED(VALIDATE_HOMING_ENDSTOPS) #if ENABLED(VALIDATE_HOMING_ENDSTOPS)
// If the last move failed to trigger an endstop, call kill // If the last move failed to trigger an endstop, call kill
static void validate_homing_move(); static void validate_homing_move();
FORCE_INLINE static bool any() { return trigger_state() != 0; }
#else #else
FORCE_INLINE static void validate_homing_move() { hit_on_purpose(); } FORCE_INLINE static void validate_homing_move() { hit_on_purpose(); }
#endif #endif

View file

@ -704,13 +704,6 @@ class Planner {
*/ */
static void buffer_sync_block(); 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 * Planner::buffer_segment
* *
@ -722,7 +715,11 @@ class Planner {
* fr_mm_s - (target) speed of the move * fr_mm_s - (target) speed of the move
* extruder - target extruder * extruder - target extruder
* millimeters - the length of the movement, if known * 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 static bool buffer_segment(const float &a, const float &b, const float &c, const float &e
#if HAS_DIST_MM_ARG #if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm , 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 , 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 FORCE_INLINE static bool buffer_segment(abce_pos_t &abce
#if HAS_DIST_MM_ARG #if HAS_DIST_MM_ARG
, const xyze_float_t &cart_dist_mm , const xyze_float_t &cart_dist_mm