From 8c9d16e49d6a7a4e1cfcc9a200994d91c4867a96 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 7 Jun 2026 16:22:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E6=8E=A8=E8=8D=90=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=EF=BC=8C=E7=BB=A7=E7=BB=AD=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:已接入 LinuxCNC canonical 坐标系边界事件记录,并新增 G55、G10 L2、G92、G92.1、G54 回归 fixture;原生 probe 验证通过。 --- wasm-port/docs/porting-steps-standalone.md | 10 +++ .../linuxcnc_interp_minimal_runtime.cpp | 76 +++++++++++++++++-- .../fixtures/canon/coordinate_offsets.events | 12 +++ .../fixtures/gcode/coordinate_offsets.ngc | 6 ++ 4 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 wasm-port/tests/fixtures/canon/coordinate_offsets.events create mode 100644 wasm-port/tests/fixtures/gcode/coordinate_offsets.ngc diff --git a/wasm-port/docs/porting-steps-standalone.md b/wasm-port/docs/porting-steps-standalone.md index 108d03f..1ff77ab 100644 --- a/wasm-port/docs/porting-steps-standalone.md +++ b/wasm-port/docs/porting-steps-standalone.md @@ -370,6 +370,16 @@ Current verified progress: conversion through vendored `interp_cycles.cc`, including `G81`, `G82`, `G83`, `G80` cancellation, dwell, peck drilling, and incremental `L` repeats. +- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records + coordinate-system canonical boundary calls emitted by vendored LinuxCNC + conversion code: `SET_G5X_OFFSET`, `SET_G92_OFFSET`, `SET_XY_ROTATION`, + `CANON_UPDATE_END_POINT`, `USE_LENGTH_UNITS`, and `SELECT_PLANE`. + `tests/fixtures/gcode/coordinate_offsets.ngc` and + `tests/fixtures/canon/coordinate_offsets.events` pin `G55`, active + `G10 L2`, `G92`, `G92.1`, and `G54` behavior from + `interp_convert.cc::convert_coordinate_system()`, + `interp_convert.cc::convert_setup()`, and + `interp_convert.cc::convert_axis_offsets()`. - `tests/fixtures/gcode_errors/g1_zero_feed.ngc` and `tests/fixtures/canon_errors/g1_zero_feed.expected` pin the negative `G1` zero-feed case. The source basis is LinuxCNC diff --git a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp index 98da38d..414728a 100644 --- a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp +++ b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp @@ -51,12 +51,76 @@ int USER_DEFINED_FUNCTION_ADD(USER_DEFINED_FUNCTION_TYPE func, int num) } void INIT_CANON() {} -void SET_G5X_OFFSET(int, double, double, double, double, double, double, double, double, double) {} -void SET_G92_OFFSET(double, double, double, double, double, double, double, double, double) {} -void SET_XY_ROTATION(double) {} -void CANON_UPDATE_END_POINT(double, double, double, double, double, double, double, double, double) {} -void USE_LENGTH_UNITS(CANON_UNITS) {} -void SELECT_PLANE(CANON_PLANE) {} +void SET_G5X_OFFSET(int index, + double x, double y, double z, + double a, double b, double c, + double u, double v, double w) +{ + std::ostringstream oss; + oss << "SET_G5X_OFFSET index=" << index + << " x=" << x + << " y=" << y + << " z=" << z + << " a=" << a + << " b=" << b + << " c=" << c + << " u=" << u + << " v=" << v + << " w=" << w; + standalone::push_canon_event(oss.str()); +} +void SET_G92_OFFSET(double x, double y, double z, + double a, double b, double c, + double u, double v, double w) +{ + std::ostringstream oss; + oss << "SET_G92_OFFSET" + << " x=" << x + << " y=" << y + << " z=" << z + << " a=" << a + << " b=" << b + << " c=" << c + << " u=" << u + << " v=" << v + << " w=" << w; + standalone::push_canon_event(oss.str()); +} +void SET_XY_ROTATION(double rotation) +{ + std::ostringstream oss; + oss << "SET_XY_ROTATION rotation=" << rotation; + standalone::push_canon_event(oss.str()); +} +void CANON_UPDATE_END_POINT(double x, double y, double z, + double a, double b, double c, + double u, double v, double w) +{ + std::ostringstream oss; + oss << "CANON_UPDATE_END_POINT" + << " x=" << x + << " y=" << y + << " z=" << z + << " a=" << a + << " b=" << b + << " c=" << c + << " u=" << u + << " v=" << v + << " w=" << w; + standalone::push_canon_event(oss.str()); +} +void USE_LENGTH_UNITS(CANON_UNITS units) +{ + std::ostringstream oss; + oss << "USE_LENGTH_UNITS units=" << static_cast(units); + standalone::push_canon_event(oss.str()); +} +void SELECT_PLANE(CANON_PLANE plane) +{ + std::ostringstream oss; + oss << "SELECT_PLANE plane=" << static_cast(plane); + standalone::push_canon_event(oss.str()); +} void SET_TRAVERSE_RATE(double) {} void SET_FEED_REFERENCE(CANON_FEED_REFERENCE) {} void SET_FEED_MODE(int, int) {} diff --git a/wasm-port/tests/fixtures/canon/coordinate_offsets.events b/wasm-port/tests/fixtures/canon/coordinate_offsets.events new file mode 100644 index 0000000..bc2a016 --- /dev/null +++ b/wasm-port/tests/fixtures/canon/coordinate_offsets.events @@ -0,0 +1,12 @@ +canon_event=SELECT_PLANE plane=1 +canon_event=STRAIGHT_TRAVERSE line=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G5X_OFFSET index=2 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_XY_ROTATION rotation=0 +canon_event=SET_G5X_OFFSET index=2 x=4 y=5 z=6 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_XY_ROTATION rotation=0 +canon_event=SET_G92_OFFSET x=-14 y=-25 z=-36 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G5X_OFFSET index=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_XY_ROTATION rotation=0 diff --git a/wasm-port/tests/fixtures/gcode/coordinate_offsets.ngc b/wasm-port/tests/fixtures/gcode/coordinate_offsets.ngc new file mode 100644 index 0000000..a357b7a --- /dev/null +++ b/wasm-port/tests/fixtures/gcode/coordinate_offsets.ngc @@ -0,0 +1,6 @@ +G90 G17 G0 X0 Y0 Z0 +G55 +G10 L2 P2 X4 Y5 Z6 +G92 X10 Y20 Z30 +G92.1 +G54