增加当前位置参数fixture验证
结论:新增 position_params fixture,覆盖 Z 轴运动与 #5420/#5421/#5422 当前坐标参数同步;最小 harness 输出当前位置参数,runtime 在直线运动后刷新相对位置参数。检查:git diff --check 通过;wasm-port/tests/native/verify_native_probes.sh 通过。
This commit is contained in:
@@ -360,6 +360,11 @@ Current verified progress:
|
||||
temporary wrapper behavior is based on LinuxCNC
|
||||
`interp_convert.cc::convert_distance_mode()` and
|
||||
`interp_convert.cc::convert_straight()`.
|
||||
- `tests/fixtures/gcode/position_params.ngc` and
|
||||
`tests/fixtures/canon/position_params.events` cover Z-axis motion plus
|
||||
current-position parameter visibility for `#5420`, `#5421`, and `#5422`.
|
||||
The parameter source basis is LinuxCNC
|
||||
`interp_parameter_def.hh` and `interp_namedparams.cc`.
|
||||
- This proves the current extracted interpreter slice can parse and execute a
|
||||
simple traverse and feed move through a standalone canonical event sink.
|
||||
|
||||
@@ -662,7 +667,7 @@ traverse path:
|
||||
|
||||
1. replace the temporary minimal `convert_g()` implementation with thin
|
||||
wrappers around more vendored interpreter conversion code,
|
||||
2. add fixture coverage for `Z` moves and multi-axis current-position
|
||||
parameter updates,
|
||||
2. add a negative fixture for `G1` without feed rate to start pinning error
|
||||
semantics,
|
||||
3. keep all source changes inside `wasm-port/` and leave `../linuxcnc/`
|
||||
read-only.
|
||||
|
||||
@@ -101,6 +101,9 @@ int main(int argc, char **argv)
|
||||
std::cout << "setup.current_x=" << interp._setup.current_x << "\n";
|
||||
std::cout << "setup.current_y=" << interp._setup.current_y << "\n";
|
||||
std::cout << "setup.current_z=" << interp._setup.current_z << "\n";
|
||||
std::cout << "setup.parameter_5420=" << interp._setup.parameters[5420] << "\n";
|
||||
std::cout << "setup.parameter_5421=" << interp._setup.parameters[5421] << "\n";
|
||||
std::cout << "setup.parameter_5422=" << interp._setup.parameters[5422] << "\n";
|
||||
std::cout << "setup.feed_rate=" << interp._setup.feed_rate << "\n";
|
||||
std::cout << "close_and_downcase=" << downcase_rc << "\n";
|
||||
std::cout << "normalized_line=" << line << "\n";
|
||||
|
||||
@@ -349,6 +349,24 @@ bool Interp::is_pycallable(setup_pointer, const char *, const char *) { return f
|
||||
bool Interp::is_user_defined_g_code(int) { return false; }
|
||||
bool Interp::is_any_m_code_remapped(block_pointer, setup_pointer) { return false; }
|
||||
int Interp::convert_m(block_pointer, setup_pointer) { return INTERP_OK; }
|
||||
|
||||
namespace {
|
||||
|
||||
void update_relative_position_parameters(setup_pointer settings)
|
||||
{
|
||||
settings->parameters[5420] = settings->current_x;
|
||||
settings->parameters[5421] = settings->current_y;
|
||||
settings->parameters[5422] = settings->current_z;
|
||||
settings->parameters[5423] = settings->AA_current;
|
||||
settings->parameters[5424] = settings->BB_current;
|
||||
settings->parameters[5425] = settings->CC_current;
|
||||
settings->parameters[5426] = settings->u_current;
|
||||
settings->parameters[5427] = settings->v_current;
|
||||
settings->parameters[5428] = settings->w_current;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int Interp::convert_g(block_pointer block, setup_pointer settings)
|
||||
{
|
||||
const int distance_mode = block->g_modes[GM_DISTANCE_MODE];
|
||||
@@ -376,6 +394,7 @@ int Interp::convert_g(block_pointer block, setup_pointer settings)
|
||||
settings->current_z = incremental ? settings->current_z + block->z_number
|
||||
: block->z_number;
|
||||
}
|
||||
update_relative_position_parameters(settings);
|
||||
|
||||
if (block->motion_to_be == G_0) {
|
||||
settings->motion_mode = G_0;
|
||||
|
||||
9
wasm-port/tests/fixtures/canon/position_params.events
vendored
Normal file
9
wasm-port/tests/fixtures/canon/position_params.events
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
canon_event=STRAIGHT_TRAVERSE line=1 x=1 y=2 z=3 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
canon_event=SET_FEED_RATE rate=80
|
||||
canon_event=STRAIGHT_FEED line=2 x=1.5 y=1 z=5 a=0 b=0 c=0 u=0 v=0 w=0
|
||||
setup.current_x=1.5
|
||||
setup.current_y=1
|
||||
setup.current_z=5
|
||||
setup.parameter_5420=1.5
|
||||
setup.parameter_5421=1
|
||||
setup.parameter_5422=5
|
||||
2
wasm-port/tests/fixtures/gcode/position_params.ngc
vendored
Normal file
2
wasm-port/tests/fixtures/gcode/position_params.ngc
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
G90 G0 X1.0 Y2.0 Z3.0
|
||||
G91 G1 X0.5 Y-1.0 Z2.0 F80.0
|
||||
Reference in New Issue
Block a user