diff --git a/settings.c b/settings.c index f0270cd..9dc67bb 100644 --- a/settings.c +++ b/settings.c @@ -1007,7 +1007,7 @@ static status_code_t set_tool_change_mode (setting_id_t id, uint_fast16_t int_va { if(!hal.driver_cap.atc && hal.stream.suspend_read && int_value <= ToolChange_Ignore) { #if COMPATIBILITY_LEVEL > 1 - if((toolchange_mode_t)int_value == ToolChange_Manual_G59_3 || (toolchange_mode_t)int_value == ToolChange_SemiAutomatic) + if((toolchange_mode_t)int_value == ToolChange_Manual_G59_3 || (toolchange_mode_t)int_value == ToolChange_SemiAutomatic) || (toolchange_mode_t)int_value == FastToolChange_SemiAutomatic) return Status_InvalidStatement; #endif settings.tool_change.mode = (toolchange_mode_t)int_value; @@ -2094,12 +2094,12 @@ PROGMEM static const setting_detail_t setting_detail[] = { { Setting_AxisHomingFeedRate, Group_Axis0, "-axis homing locate feed rate", axis_rate, Format_Decimal, "###0", NULL, NULL, Setting_NonCoreFn, set_axis_setting, get_float, is_setting_available, AXIS_OPTS }, { Setting_AxisHomingSeekRate, Group_Axis0, "-axis homing search seek rate", axis_rate, Format_Decimal, "###0", NULL, NULL, Setting_NonCoreFn, 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_IsExtendedFn, set_float, get_float, is_setting_available }, - { Setting_ToolChangeMode, Group_Toolchange, "Tool change mode", NULL, Format_RadioButtons, "Normal,Manual touch off,Manual touch off @ G59.3,Automatic touch off @ G59.3,Ignore M6", NULL, NULL, Setting_IsExtendedFn, set_tool_change_mode, get_int, is_setting_available }, - { Setting_ToolChangeProbingDistance, Group_Toolchange, "Tool change probing distance", "mm", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtendedFn, set_tool_change_probing_distance, get_float, is_setting_available }, - { Setting_ToolChangeFeedRate, Group_Toolchange, "Tool change locate feed rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.feed_rate, NULL, is_setting_available }, - { Setting_ToolChangeSeekRate, Group_Toolchange, "Tool change search seek rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.seek_rate, NULL, is_setting_available }, - { Setting_ToolChangePulloffRate, Group_Toolchange, "Tool change probe pull-off rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.pulloff_rate, NULL, is_setting_available }, - { Setting_ToolChangeRestorePosition, Group_Toolchange, "Restore position after M6", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_tool_restore_pos, get_int, is_setting_available }, + { Setting_ToolChangeMode, Group_Toolchange, "Tool change mode", NULL, Format_RadioButtons, "Normal,Manual touch off,Manual touch off @ G59.3,Automatic touch off @ G59.3,Fast Automatic touch off @ G59.3,Ignore M6", NULL, NULL, Setting_IsExtendedFn, set_tool_change_mode, get_int, NULL }, + { Setting_ToolChangeProbingDistance, Group_Toolchange, "Tool change probing distance", "mm", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtendedFn, set_tool_change_probing_distance, get_float, NULL }, + { Setting_ToolChangeFeedRate, Group_Toolchange, "Tool change locate feed rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.feed_rate, NULL, NULL }, + { Setting_ToolChangeSeekRate, Group_Toolchange, "Tool change search seek rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.seek_rate, NULL, NULL }, + { Setting_ToolChangePulloffRate, Group_Toolchange, "Tool change probe pull-off rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.pulloff_rate, NULL, NULL }, + { Setting_ToolChangeRestorePosition, Group_Toolchange, "Restore position after M6", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_tool_restore_pos, get_int, NULL }, { Setting_DualAxisLengthFailPercent, Group_Limits_DualAxis, "Dual axis length fail", "percent", Format_Decimal, "##0.0", "0", "100", Setting_IsExtended, &settings.homing.dual_axis.fail_length_percent, NULL, is_setting_available }, { Setting_DualAxisLengthFailMin, Group_Limits_DualAxis, "Dual axis length fail min", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsExtended, &settings.homing.dual_axis.fail_distance_min, NULL, is_setting_available }, { Setting_DualAxisLengthFailMax, Group_Limits_DualAxis, "Dual axis length fail max", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsExtended, &settings.homing.dual_axis.fail_distance_max, NULL, is_setting_available }, diff --git a/settings.h b/settings.h index e65e1ad..1bf7537 100644 --- a/settings.h +++ b/settings.h @@ -801,6 +801,7 @@ typedef enum { ToolChange_Manual, ToolChange_Manual_G59_3, ToolChange_SemiAutomatic, + ToolChange_FastSemiAutomatic, ToolChange_Ignore } toolchange_mode_t; diff --git a/tool_change.c b/tool_change.c index 7002d73..abe9946 100644 --- a/tool_change.c +++ b/tool_change.c @@ -237,6 +237,15 @@ static void execute_probe (void *data) { system_convert_array_steps_to_mpos(target.values, sys.probe_position); + if(settings.tool_change.mode == ToolChange_FastSemiAutomatic){ + + // Retract slowly until contact lost. + plan_data.feed_rate = settings.tool_change.feed_rate; + target.values[plane.axis_linear] += TOOL_CHANGE_PROBE_RETRACT_DISTANCE; + flags.probe_is_away = true; + ok = mc_probe_cycle(target.values, &plan_data, flags) == GCProbe_Found; + } else { + // Retract a bit and perform slow probe. plan_data.feed_rate = settings.tool_change.pulloff_rate; target.values[plane.axis_linear] += TOOL_CHANGE_PROBE_RETRACT_DISTANCE; @@ -246,6 +255,7 @@ static void execute_probe (void *data) ok = mc_probe_cycle(target.values, &plan_data, flags) == GCProbe_Found; } } + } if(ok) { if(!(sys.tlo_reference_set.mask & bit(plane.axis_linear))) { @@ -277,7 +287,12 @@ ISR_CODE static void ISR_FUNC(trap_control_cycle_start)(control_signals_t signal if(signals.cycle_start) { if(!execute_posted) { if(!block_cycle_start) - execute_posted = protocol_enqueue_foreground_task(settings.tool_change.mode == ToolChange_SemiAutomatic ? execute_probe : execute_restore, NULL); + execute_posted = protocol_enqueue_foreground_task( + (settings.tool_change.mode == ToolChange_SemiAutomatic || + settings.tool_change.mode == ToolChange_FastSemiAutomatic) + ? execute_probe + : execute_restore, + NULL); else protocol_enqueue_foreground_task(execute_warning, NULL); } @@ -297,7 +312,12 @@ ISR_CODE static bool ISR_FUNC(trap_stream_cycle_start)(char c) if((drop = (c == CMD_CYCLE_START || c == CMD_CYCLE_START_LEGACY))) { if(!execute_posted) { if(!block_cycle_start) - execute_posted = protocol_enqueue_foreground_task(settings.tool_change.mode == ToolChange_SemiAutomatic ? execute_probe : execute_restore, NULL); + execute_posted = protocol_enqueue_foreground_task( + (settings.tool_change.mode == ToolChange_SemiAutomatic || + settings.tool_change.mode == ToolChange_FastSemiAutomatic) + ? execute_probe + : execute_restore, + NULL); else protocol_enqueue_foreground_task(execute_warning, NULL); } @@ -336,7 +356,7 @@ static status_code_t tool_change (parser_state_t *parser_state) return Status_OK; #if COMPATIBILITY_LEVEL > 1 - if(settings.tool_change.mode == ToolChange_Manual_G59_3 || settings.tool_change.mode == ToolChange_SemiAutomatic) + if(settings.tool_change.mode == ToolChange_Manual_G59_3 || settings.tool_change.mode == ToolChange_SemiAutomatic || settings.tool_change.mode == ToolChange_FastSemiAutomatic) return Status_GcodeUnsupportedCommand; #endif @@ -361,12 +381,12 @@ static status_code_t tool_change (parser_state_t *parser_state) if((sys.homed.mask & homed_req) != homed_req) return Status_HomingRequired; - if(settings.tool_change.mode != ToolChange_SemiAutomatic && grbl.on_probe_completed != onProbeCompleted) { - on_probe_completed = grbl.on_probe_completed; - grbl.on_probe_completed = onProbeCompleted; - } + if(settings.tool_change.mode != ToolChange_SemiAutomatic && + settings.tool_change.mode != ToolChange_FastSemiAutomatic) + grbl.on_probe_completed = on_probe_completed; - block_cycle_start = settings.tool_change.mode != ToolChange_SemiAutomatic; + block_cycle_start = (settings.tool_change.mode != ToolChange_SemiAutomatic && + settings.tool_change.mode != ToolChange_FastSemiAutomatic); // Stop spindle and coolant. spindle_all_off(); @@ -376,7 +396,8 @@ static status_code_t tool_change (parser_state_t *parser_state) 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); + settings.tool_change.mode == ToolChange_SemiAutomatic || + settings.tool_change.mode == ToolChange_FastSemiAutomatic); // Save current position. system_convert_array_steps_to_mpos(previous.values, sys.position);