按建议,继续完成后续工作
结论:将解释器外部长度单位读取接入共享 emcStatus 状态边界,并补充 inch/mm 初始化验证。
This commit is contained in:
@@ -2,9 +2,6 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static EMC_STAT standalone_emc_status;
|
||||
EMC_STAT *emcStatus = &standalone_emc_status;
|
||||
|
||||
int main()
|
||||
{
|
||||
const bool default_units_visible = emcStatus->motion.traj.linearUnits == 1.0;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#include "nml_intf/emc.hh"
|
||||
|
||||
static EMC_STAT standalone_emc_status;
|
||||
EMC_STAT *emcStatus = &standalone_emc_status;
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "canon_event_sink.hh"
|
||||
#include "nml_intf/emc.hh"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -29,6 +30,7 @@ int main()
|
||||
const auto temp_dir = make_temp_dir();
|
||||
std::filesystem::current_path(temp_dir);
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0;
|
||||
Interp interp;
|
||||
standalone::reset_canon_events();
|
||||
|
||||
@@ -44,6 +46,21 @@ int main()
|
||||
std::cout << "canon_event=" << event << "\n";
|
||||
}
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0 / 25.4;
|
||||
Interp inch_interp;
|
||||
standalone::reset_canon_events();
|
||||
const int inch_rc = inch_interp.init();
|
||||
std::cout << "inch_init=" << inch_rc << "\n";
|
||||
std::cout << "inch_setup.length_units="
|
||||
<< static_cast<int>(inch_interp._setup.length_units) << "\n";
|
||||
std::cout << "inch_external_length_units="
|
||||
<< GET_EXTERNAL_LENGTH_UNITS() << "\n";
|
||||
std::cout << "inch_canon_event_count=" << standalone::canon_events().size() << "\n";
|
||||
for (const auto &event : standalone::canon_events()) {
|
||||
std::cout << "inch_canon_event=" << event << "\n";
|
||||
}
|
||||
|
||||
emcStatus->motion.traj.linearUnits = 1.0;
|
||||
std::filesystem::remove_all(temp_dir);
|
||||
return rc == INTERP_OK ? 0 : 1;
|
||||
return (rc == INTERP_OK && inch_rc == INTERP_OK) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "emc/rs274ngc/rs274ngc_return.hh"
|
||||
#include "canon_event_sink.hh"
|
||||
#include "linuxcnc_tool_adapter.hh"
|
||||
#include "nml_intf/emc.hh"
|
||||
|
||||
namespace standalone {
|
||||
|
||||
@@ -448,8 +449,11 @@ void CANON_ERROR(const char *fmt, ...)
|
||||
|
||||
double GET_EXTERNAL_FEED_RATE() { return 0.0; }
|
||||
int GET_EXTERNAL_FLOOD() { return 0; }
|
||||
CANON_UNITS GET_EXTERNAL_LENGTH_UNIT_TYPE() { return CANON_UNITS_MM; }
|
||||
double GET_EXTERNAL_LENGTH_UNITS() { return 1.0; }
|
||||
CANON_UNITS GET_EXTERNAL_LENGTH_UNIT_TYPE()
|
||||
{
|
||||
return (emcStatus->motion.traj.linearUnits > 0.5) ? CANON_UNITS_MM : CANON_UNITS_INCHES;
|
||||
}
|
||||
double GET_EXTERNAL_LENGTH_UNITS() { return emcStatus->motion.traj.linearUnits; }
|
||||
double GET_EXTERNAL_ANGLE_UNITS() { return 1.0; }
|
||||
int GET_EXTERNAL_MIST() { return 0; }
|
||||
CANON_MOTION_MODE GET_EXTERNAL_MOTION_CONTROL_MODE() { return CANON_EXACT_STOP; }
|
||||
|
||||
Reference in New Issue
Block a user