按规划继续工作
结论:补齐 LinuxCNC tooldata_common.cc 随机换刀器 load/save 验证边界,WASM/SDK/OPFS 只透传 random-toolchanger 配置;native、WASM、OPFS 和浏览器 smoke 验证已通过。
This commit is contained in:
@@ -172,6 +172,13 @@ void append_tool_table_state(std::ostringstream &output)
|
||||
if (standalone::get_tool_entry(&tool, 2) == 0) {
|
||||
append_tool_entry(output, "tool_2", tool);
|
||||
}
|
||||
for (int idx = 0; idx < CANON_POCKETS_MAX; ++idx) {
|
||||
if (standalone::get_tool_entry(&tool, idx) == 0 && tool.toolno != -1) {
|
||||
std::ostringstream prefix;
|
||||
prefix << "tool_pocket_" << idx;
|
||||
append_tool_entry(output, prefix.str().c_str(), tool);
|
||||
}
|
||||
}
|
||||
output << "tool_index_for_tool_2=" << standalone::find_tool_index_for_tool(2) << "\n";
|
||||
}
|
||||
|
||||
@@ -196,6 +203,20 @@ void apply_parameter_assignments(Interp &interp, const char *assignments)
|
||||
}
|
||||
}
|
||||
|
||||
char *load_tool_table_with_mode(const char *path, bool random_tool_changer)
|
||||
{
|
||||
standalone::reset_tool_adapter();
|
||||
tooldata_init(random_tool_changer);
|
||||
tooldata_set_db(DB_NOTUSED);
|
||||
|
||||
std::ostringstream output;
|
||||
output << "tooldata_random_toolchanger=" << (random_tool_changer ? 1 : 0) << "\n";
|
||||
const int rc = tooldata_load(path);
|
||||
output << "tooldata_load=" << rc << "\n";
|
||||
append_tool_table_state(output);
|
||||
return copy_result(output.str());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C" {
|
||||
@@ -350,15 +371,13 @@ char *lcinterp_save_parameters(const char *path, const char *assignments)
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
char *lcinterp_load_tool_table(const char *path)
|
||||
{
|
||||
standalone::reset_tool_adapter();
|
||||
tooldata_init(false);
|
||||
tooldata_set_db(DB_NOTUSED);
|
||||
return load_tool_table_with_mode(path, false);
|
||||
}
|
||||
|
||||
std::ostringstream output;
|
||||
const int rc = tooldata_load(path);
|
||||
output << "tooldata_load=" << rc << "\n";
|
||||
append_tool_table_state(output);
|
||||
return copy_result(output.str());
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
char *lcinterp_load_tool_table_random(const char *path)
|
||||
{
|
||||
return load_tool_table_with_mode(path, true);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
|
||||
Reference in New Issue
Block a user