Merge upstream changes

from https://github.com/MarlinFirmware/Marlin/tree/bugfix-1.1.x
This commit is contained in:
David Ramiro
2019-01-28 23:30:14 +01:00
parent b3af9708e9
commit f01ee75004
75 changed files with 420 additions and 177 deletions

View File

@@ -1387,7 +1387,11 @@ bool get_target_extruder_from_command(const uint16_t code) {
}
#elif ENABLED(DELTA)
soft_endstop_min[axis] = base_min_pos(axis);
soft_endstop_max[axis] = axis == Z_AXIS ? delta_height : base_max_pos(axis);
soft_endstop_max[axis] = axis == Z_AXIS ? delta_height
#if HAS_BED_PROBE
- zprobe_zoffset
#endif
: base_max_pos(axis);
#else
soft_endstop_min[axis] = base_min_pos(axis);
soft_endstop_max[axis] = base_max_pos(axis);
@@ -1516,13 +1520,14 @@ static void set_axis_is_at_home(const AxisEnum axis) {
}
else
#elif ENABLED(DELTA)
if (axis == Z_AXIS)
current_position[axis] = delta_height;
else
#endif
{
current_position[axis] = (axis == Z_AXIS ? delta_height
#if HAS_BED_PROBE
- zprobe_zoffset
#endif
: base_home_pos(axis));
#else
current_position[axis] = base_home_pos(axis);
}
#endif
/**
* Z Probe Z Homing? Account for the probe's Z offset.
@@ -4066,7 +4071,11 @@ inline void gcode_G4() {
#endif
// Move all carriages together linearly until an endstop is hit.
current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (delta_height + 10);
current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (delta_height + 10
#if HAS_BED_PROBE
- zprobe_zoffset
#endif
);
feedrate_mm_s = homing_feedrate(X_AXIS);
buffer_line_to_current_position();
planner.synchronize();
@@ -4595,7 +4604,8 @@ void home_all_axes() { gcode_G28(true); }
if (parser.seenval('X')) {
px = parser.value_int() - 1;
if (!WITHIN(px, 0, GRID_MAX_POINTS_X - 1)) {
SERIAL_PROTOCOLLNPGM("X out of range (1-" STRINGIFY(GRID_MAX_POINTS_X) ").");
SERIAL_PROTOCOLPAIR("X out of range (1-", int(GRID_MAX_POINTS_X));
SERIAL_PROTOCOLLNPGM(")");
return;
}
}
@@ -4607,7 +4617,8 @@ void home_all_axes() { gcode_G28(true); }
if (parser.seenval('Y')) {
py = parser.value_int() - 1;
if (!WITHIN(py, 0, GRID_MAX_POINTS_Y - 1)) {
SERIAL_PROTOCOLLNPGM("Y out of range (1-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
SERIAL_PROTOCOLPAIR("Y out of range (1-", int(GRID_MAX_POINTS_Y));
SERIAL_PROTOCOLLNPGM(")");
return;
}
}
@@ -5752,12 +5763,6 @@ void home_all_axes() { gcode_G28(true); }
if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
}
#if HAS_BED_PROBE
if (!end_stops && !tower_angles) {
SERIAL_PROTOCOL_SP(30);
print_signed_float(PSTR("Offset"), zprobe_zoffset);
}
#endif
SERIAL_EOL();
}
@@ -5806,30 +5811,19 @@ void home_all_axes() { gcode_G28(true); }
/**
* - Probe a point
*/
static float calibration_probe(const float &nx, const float &ny, const bool stow, const bool set_up) {
static float calibration_probe(const float &nx, const float &ny, const bool stow) {
#if HAS_BED_PROBE
return probe_pt(nx, ny, set_up ? PROBE_PT_BIG_RAISE : stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
#else
UNUSED(stow);
UNUSED(set_up);
return lcd_probe_pt(nx, ny);
#endif
}
#if HAS_BED_PROBE && ENABLED(ULTIPANEL)
static float probe_z_shift(const float center) {
STOW_PROBE();
endstops.enable_z_probe(false);
float z_shift = lcd_probe_pt(0, 0) - center;
endstops.enable_z_probe(true);
return z_shift;
}
#endif
/**
* - Probe a grid
*/
static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each, const bool set_up) {
static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each) {
const bool _0p_calibration = probe_points == 0,
_1p_calibration = probe_points == 1 || probe_points == -1,
_4p_calibration = probe_points == 2,
@@ -5852,7 +5846,7 @@ void home_all_axes() { gcode_G28(true); }
if (!_0p_calibration) {
if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
z_pt[CEN] += calibration_probe(0, 0, stow_after_each, set_up);
z_pt[CEN] += calibration_probe(0, 0, stow_after_each);
if (isnan(z_pt[CEN])) return false;
}
@@ -5862,7 +5856,7 @@ void home_all_axes() { gcode_G28(true); }
I_LOOP_CAL_PT(rad, start, steps) {
const float a = RADIANS(210 + (360 / NPP) * (rad - 1)),
r = delta_calibration_radius * 0.1;
z_pt[CEN] += calibration_probe(cos(a) * r, sin(a) * r, stow_after_each, set_up);
z_pt[CEN] += calibration_probe(cos(a) * r, sin(a) * r, stow_after_each);
if (isnan(z_pt[CEN])) return false;
}
z_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
@@ -5886,7 +5880,7 @@ void home_all_axes() { gcode_G28(true); }
const float a = RADIANS(210 + (360 / NPP) * (rad - 1)),
r = delta_calibration_radius * (1 - 0.1 * (zig_zag ? offset - circle : circle)),
interpol = fmod(rad, 1);
const float z_temp = calibration_probe(cos(a) * r, sin(a) * r, stow_after_each, set_up);
const float z_temp = calibration_probe(cos(a) * r, sin(a) * r, stow_after_each);
if (isnan(z_temp)) return false;
// split probe point to neighbouring calibration points
z_pt[uint8_t(LROUND(rad - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90)));
@@ -6015,10 +6009,7 @@ void home_all_axes() { gcode_G28(true); }
*
* Parameters:
*
* S Setup mode; disables probe protection
*
* Pn Number of probe points:
* P-1 Checks the z_offset with a center probe and paper test.
* P0 Normalizes calibration.
* P1 Calibrates height only with center probe.
* P2 Probe center and towers. Calibrate height, endstops and delta radius.
@@ -6041,22 +6032,15 @@ void home_all_axes() { gcode_G28(true); }
*/
inline void gcode_G33() {
const bool set_up =
#if HAS_BED_PROBE
parser.seen('S');
#else
false;
#endif
const int8_t probe_points = set_up ? 2 : parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
if (!WITHIN(probe_points, -1, 10)) {
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (-1 - 10).");
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
if (!WITHIN(probe_points, 0, 10)) {
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (0-10).");
return;
}
const bool towers_set = !parser.seen('T');
const float calibration_precision = set_up ? Z_CLEARANCE_BETWEEN_PROBES / 5.0 : parser.floatval('C', 0.0);
const float calibration_precision = parser.floatval('C', 0.0);
if (calibration_precision < 0) {
SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0).");
return;
@@ -6064,26 +6048,18 @@ void home_all_axes() { gcode_G28(true); }
const int8_t force_iterations = parser.intval('F', 0);
if (!WITHIN(force_iterations, 0, 30)) {
SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0 - 30).");
SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0-30).");
return;
}
const int8_t verbose_level = parser.byteval('V', 1);
if (!WITHIN(verbose_level, 0, 3)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0 - 3).");
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-3).");
return;
}
const bool stow_after_each = parser.seen('E');
if (set_up) {
delta_height = 999.99;
delta_radius = DELTA_PRINTABLE_RADIUS;
ZERO(delta_endstop_adj);
ZERO(delta_tower_angle_trim);
recalc_delta_settings();
}
const bool _0p_calibration = probe_points == 0,
_1p_calibration = probe_points == 1 || probe_points == -1,
_4p_calibration = probe_points == 2,
@@ -6132,7 +6108,6 @@ void home_all_axes() { gcode_G28(true); }
const char *checkingac = PSTR("Checking... AC");
serialprintPGM(checkingac);
if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
if (set_up) SERIAL_PROTOCOLPGM(" (SET-UP)");
SERIAL_EOL();
lcd_setstatusPGM(checkingac);
@@ -6151,7 +6126,7 @@ void home_all_axes() { gcode_G28(true); }
// Probe the points
zero_std_dev_old = zero_std_dev;
if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, set_up)) {
if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each)) {
SERIAL_PROTOCOLLNPGM("Correct delta settings with M665 and M666");
return AC_CLEANUP();
}
@@ -6199,11 +6174,6 @@ void home_all_axes() { gcode_G28(true); }
delta_calibration_radius = cr_old;
switch (probe_points) {
case -1:
#if HAS_BED_PROBE && ENABLED(ULTIPANEL)
zprobe_zoffset += probe_z_shift(z_at_pt[CEN]);
#endif
case 0:
test_precision = 0.00; // forced end
break;