Code cleanup for G33

This commit is contained in:
Scott Lahteine 2017-06-12 01:25:40 -05:00
parent 570722a0fe
commit 699aa35df6

View file

@ -3529,7 +3529,7 @@ inline void gcode_G4() {
if (leveling_is_active()) { if (leveling_is_active()) {
SERIAL_ECHOLNPGM(" (enabled)"); SERIAL_ECHOLNPGM(" (enabled)");
#if ABL_PLANAR #if ABL_PLANAR
float diff[XYZ] = { const float diff[XYZ] = {
stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS], stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS], stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
stepper.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS] stepper.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]
@ -5094,6 +5094,15 @@ void home_all_axes() { gcode_G28(true); }
* *
* E Engage the probe for each point * E Engage the probe for each point
*/ */
void print_signed_float(const char * const prefix, const float &f) {
SERIAL_PROTOCOLPGM(" ");
serialprintPGM(prefix);
SERIAL_PROTOCOLCHAR(':');
if (f >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(f, 2);
}
inline void gcode_G33() { inline void gcode_G33() {
const int8_t probe_points = parser.seen('P') ? parser.value_int() : DELTA_CALIBRATION_DEFAULT_POINTS; const int8_t probe_points = parser.seen('P') ? parser.value_int() : DELTA_CALIBRATION_DEFAULT_POINTS;
@ -5115,7 +5124,7 @@ void home_all_axes() { gcode_G28(true); }
} }
const bool towers_set = !parser.seen('T'), const bool towers_set = !parser.seen('T'),
stow_after_each = parser.seen('E'), stow_after_each = parser.seen('E') && parser.value_bool(),
_1p_calibration = probe_points == 1, _1p_calibration = probe_points == 1,
_4p_calibration = probe_points == 2, _4p_calibration = probe_points == 2,
_4p_towers_points = _4p_calibration && towers_set, _4p_towers_points = _4p_calibration && towers_set,
@ -5183,25 +5192,16 @@ void home_all_axes() { gcode_G28(true); }
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
if (!_1p_calibration) { if (!_1p_calibration) {
SERIAL_PROTOCOLPGM(" Ex:"); print_signed_float(PSTR(" Ex"), endstop_adj[A_AXIS]);
if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); print_signed_float(PSTR("Ey"), endstop_adj[B_AXIS]);
SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); print_signed_float(PSTR("Ez"), endstop_adj[C_AXIS]);
SERIAL_PROTOCOLPGM(" Ey:");
if (endstop_adj[B_AXIS] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(endstop_adj[B_AXIS], 2);
SERIAL_PROTOCOLPGM(" Ez:");
if (endstop_adj[C_AXIS] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(endstop_adj[C_AXIS], 2);
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
} }
SERIAL_EOL(); SERIAL_EOL();
if (_7p_calibration && towers_set) { if (_7p_calibration && towers_set) {
SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); SERIAL_PROTOCOLPGM(".Tower angle : ");
if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
SERIAL_PROTOCOLPGM(" Ty:");
if (delta_tower_angle_trim[B_AXIS] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(delta_tower_angle_trim[B_AXIS], 2);
SERIAL_PROTOCOLPGM(" Tz:+0.00"); SERIAL_PROTOCOLPGM(" Tz:+0.00");
SERIAL_EOL(); SERIAL_EOL();
} }
@ -5351,19 +5351,12 @@ void home_all_axes() { gcode_G28(true); }
// print report // print report
if (verbose_level != 1) { if (verbose_level != 1) {
SERIAL_PROTOCOLPGM(". c:"); SERIAL_PROTOCOLPGM(". ");
if (z_at_pt[0] > 0) SERIAL_CHAR('+'); print_signed_float(PSTR("c"), z_at_pt[0]);
SERIAL_PROTOCOL_F(z_at_pt[0], 2);
if (_4p_towers_points || _7p_calibration) { if (_4p_towers_points || _7p_calibration) {
SERIAL_PROTOCOLPGM(" x:"); print_signed_float(PSTR(" x"), z_at_pt[1]);
if (z_at_pt[1] >= 0) SERIAL_CHAR('+'); print_signed_float(PSTR(" y"), z_at_pt[5]);
SERIAL_PROTOCOL_F(z_at_pt[1], 2); print_signed_float(PSTR(" z"), z_at_pt[9]);
SERIAL_PROTOCOLPGM(" y:");
if (z_at_pt[5] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(z_at_pt[5], 2);
SERIAL_PROTOCOLPGM(" z:");
if (z_at_pt[9] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(z_at_pt[9], 2);
} }
if (!_4p_opposite_points) SERIAL_EOL(); if (!_4p_opposite_points) SERIAL_EOL();
if ((_4p_opposite_points) || _7p_calibration) { if ((_4p_opposite_points) || _7p_calibration) {
@ -5371,15 +5364,9 @@ void home_all_axes() { gcode_G28(true); }
SERIAL_CHAR('.'); SERIAL_CHAR('.');
SERIAL_PROTOCOL_SP(13); SERIAL_PROTOCOL_SP(13);
} }
SERIAL_PROTOCOLPGM(" yz:"); print_signed_float(PSTR(" yz"), z_at_pt[7]);
if (z_at_pt[7] >= 0) SERIAL_CHAR('+'); print_signed_float(PSTR("zx"), z_at_pt[11]);
SERIAL_PROTOCOL_F(z_at_pt[7], 2); print_signed_float(PSTR("xy"), z_at_pt[3]);
SERIAL_PROTOCOLPGM(" zx:");
if (z_at_pt[11] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(z_at_pt[11], 2);
SERIAL_PROTOCOLPGM(" xy:");
if (z_at_pt[3] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(z_at_pt[3], 2);
SERIAL_EOL(); SERIAL_EOL();
} }
} }
@ -5409,25 +5396,16 @@ void home_all_axes() { gcode_G28(true); }
} }
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
if (!_1p_calibration) { if (!_1p_calibration) {
SERIAL_PROTOCOLPGM(" Ex:"); print_signed_float(PSTR(" Ex"), endstop_adj[A_AXIS]);
if (endstop_adj[A_AXIS] >= 0) SERIAL_CHAR('+'); print_signed_float(PSTR("Ey"), endstop_adj[B_AXIS]);
SERIAL_PROTOCOL_F(endstop_adj[A_AXIS], 2); print_signed_float(PSTR("Ez"), endstop_adj[C_AXIS]);
SERIAL_PROTOCOLPGM(" Ey:");
if (endstop_adj[B_AXIS] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(endstop_adj[B_AXIS], 2);
SERIAL_PROTOCOLPGM(" Ez:");
if (endstop_adj[C_AXIS] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(endstop_adj[C_AXIS], 2);
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
} }
SERIAL_EOL(); SERIAL_EOL();
if (_7p_calibration && towers_set) { if (_7p_calibration && towers_set) {
SERIAL_PROTOCOLPGM(".Tower angle : Tx:"); SERIAL_PROTOCOLPGM(".Tower angle : ");
if (delta_tower_angle_trim[A_AXIS] >= 0) SERIAL_CHAR('+'); print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
SERIAL_PROTOCOL_F(delta_tower_angle_trim[A_AXIS], 2); print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
SERIAL_PROTOCOLPGM(" Ty:");
if (delta_tower_angle_trim[B_AXIS] >= 0) SERIAL_CHAR('+');
SERIAL_PROTOCOL_F(delta_tower_angle_trim[B_AXIS], 2);
SERIAL_PROTOCOLPGM(" Tz:+0.00"); SERIAL_PROTOCOLPGM(" Tz:+0.00");
SERIAL_EOL(); SERIAL_EOL();
} }