Merge pull request #6764 from thinkyhead/bf_cleanups_tuesday

Prevent home_all_axes picking up XYZ parameters from command
This commit is contained in:
Scott Lahteine 2017-05-16 19:13:15 -05:00 committed by GitHub
commit 455a24f6ff
8 changed files with 35 additions and 43 deletions

View file

@ -834,7 +834,7 @@
#define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS #define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS
#endif #endif
#endif #endif
// Shorthand // Shorthand
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))

View file

@ -3713,7 +3713,7 @@ inline void gcode_G4() {
* Z Home to the Z endstop * Z Home to the Z endstop
* *
*/ */
inline void gcode_G28() { inline void gcode_G28(const bool always_home_all) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
@ -3760,14 +3760,16 @@ inline void gcode_G28() {
#else // NOT DELTA #else // NOT DELTA
const bool homeX = code_seen('X'), homeY = code_seen('Y'), homeZ = code_seen('Z'), const bool homeX = always_home_all || code_seen('X'),
home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ); homeY = always_home_all || code_seen('Y'),
homeZ = always_home_all || code_seen('Z'),
home_all = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
set_destination_to_current(); set_destination_to_current();
#if Z_HOME_DIR > 0 // If homing away from BED do Z first #if Z_HOME_DIR > 0 // If homing away from BED do Z first
if (home_all_axis || homeZ) { if (home_all || homeZ) {
HOMEAXIS(Z); HOMEAXIS(Z);
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> HOMEAXIS(Z)", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> HOMEAXIS(Z)", current_position);
@ -3776,7 +3778,7 @@ inline void gcode_G28() {
#else #else
if (home_all_axis || homeX || homeY) { if (home_all || homeX || homeY) {
// Raise Z before homing any other axes and z is not already high enough (never lower z) // Raise Z before homing any other axes and z is not already high enough (never lower z)
destination[Z_AXIS] = LOGICAL_Z_POSITION(Z_HOMING_HEIGHT); destination[Z_AXIS] = LOGICAL_Z_POSITION(Z_HOMING_HEIGHT);
if (destination[Z_AXIS] > current_position[Z_AXIS]) { if (destination[Z_AXIS] > current_position[Z_AXIS]) {
@ -3794,14 +3796,14 @@ inline void gcode_G28() {
#if ENABLED(QUICK_HOME) #if ENABLED(QUICK_HOME)
if (home_all_axis || (homeX && homeY)) quick_home_xy(); if (home_all || (homeX && homeY)) quick_home_xy();
#endif #endif
#if ENABLED(HOME_Y_BEFORE_X) #if ENABLED(HOME_Y_BEFORE_X)
// Home Y // Home Y
if (home_all_axis || homeY) { if (home_all || homeY) {
HOMEAXIS(Y); HOMEAXIS(Y);
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
@ -3811,7 +3813,7 @@ inline void gcode_G28() {
#endif #endif
// Home X // Home X
if (home_all_axis || homeX) { if (home_all || homeX) {
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
@ -3844,7 +3846,7 @@ inline void gcode_G28() {
#if DISABLED(HOME_Y_BEFORE_X) #if DISABLED(HOME_Y_BEFORE_X)
// Home Y // Home Y
if (home_all_axis || homeY) { if (home_all || homeY) {
HOMEAXIS(Y); HOMEAXIS(Y);
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
@ -3854,16 +3856,16 @@ inline void gcode_G28() {
// Home Z last if homing towards the bed // Home Z last if homing towards the bed
#if Z_HOME_DIR < 0 #if Z_HOME_DIR < 0
if (home_all_axis || homeZ) { if (home_all || homeZ) {
#if ENABLED(Z_SAFE_HOMING) #if ENABLED(Z_SAFE_HOMING)
home_z_safely(); home_z_safely();
#else #else
HOMEAXIS(Z); HOMEAXIS(Z);
#endif #endif
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> (home_all_axis || homeZ) > final", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> (home_all || homeZ) > final", current_position);
#endif #endif
} // home_all_axis || homeZ } // home_all || homeZ
#endif // Z_HOME_DIR < 0 #endif // Z_HOME_DIR < 0
SYNC_PLAN_POSITION_KINEMATIC(); SYNC_PLAN_POSITION_KINEMATIC();
@ -3895,7 +3897,7 @@ inline void gcode_G28() {
#endif #endif
} // G28 } // G28
void home_all_axes() { gcode_G28(); } void home_all_axes() { gcode_G28(true); }
#if HAS_PROBING_PROCEDURE #if HAS_PROBING_PROCEDURE
@ -9858,7 +9860,7 @@ void process_next_command() {
#endif // NOZZLE_PARK_FEATURE #endif // NOZZLE_PARK_FEATURE
case 28: // G28: Home all axes, one at a time case 28: // G28: Home all axes, one at a time
gcode_G28(); gcode_G28(false);
break; break;
#if HAS_LEVELING #if HAS_LEVELING

View file

@ -922,10 +922,10 @@
// at which point movement will be level to the machine's XY plane. // at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height> // The height can be set with M420 Z<height>
//#define ENABLE_LEVELING_FADE_HEIGHT //#define ENABLE_LEVELING_FADE_HEIGHT
// Set the boundaries for probing (where the probe can reach). // Set the boundaries for probing (where the probe can reach).
#define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

View file

@ -920,10 +920,10 @@
// at which point movement will be level to the machine's XY plane. // at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height> // The height can be set with M420 Z<height>
//#define ENABLE_LEVELING_FADE_HEIGHT //#define ENABLE_LEVELING_FADE_HEIGHT
// Set the boundaries for probing (where the probe can reach). // Set the boundaries for probing (where the probe can reach).
#define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

View file

@ -926,10 +926,10 @@
// at which point movement will be level to the machine's XY plane. // at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height> // The height can be set with M420 Z<height>
//#define ENABLE_LEVELING_FADE_HEIGHT //#define ENABLE_LEVELING_FADE_HEIGHT
// Set the boundaries for probing (where the probe can reach). // Set the boundaries for probing (where the probe can reach).
#define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

View file

@ -989,10 +989,10 @@
// at which point movement will be level to the machine's XY plane. // at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height> // The height can be set with M420 Z<height>
//#define ENABLE_LEVELING_FADE_HEIGHT //#define ENABLE_LEVELING_FADE_HEIGHT
// Set the boundaries for probing (where the probe can reach). // Set the boundaries for probing (where the probe can reach).
#define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10) #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)

View file

@ -322,17 +322,15 @@
// Check for commands that require the printer to be homed. // Check for commands that require the printer to be homed.
if (axis_unhomed_error()) { if (axis_unhomed_error()) {
if (code_seen('J')) if (code_seen('J'))
home_all_axes(); home_all_axes();
else else if (code_seen('P')) {
if (code_seen('P')) { if (code_has_value()) {
int p_val; const int p_val = code_value_int();
if (code_has_value()) { if (p_val == 1 || p_val == 2 || p_val == 4)
p_val = code_value_int(); home_all_axes();
if ( p_val==1 || p_val==2 || p_val==4 )
home_all_axes();
}
} }
}
} }
if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem, if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
@ -1341,15 +1339,7 @@
// Also for round beds, there are grid points outside the bed that nozzle can't reach. // Also for round beds, there are grid points outside the bed that nozzle can't reach.
// Prune them from the list and ignore them till the next Phase (manual nozzle probing). // Prune them from the list and ignore them till the next Phase (manual nozzle probing).
// if ((probe_as_reference && position_is_reachable_by_probe_raw_xy(mx, my)) || position_is_reachable_raw_xy(mx, my)) if ( ! (probe_as_reference ? position_is_reachable_by_probe_raw_xy(mx, my) : position_is_reachable_raw_xy(mx, my)) )
// continue;
//
// THE ABOVE CODE IS NOT A REPLACEMENT FOR THE CODE BELOW!!!!!!!
//
bool reachable = probe_as_reference ?
position_is_reachable_by_probe_raw_xy( mx, my ) :
position_is_reachable_raw_xy( mx, my );
if ( ! reachable )
continue; continue;
// Reachable. Check if it's the closest location to the nozzle. // Reachable. Check if it's the closest location to the nozzle.

View file

@ -632,7 +632,7 @@
z_cxyd = z_cxy1 - z_cxy0; // z height difference along cx from y0 to y1 z_cxyd = z_cxy1 - z_cxy0; // z height difference along cx from y0 to y1
float z_cxym = z_cxyd * (1.0 / (MESH_Y_DIST)); // z slope per y along cx from y0 to y1 float z_cxym = z_cxyd * (1.0 / (MESH_Y_DIST)); // z slope per y along cx from y0 to y1
// float z_cxcy = z_cxy0 + z_cxym * cy; // interpolated mesh z height along cx at cy (do inside the segment loop) // float z_cxcy = z_cxy0 + z_cxym * cy; // interpolated mesh z height along cx at cy (do inside the segment loop)
// As subsequent segments step through this cell, the z_cxy0 intercept will change // As subsequent segments step through this cell, the z_cxy0 intercept will change
@ -649,7 +649,7 @@
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
z_cxcy *= fade_scaling_factor; // apply fade factor to interpolated mesh height z_cxcy *= fade_scaling_factor; // apply fade factor to interpolated mesh height
#endif #endif
z_cxcy += ubl.state.z_offset; // add fixed mesh offset from G29 Z z_cxcy += ubl.state.z_offset; // add fixed mesh offset from G29 Z
if (--segments == 0) { // if this is last segment, use ltarget for exact if (--segments == 0) { // if this is last segment, use ltarget for exact