mirror of
https://github.com/grblHAL/core.git
synced 2026-02-06 09:02:33 +08:00
Renamed grbl.on_probe_fixture event to grbl.on_probe_toolsetter and added pointer to toolsetter coordinates as an additional parameter.
Increased backlash parameters precision to 5 decimals. Ref issue #452. Some bug fixes in NGC parameters and flow control handling.
This commit is contained in:
@@ -13,7 +13,7 @@ It has been written to complement grblHAL and has features such as proper keyboa
|
||||
|
||||
---
|
||||
|
||||
Latest build date is 20240604, see the [changelog](changelog.md) for details.
|
||||
Latest build date is 20240619, see the [changelog](changelog.md) for details.
|
||||
|
||||
__NOTE:__ Build 20240222 has moved the probe input to the ioPorts pool of inputs and will be allocated from it when configured.
|
||||
The change is major and _potentially dangerous_, it may damage your probe, so please _verify correct operation_ after installing this, or later, builds.
|
||||
|
||||
24
changelog.md
24
changelog.md
@@ -1,5 +1,29 @@
|
||||
## grblHAL changelog
|
||||
|
||||
<a name="20240619"/>Build 20240619
|
||||
|
||||
Core:
|
||||
|
||||
* Renamed `grbl.on_probe_fixture` event to `grbl.on_probe_toolsetter` and added pointer to toolsetter coordinates as an additional parameter.
|
||||
This will allow plugin code to modify the coordinates before moving to the toolsetter so that tools with off center cutting surfaces can be properly measured.
|
||||
Ref. [ioSender issue #386](https://github.com/terjeio/ioSender/issues/386).
|
||||
|
||||
* Increased backlash parameters precision to 5 decimals. Ref [issue #452](https://github.com/grblHAL/core/issues/452#issuecomment-2159050856).
|
||||
|
||||
* Some bug fixes in NGC parameters and flow control handling.
|
||||
|
||||
Drivers:
|
||||
|
||||
* ESP32: improved SPI code.
|
||||
|
||||
* SAM3X8E: added support for native and MCP3221 I2C ADCs. Ref [issue #24](https://github.com/grblHAL/SAM3X8E/issues/24).
|
||||
|
||||
Plugins:
|
||||
|
||||
* Templates: Updated some for core event rename and signature change.
|
||||
|
||||
---
|
||||
|
||||
<a name="20240604"/>Build 20240604
|
||||
|
||||
Core:
|
||||
|
||||
4
config.h
4
config.h
@@ -486,11 +486,11 @@ non-volatile storage until the controller is in IDLE state.
|
||||
|
||||
/*! \def TOOLSETTER_RADIUS
|
||||
\brief
|
||||
The grbl.on_probe_fixture event handler is called by the default tool change algorithm when probing at G59.3.
|
||||
The grbl.on_probe_toolsetter event handler is called by the default tool change algorithm when probing at G59.3.
|
||||
In addition it will be called on a "normal" probe sequence if the XY position is
|
||||
within the radius of the G59.3 position defined below.
|
||||
Change if the default value of 5mm is not suitable or set it to 0.0f to disable.
|
||||
<br>__NOTE:__ A grbl.on_probe_fixture event handler is not installed by the core, it has to be provided
|
||||
<br>__NOTE:__ A grbl.on_probe_toolsetter event handler is not installed by the core, it has to be provided
|
||||
by a driver or a plugin.
|
||||
*/
|
||||
#if !defined TOOLSETTER_RADIUS || defined __DOXYGEN__
|
||||
|
||||
@@ -107,7 +107,7 @@ typedef void (*on_homing_rate_set_ptr)(axes_signals_t axes, float rate, homing_m
|
||||
// NOTE: cycle contains the axis flags of the executed homing cycle, success will be true when all the configured cycles are completed.
|
||||
typedef void (*on_homing_completed_ptr)(axes_signals_t cycle, bool success);
|
||||
|
||||
typedef bool (*on_probe_fixture_ptr)(tool_data_t *tool, bool at_g59_3, bool on);
|
||||
typedef bool (*on_probe_toolsetter_ptr)(tool_data_t *tool, coord_data_t *position, bool at_g59_3, bool on);
|
||||
typedef bool (*on_probe_start_ptr)(axes_signals_t axes, float *target, plan_line_data_t *pl_data);
|
||||
typedef void (*on_probe_completed_ptr)(void);
|
||||
typedef void (*on_tool_selected_ptr)(tool_data_t *tool);
|
||||
@@ -172,7 +172,7 @@ typedef struct {
|
||||
on_stream_changed_ptr on_stream_changed;
|
||||
on_homing_rate_set_ptr on_homing_rate_set;
|
||||
on_homing_completed_ptr on_homing_completed;
|
||||
on_probe_fixture_ptr on_probe_fixture;
|
||||
on_probe_toolsetter_ptr on_probe_toolsetter;
|
||||
on_probe_start_ptr on_probe_start;
|
||||
on_probe_completed_ptr on_probe_completed;
|
||||
on_set_axis_setting_unit_ptr on_set_axis_setting_unit;
|
||||
|
||||
2
grbl.h
2
grbl.h
@@ -42,7 +42,7 @@
|
||||
#else
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#endif
|
||||
#define GRBL_BUILD 20240604
|
||||
#define GRBL_BUILD 20240619
|
||||
|
||||
#define GRBL_URL "https://github.com/grblHAL"
|
||||
|
||||
|
||||
@@ -992,10 +992,10 @@ gc_probe_t mc_probe_cycle (float *target, plan_line_data_t *pl_data, gc_parser_f
|
||||
hal.probe.configure(parser_flags.probe_is_away, true);
|
||||
|
||||
#if COMPATIBILITY_LEVEL <= 1
|
||||
bool at_g59_3 = false, probe_fixture = grbl.on_probe_fixture != NULL && state_get() != STATE_TOOL_CHANGE && (sys.homed.mask & (X_AXIS_BIT|Y_AXIS_BIT));
|
||||
bool at_g59_3 = false, probe_toolsetter = grbl.on_probe_toolsetter != NULL && state_get() != STATE_TOOL_CHANGE && (sys.homed.mask & (X_AXIS_BIT|Y_AXIS_BIT));
|
||||
|
||||
if(probe_fixture)
|
||||
grbl.on_probe_fixture(NULL, at_g59_3 = system_xy_at_fixture(CoordinateSystem_G59_3, TOOLSETTER_RADIUS), true);
|
||||
if(probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(NULL, NULL, at_g59_3 = system_xy_at_fixture(CoordinateSystem_G59_3, TOOLSETTER_RADIUS), true);
|
||||
#endif
|
||||
|
||||
// After syncing, check if probe is already triggered or not connected. If so, halt and issue alarm.
|
||||
@@ -1054,8 +1054,8 @@ gc_probe_t mc_probe_cycle (float *target, plan_line_data_t *pl_data, gc_parser_f
|
||||
protocol_execute_realtime(); // Check and execute run-time commands
|
||||
|
||||
#if COMPATIBILITY_LEVEL <= 1
|
||||
if(probe_fixture)
|
||||
grbl.on_probe_fixture(NULL, at_g59_3, false);
|
||||
if(probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(NULL, NULL, at_g59_3, false);
|
||||
#endif
|
||||
|
||||
// Reset the stepper and planner buffers to remove the remainder of the probe motion.
|
||||
|
||||
@@ -156,7 +156,7 @@ static status_code_t read_command (char *line, uint_fast8_t *pos, ngc_cmd_t *ope
|
||||
*operation = NGCFlowCtrl_If;
|
||||
(*pos)++;
|
||||
} else
|
||||
*operation = Status_FlowControlSyntaxError; // Unknown statement name starting with F
|
||||
status = Status_FlowControlSyntaxError; // Unknown statement name starting with F
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
@@ -167,7 +167,7 @@ static status_code_t read_command (char *line, uint_fast8_t *pos, ngc_cmd_t *ope
|
||||
*operation = NGCFlowCtrl_Return;
|
||||
*pos += 5;
|
||||
} else
|
||||
*operation = Status_FlowControlSyntaxError; // Unknown statement name starting with R
|
||||
status = Status_FlowControlSyntaxError; // Unknown statement name starting with R
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
@@ -531,7 +531,7 @@ status_code_t ngc_flowctrl (uint32_t o_label, char *line, uint_fast8_t *pos, boo
|
||||
status = Status_FlowControlSyntaxError;
|
||||
else {
|
||||
|
||||
float params[29];
|
||||
float params[30];
|
||||
ngc_param_id_t param_id = 1;
|
||||
|
||||
while(line[*pos] && status == Status_OK && param_id <= 30) {
|
||||
|
||||
@@ -569,7 +569,7 @@ PROGMEM static const setting_detail_t setting_detail[] = {
|
||||
{ Setting_AxisAcceleration, Group_Axis0, "-axis acceleration", axis_accel, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacyFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
|
||||
{ Setting_AxisMaxTravel, Group_Axis0, "-axis maximum travel", axis_dist, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacyFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
|
||||
#if ENABLE_BACKLASH_COMPENSATION
|
||||
{ Setting_AxisBacklash, Group_Axis0, "-axis backlash compensation", axis_dist, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsExtendedFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
|
||||
{ Setting_AxisBacklash, Group_Axis0, "-axis backlash compensation", axis_dist, Format_Decimal, "#####0.000##", NULL, NULL, Setting_IsExtendedFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
|
||||
#endif
|
||||
{ Setting_AxisAutoSquareOffset, Group_Axis0, "-axis dual axis offset", "mm", Format_Decimal, "-0.000", "-10", "10", Setting_IsExtendedFn, set_axis_setting, get_float, is_setting_available, AXIS_OPTS },
|
||||
{ Setting_SpindleAtSpeedTolerance, Group_Spindle, "Spindle at speed tolerance", "percent", Format_Decimal, "##0.0", NULL, NULL, Setting_IsExtended, &settings.spindle.at_speed_tolerance, NULL, is_setting_available },
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#define TOOL_CHANGE_PROBE_RETRACT_DISTANCE 2.0f
|
||||
#endif
|
||||
|
||||
static bool block_cycle_start, probe_fixture;
|
||||
static bool block_cycle_start, probe_toolsetter;
|
||||
static volatile bool execute_posted = false;
|
||||
static volatile uint32_t spin_lock = 0;
|
||||
static float tool_change_position;
|
||||
@@ -89,11 +89,11 @@ static void change_completed (void)
|
||||
hal.irq_enable();
|
||||
}
|
||||
|
||||
if(probe_fixture)
|
||||
grbl.on_probe_fixture(¤t_tool, true, false);
|
||||
if(probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(¤t_tool, NULL, true, false);
|
||||
|
||||
grbl.on_probe_completed = NULL;
|
||||
gc_state.tool_change = probe_fixture = false;
|
||||
gc_state.tool_change = probe_toolsetter = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,9 +190,6 @@ static void execute_probe (void *data)
|
||||
plan_line_data_t plan_data;
|
||||
gc_parser_flags_t flags = {0};
|
||||
|
||||
if(probe_fixture)
|
||||
grbl.on_probe_fixture(next_tool, true, true);
|
||||
|
||||
// G59.3 contains offsets to position of TLS.
|
||||
settings_read_coord_data(CoordinateSystem_G59_3, &offset.values);
|
||||
|
||||
@@ -202,11 +199,17 @@ static void execute_probe (void *data)
|
||||
target.values[plane.axis_0] = offset.values[plane.axis_0];
|
||||
target.values[plane.axis_1] = offset.values[plane.axis_1];
|
||||
|
||||
if(probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(next_tool, &target, false, true);
|
||||
|
||||
if((ok = mc_line(target.values, &plan_data))) {
|
||||
|
||||
target.values[plane.axis_linear] = offset.values[plane.axis_linear];
|
||||
ok = mc_line(target.values, &plan_data);
|
||||
|
||||
if(ok && probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(next_tool, NULL, true, true);
|
||||
|
||||
plan_data.feed_rate = settings.tool_change.seek_rate;
|
||||
plan_data.condition.value = 0;
|
||||
plan_data.spindle.state.value = 0;
|
||||
@@ -350,10 +353,10 @@ static status_code_t tool_change (parser_state_t *parser_state)
|
||||
hal.coolant.set_state((coolant_state_t){0});
|
||||
|
||||
execute_posted = false;
|
||||
probe_fixture = grbl.on_probe_fixture != NULL &&
|
||||
(settings.tool_change.mode == ToolChange_Manual ||
|
||||
settings.tool_change.mode == ToolChange_Manual_G59_3 ||
|
||||
settings.tool_change.mode == ToolChange_SemiAutomatic);
|
||||
probe_toolsetter = grbl.on_probe_toolsetter != NULL &&
|
||||
(settings.tool_change.mode == ToolChange_Manual ||
|
||||
settings.tool_change.mode == ToolChange_Manual_G59_3 ||
|
||||
settings.tool_change.mode == ToolChange_SemiAutomatic);
|
||||
|
||||
// Save current position.
|
||||
system_convert_array_steps_to_mpos(previous.values, sys.position);
|
||||
@@ -389,12 +392,19 @@ static status_code_t tool_change (parser_state_t *parser_state)
|
||||
float tmp_pos = target.values[plane.axis_linear];
|
||||
|
||||
target.values[plane.axis_linear] = tool_change_position;
|
||||
|
||||
if(probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(next_tool, &target, false, true);
|
||||
|
||||
if(!mc_line(target.values, &plan_data))
|
||||
return Status_Reset;
|
||||
|
||||
target.values[plane.axis_linear] = tmp_pos;
|
||||
if(!mc_line(target.values, &plan_data))
|
||||
return Status_Reset;
|
||||
|
||||
if(probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(next_tool, NULL, true, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -463,8 +473,8 @@ status_code_t tc_probe_workpiece (void)
|
||||
plan_line_data_t plan_data;
|
||||
|
||||
#if COMPATIBILITY_LEVEL <= 1
|
||||
if(probe_fixture)
|
||||
grbl.on_probe_fixture(next_tool, system_xy_at_fixture(CoordinateSystem_G59_3, TOOLSETTER_RADIUS), true);
|
||||
if(probe_toolsetter)
|
||||
grbl.on_probe_toolsetter(next_tool, NULL, system_xy_at_fixture(CoordinateSystem_G59_3, TOOLSETTER_RADIUS), true);
|
||||
#endif
|
||||
|
||||
// Get current position.
|
||||
|
||||
Reference in New Issue
Block a user