按规划继续工作
结论:新增解释器初始化和同步的 WASM/浏览器验证,继续保持核心行为来自 vendored LinuxCNC。
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "canon_event_sink.hh"
|
||||
#include "linuxcnc_hal_adapter.hh"
|
||||
#include "linuxcnc_tool_adapter.hh"
|
||||
#include "nml_intf/emc.hh"
|
||||
#include "tooldata.hh"
|
||||
|
||||
namespace {
|
||||
@@ -390,6 +391,62 @@ char *lcinterp_save_tool_table(const char *path)
|
||||
return copy_result(output.str());
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
char *lcinterp_probe_init_and_synch()
|
||||
{
|
||||
std::ostringstream output;
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0;
|
||||
standalone::reset_tool_adapter();
|
||||
Interp interp;
|
||||
standalone::reset_canon_events();
|
||||
const int rc = interp.init();
|
||||
output << "init=" << rc << "\n";
|
||||
output << "setup.length_units=" << static_cast<int>(interp._setup.length_units) << "\n";
|
||||
output << "setup.origin_index=" << interp._setup.origin_index << "\n";
|
||||
output << "setup.distance_mode=" << static_cast<int>(interp._setup.distance_mode) << "\n";
|
||||
output << "setup.feed_mode=" << static_cast<int>(interp._setup.feed_mode) << "\n";
|
||||
output << "setup.motion_mode=" << interp._setup.motion_mode << "\n";
|
||||
output << "canon_event_count=" << standalone::canon_events().size() << "\n";
|
||||
for (const auto &event : standalone::canon_events()) {
|
||||
output << "canon_event=" << event << "\n";
|
||||
}
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0 / 25.4;
|
||||
standalone::reset_tool_adapter();
|
||||
Interp inch_interp;
|
||||
standalone::reset_canon_events();
|
||||
const int inch_rc = inch_interp.init();
|
||||
output << "inch_init=" << inch_rc << "\n";
|
||||
output << "inch_setup.length_units="
|
||||
<< static_cast<int>(inch_interp._setup.length_units) << "\n";
|
||||
output << "inch_external_length_units=" << GET_EXTERNAL_LENGTH_UNITS() << "\n";
|
||||
output << "inch_canon_event_count=" << standalone::canon_events().size() << "\n";
|
||||
for (const auto &event : standalone::canon_events()) {
|
||||
output << "inch_canon_event=" << event << "\n";
|
||||
}
|
||||
|
||||
standalone::reset_tool_adapter();
|
||||
CANON_TOOL_TABLE tool = standalone::tool_entry_init();
|
||||
tool.toolno = 2;
|
||||
tool.pocketno = 2;
|
||||
standalone::set_tool_entry(2, tool);
|
||||
standalone::select_tool(2);
|
||||
standalone::change_selected_tool();
|
||||
|
||||
Interp synch_interp;
|
||||
const int synch_rc = synch_interp.synch();
|
||||
output << "synch=" << synch_rc << "\n";
|
||||
output << "synch.current_pocket=" << synch_interp._setup.current_pocket << "\n";
|
||||
output << "synch.selected_pocket=" << synch_interp._setup.selected_pocket << "\n";
|
||||
output << "synch.tool_0=" << synch_interp._setup.tool_table[0].toolno << "\n";
|
||||
output << "synch.tool_2=" << synch_interp._setup.tool_table[2].toolno << "\n";
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0;
|
||||
standalone::reset_tool_adapter();
|
||||
return copy_result(output.str());
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
void lcinterp_free_string(char *value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user