Fix G2/G3 workspace plane parameters (#15475)

2.0.x
Scott Lahteine 5 years ago committed by GitHub
parent 19b7be067c
commit e84389c976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -59,8 +59,8 @@ void plan_arc(
switch (gcode.workspace_plane) { switch (gcode.workspace_plane) {
default: default:
case GcodeSuite::PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break; case GcodeSuite::PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break;
case GcodeSuite::PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break;
case GcodeSuite::PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break; case GcodeSuite::PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break;
case GcodeSuite::PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break;
} }
#else #else
constexpr AxisEnum p_axis = X_AXIS, q_axis = Y_AXIS, l_axis = Z_AXIS; constexpr AxisEnum p_axis = X_AXIS, q_axis = Y_AXIS, l_axis = Z_AXIS;
@ -242,19 +242,20 @@ void plan_arc(
* G2: Clockwise Arc * G2: Clockwise Arc
* G3: Counterclockwise Arc * G3: Counterclockwise Arc
* *
* This command has two forms: IJ-form and R-form. * This command has two forms: IJ-form (JK, KI) and R-form.
* *
* - I specifies an X offset. J specifies a Y offset. * - Depending on the current Workspace Plane orientation,
* At least one of the IJ parameters is required. * use parameters IJ/JK/KI to specify the XY/YZ/ZX offsets.
* X and Y can be omitted to do a complete circle. * At least one of the IJ/JK/KI parameters is required.
* The given XY is not error-checked. The arc ends * XY/YZ/ZX can be omitted to do a complete circle.
* The given XY/YZ/ZX is not error-checked. The arc ends
* based on the angle of the destination. * based on the angle of the destination.
* Mixing I or J with R will throw an error. * Mixing IJ/JK/KI with R will throw an error.
* *
* - R specifies the radius. X or Y is required. * - R specifies the radius. X or Y (Y or Z / Z or X) is required.
* Omitting both X and Y will throw an error. * Omitting both XY/YZ/ZX will throw an error.
* X or Y must differ from the current XY. * XY/YZ/ZX must differ from the current XY/YZ/ZX.
* Mixing R with I or J will throw an error. * Mixing R with IJ/JK/KI will throw an error.
* *
* - P specifies the number of full circles to do * - P specifies the number of full circles to do
* before the specified arc move. * before the specified arc move.
@ -294,8 +295,19 @@ void GcodeSuite::G2_G3(const bool clockwise) {
} }
} }
else { else {
if (parser.seenval('I')) arc_offset.a = parser.value_linear_units(); #if ENABLED(CNC_WORKSPACE_PLANES)
if (parser.seenval('J')) arc_offset.b = parser.value_linear_units(); char achar, bchar;
switch (gcode.workspace_plane) {
default:
case GcodeSuite::PLANE_XY: achar = 'I'; bchar = 'J'; break;
case GcodeSuite::PLANE_YZ: achar = 'J'; bchar = 'K'; break;
case GcodeSuite::PLANE_ZX: achar = 'K'; bchar = 'I'; break;
}
#else
constexpr char achar = 'I', bchar = 'J';
#endif
if (parser.seenval(achar)) arc_offset.a = parser.value_linear_units();
if (parser.seenval(bchar)) arc_offset.b = parser.value_linear_units();
} }
if (arc_offset) { if (arc_offset) {

Loading…
Cancel
Save