Added initial/enhanced support for toolsetter and second probe input.

Moved inbuilt G65 macros to the core and added macro G65P5Q<n> for selecting probe.
Added probe id to real time report: |P:<n> will be reported on probe select when more than one probe is available.
Fix for WCO and Ov real time status report elements not beeing reported as they should in some circumstances.
This commit is contained in:
Terje Io
2025-05-15 06:23:17 +02:00
parent fb3f6b6f57
commit 6948b0e117
25 changed files with 453 additions and 172 deletions
+26 -15
View File
@@ -999,27 +999,13 @@ gc_probe_t mc_probe_cycle (float *target, plan_line_data_t *pl_data, gc_parser_f
if (!protocol_buffer_synchronize())
return GCProbe_Abort; // Return if system reset has been issued.
// Initialize probing control variables
sys.flags.probe_succeeded = Off; // Re-initialize probe history before beginning cycle.
hal.probe.configure(parser_flags.probe_is_away, true);
#if COMPATIBILITY_LEVEL <= 1
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_toolsetter)
grbl.on_probe_toolsetter(NULL, NULL, at_g59_3 = system_xy_at_fixture(CoordinateSystem_G59_3, TOOLSETTER_RADIUS), true);
pl_data->condition.probing_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.
// NOTE: This probe initialization error applies to all probing cycles.
probe_state_t probe = hal.probe.get_state();
if (probe.triggered || !probe.connected) { // Check probe state.
system_set_exec_alarm(Alarm_ProbeFailInitial);
protocol_execute_realtime();
hal.probe.configure(false, false); // Re-initialize invert mask before returning.
return GCProbe_FailInit; // Nothing else to do but bail.
}
if(grbl.on_probe_start) {
uint_fast8_t idx = N_AXIS;
@@ -1037,6 +1023,31 @@ gc_probe_t mc_probe_cycle (float *target, plan_line_data_t *pl_data, gc_parser_f
grbl.on_probe_start(axes, target, pl_data);
}
// Initialize probing control variables
sys.flags.probe_succeeded = Off; // Re-initialize probe history before beginning cycle.
hal.probe.configure(parser_flags.probe_is_away, true);
// After syncing, check if probe is already triggered or not connected. If so, halt and issue alarm.
// NOTE: This probe initialization error applies to all probing cycles.
probe_state_t probe = hal.probe.get_state();
if (probe.triggered || !probe.connected) { // Check probe state.
system_set_exec_alarm(Alarm_ProbeFailInitial);
protocol_execute_realtime();
hal.probe.configure(false, false); // Re-initialize invert mask before returning.
#if COMPATIBILITY_LEVEL <= 1
if(probe_toolsetter)
grbl.on_probe_toolsetter(NULL, NULL, at_g59_3, false);
#endif
if(grbl.on_probe_completed)
grbl.on_probe_completed();
return GCProbe_FailInit; // Nothing else to do but bail.
}
// Setup and queue probing motion. Auto cycle-start should not start the cycle.
if(!mc_line(target, pl_data))
return GCProbe_Abort;