Fix for Grbl [issue #1823](https://github.com/grbl/grbl/issues/1823) - some full circle arcs beeing ignored.

This commit is contained in:
Terje Io
2023-02-19 08:20:33 +01:00
parent 2eab779d2f
commit 5b546aef58
3 changed files with 22 additions and 8 deletions

View File

@@ -1,5 +1,19 @@
## grblHAL changelog
<a name="20230218"/>Build 20230218
Core:
Fix for Grbl [issue #1823](https://github.com/grbl/grbl/issues/1823) - some full circle arcs beeing ignored.
Drivers:
* STM32F4xx: added optional support for USART6. Fixed preprossor issue.
* STM32F7xx: Fixed preprossor issue.
---
<a name="20230217"/>20230217, update 2.
Core:

2
grbl.h
View File

@@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20230213
#define GRBL_BUILD 20230218
#define GRBL_URL "https://github.com/grblHAL"

View File

@@ -209,14 +209,14 @@ bool mc_line (float *target, plan_line_data_t *pl_data)
// distance from segment to the circle when the end points both lie on the circle.
void mc_arc (float *target, plan_line_data_t *pl_data, float *position, float *offset, float radius, plane_t plane, int32_t turns)
{
float center_axis0 = position[plane.axis_0] + offset[plane.axis_0];
float center_axis1 = position[plane.axis_1] + offset[plane.axis_1];
float r_axis0 = -offset[plane.axis_0]; // Radius vector from center to current location
float r_axis1 = -offset[plane.axis_1];
float rt_axis0 = target[plane.axis_0] - center_axis0;
float rt_axis1 = target[plane.axis_1] - center_axis1;
double center_axis0 = (double)position[plane.axis_0] + (double)offset[plane.axis_0];
double center_axis1 = (double)position[plane.axis_1] + (double)offset[plane.axis_1];
double r_axis0 = -(double)offset[plane.axis_0]; // Radius vector from center to current location
double r_axis1 = -(double)offset[plane.axis_1];
double rt_axis0 = (double)target[plane.axis_0] - center_axis0;
double rt_axis1 = (double)target[plane.axis_1] - center_axis1;
// CCW angle between position and target from circle center. Only one atan2() trig computation required.
float angular_travel = atan2f(r_axis0 * rt_axis1 - r_axis1 * rt_axis0, r_axis0 * rt_axis0 + r_axis1 * rt_axis1);
float angular_travel = (float)atan2(r_axis0 * rt_axis1 - r_axis1 * rt_axis0, r_axis0 * rt_axis0 + r_axis1 * rt_axis1);
if (turns > 0) { // Correct atan2 output per direction
if (angular_travel >= -ARC_ANGULAR_TRAVEL_EPSILON)