Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic automated ATC implementations (Draft/WIP) #1297

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Add activate/deactivate Macros
Nicolas Lang committed Aug 25, 2024
commit 03ab4255fa5e89f450526354ff0dfd61fa9fa39d
7 changes: 7 additions & 0 deletions FluidNC/src/ToolChangers/atc_basic.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2024 - Bart Dring
// Copyright (c) 2024 - Nicolas Lang
// Use of this source code is governed by a GPLv3 license that can be found in the LICENSE file.

#include "atc_basic.h"
@@ -71,6 +72,9 @@ namespace ATCs {
}

try {
_macro.addf(_atc_activate_macro._gcode.c_str());
_macro.addf(set_state._gcode.c_str());

if (_prev_tool > 0) {
log_debug("ATC: return tool");
move_to_tool_position(_prev_tool);
@@ -97,6 +101,9 @@ namespace ATCs {

move_to_start_position();

_macro.addf(_atc_deactivate_macro._gcode.c_str());
_macro.addf(set_state._gcode.c_str());

_macro.addf(restore_state._gcode.c_str());
_macro.run(nullptr);

4 changes: 4 additions & 0 deletions FluidNC/src/ToolChangers/atc_basic.h
Original file line number Diff line number Diff line change
@@ -50,6 +50,8 @@ namespace ATCs {
Macro _macro;
Macro _toolreturn_macro;
Macro _toolpickup_macro;
Macro _atc_activate_macro;
Macro _atc_deactivate_macro;

public:
void init() override;
@@ -66,6 +68,8 @@ namespace ATCs {
handler.item("ets_rapid_z_mpos_mm", _ets_rapid_z_mpos);
handler.item("toolreturn_macro", _toolreturn_macro);
handler.item("toolpickup_macro", _toolpickup_macro);
handler.item("atc_activate_macro", _atc_activate_macro);
handler.item("atc_deactivate_macro", _atc_deactivate_macro);
handler.item("tool1_mpos_mm", _tool_mpos[0]);
handler.item("tool2_mpos_mm", _tool_mpos[1]);
handler.item("tool3_mpos_mm", _tool_mpos[2]);