Merge pull request #4303 from AnHardt/delta-g28

DELTA: Move out of the clip-zone after G28
This commit is contained in:
Scott Lahteine 2016-07-15 20:20:22 -07:00 committed by GitHub
commit 59ae1811c2
2 changed files with 26 additions and 0 deletions

View file

@ -301,6 +301,7 @@ float code_value_temp_diff();
extern float delta_diagonal_rod_trim_tower_3;
void calculate_delta(float cartesian[3]);
void recalc_delta_settings(float radius, float diagonal_rod);
float delta_safe_distance_from_top();
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
extern int delta_grid_spacing[2];
void adjust_delta(float cartesian[3]);

View file

@ -322,6 +322,9 @@ float home_offset[3] = { 0 };
// Software Endstops. Default to configured limits.
float sw_endstop_min[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
float sw_endstop_max[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
#if ENABLED(DELTA)
float delta_clip_start_height = Z_MAX_POS;
#endif
#if FAN_COUNT > 0
int fanSpeeds[FAN_COUNT] = { 0 };
@ -1441,6 +1444,7 @@ static void update_software_endstops(AxisEnum axis) {
sw_endstop_min[axis] = base_min_pos(axis) + offs;
sw_endstop_max[axis] = base_max_pos(axis) + offs;
}
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("For ", axis_codes[axis]);
@ -1451,6 +1455,13 @@ static void update_software_endstops(AxisEnum axis) {
SERIAL_EOL;
}
#endif
#if ENABLED(DELTA)
if (axis == Z_AXIS) {
delta_clip_start_height = sw_endstop_max[axis] - delta_safe_distance_from_top();
}
#endif
}
/**
@ -3101,6 +3112,11 @@ inline void gcode_G28() {
}
#endif
#if ENABLED(DELTA)
// move to a height where we can use the full xy-area
do_blocking_move_to_z(delta_clip_start_height);
#endif
clean_up_after_endstop_or_probe_move();
#if ENABLED(DEBUG_LEVELING_FEATURE)
@ -7541,6 +7557,15 @@ void clamp_to_software_endstops(float target[3]) {
*/
}
float delta_safe_distance_from_top() {
float cartesian[3] = { 0 };
calculate_delta(cartesian);
float distance = delta[TOWER_3];
cartesian[Y_AXIS] = DELTA_PRINTABLE_RADIUS;
calculate_delta(cartesian);
return abs(distance - delta[TOWER_3]);
}
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
// Adjust print surface height by linear interpolation over the bed_level array.