Wire LinuxCNC tool table for cutter comp
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "canon_event_sink.h"
|
||||
|
||||
#include "canon.hh"
|
||||
#include "emc/tooldata/tooldata.hh"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
@@ -736,8 +737,11 @@ int GET_EXTERNAL_SELECTED_TOOL_SLOT() {
|
||||
return active_sink ? active_sink->selected_tool() : -1;
|
||||
}
|
||||
|
||||
CANON_TOOL_TABLE GET_EXTERNAL_TOOL_TABLE(int) {
|
||||
CANON_TOOL_TABLE tool{};
|
||||
CANON_TOOL_TABLE GET_EXTERNAL_TOOL_TABLE(int pocket) {
|
||||
CANON_TOOL_TABLE tool = tooldata_entry_init();
|
||||
if (tooldata_get(&tool, pocket) == IDX_OK) {
|
||||
return tool;
|
||||
}
|
||||
std::memset(&tool, 0, sizeof(tool));
|
||||
return tool;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#include <Python.h>
|
||||
|
||||
#include "linuxcnc_canon_bridge.h"
|
||||
#include "linuxcnc_tooldata_fixture.h"
|
||||
#include "simulator_gcode_controls.h"
|
||||
|
||||
#include "linuxcnc.h"
|
||||
#include "nml_intf/canon.hh"
|
||||
#include "nml_intf/interp_return.hh"
|
||||
#include "rs274ngc/interp_base.hh"
|
||||
#include "emc/tooldata/tooldata.hh"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -32,27 +32,6 @@ struct _inittab builtin_modules[] = {
|
||||
|
||||
namespace {
|
||||
|
||||
void init_minimal_tooldata_once() {
|
||||
static bool created = false;
|
||||
if (!created) {
|
||||
tool_mmap_creator(nullptr, 0);
|
||||
created = true;
|
||||
}
|
||||
|
||||
tooldata_reset();
|
||||
|
||||
CANON_TOOL_TABLE spindle = tooldata_entry_init();
|
||||
spindle.toolno = 0;
|
||||
spindle.pocketno = 0;
|
||||
tooldata_put(spindle, 0);
|
||||
|
||||
CANON_TOOL_TABLE tool = tooldata_entry_init();
|
||||
tool.toolno = 1;
|
||||
tool.pocketno = 1;
|
||||
tool.diameter = 6.0;
|
||||
tooldata_put(tool, 1);
|
||||
}
|
||||
|
||||
bool normal_read_status(int status) {
|
||||
return status == INTERP_OK ||
|
||||
status == INTERP_EXECUTE_FINISH ||
|
||||
@@ -192,7 +171,7 @@ int parse_linuxcnc_rs274_backend(CanonEventSink &sink,
|
||||
if (const char *parameter_file = std::getenv("CNC_SIM_RS274_VAR")) {
|
||||
SET_PARAMETER_FILE_NAME(parameter_file);
|
||||
}
|
||||
init_minimal_tooldata_once();
|
||||
cnc_sim_init_minimal_linuxcnc_tooldata();
|
||||
sink.clear_callback_status();
|
||||
cnc_sim_linuxcnc_set_canon_sink(&sink);
|
||||
|
||||
|
||||
25
core/src/linuxcnc_tooldata_fixture.cpp
Normal file
25
core/src/linuxcnc_tooldata_fixture.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "linuxcnc_tooldata_fixture.h"
|
||||
|
||||
#include "emc/tooldata/tooldata.hh"
|
||||
|
||||
void cnc_sim_init_minimal_linuxcnc_tooldata() {
|
||||
static bool created = false;
|
||||
if (!created) {
|
||||
tool_mmap_creator(nullptr, 0);
|
||||
created = true;
|
||||
}
|
||||
|
||||
tooldata_reset();
|
||||
|
||||
CANON_TOOL_TABLE spindle = tooldata_entry_init();
|
||||
spindle.toolno = 0;
|
||||
spindle.pocketno = 0;
|
||||
tooldata_put(spindle, 0);
|
||||
|
||||
CANON_TOOL_TABLE tool = tooldata_entry_init();
|
||||
tool.toolno = 1;
|
||||
tool.pocketno = 1;
|
||||
tool.diameter = 6.0;
|
||||
tooldata_put(tool, 1);
|
||||
tooldata_last_index_set(1);
|
||||
}
|
||||
3
core/src/linuxcnc_tooldata_fixture.h
Normal file
3
core/src/linuxcnc_tooldata_fixture.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void cnc_sim_init_minimal_linuxcnc_tooldata();
|
||||
Reference in New Issue
Block a user