Update motion_control.cpp

G03 Full circle did not work (G02 is working correct)
This commit is contained in:
Aldert 2014-10-04 09:24:09 +02:00
parent cb4a6dd2dc
commit d1e4237e1d

View File

@ -44,6 +44,14 @@ void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8
if (angular_travel < 0) { angular_travel += 2*M_PI; } if (angular_travel < 0) { angular_travel += 2*M_PI; }
if (isclockwise) { angular_travel -= 2*M_PI; } if (isclockwise) { angular_travel -= 2*M_PI; }
//20141002:full circle for G03 did not work, e.g. G03 X80 Y80 I20 J0 F2000 is giving an Angle of zero so head is not moving
//to compensate when start pos = target pos && angle is zero -> angle = 2Pi
if (position[axis_0] == target[axis_0] && position[axis_1] == target[axis_1] && angular_travel == 0)
{
angular_travel += 2*M_PI;
}
//end fix G03
float millimeters_of_travel = hypot(angular_travel*radius, fabs(linear_travel)); float millimeters_of_travel = hypot(angular_travel*radius, fabs(linear_travel));
if (millimeters_of_travel < 0.001) { return; } if (millimeters_of_travel < 0.001) { return; }
uint16_t segments = floor(millimeters_of_travel/MM_PER_ARC_SEGMENT); uint16_t segments = floor(millimeters_of_travel/MM_PER_ARC_SEGMENT);