From b3809a6674611508258f1e50286becbf39fa1c64 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 7 Jun 2026 16:30:13 +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 probe canonical 边界事件记录,并新增 G38.2、G38.3、G38.4、G38.5 回归 fixture;原生 probe 验证通过。 --- wasm-port/docs/porting-steps-standalone.md | 7 ++++++ .../linuxcnc_interp_minimal_runtime.cpp | 25 ++++++++++++++++--- .../fixtures/canon/probe_semantics.events | 15 +++++++++++ .../tests/fixtures/gcode/probe_semantics.ngc | 6 +++++ 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 wasm-port/tests/fixtures/canon/probe_semantics.events create mode 100644 wasm-port/tests/fixtures/gcode/probe_semantics.ngc diff --git a/wasm-port/docs/porting-steps-standalone.md b/wasm-port/docs/porting-steps-standalone.md index ff796ba..39e20c9 100644 --- a/wasm-port/docs/porting-steps-standalone.md +++ b/wasm-port/docs/porting-steps-standalone.md @@ -389,6 +389,13 @@ Current verified progress: `G95`, `G61`, `G61.1`, and `G64 P/Q` behavior from `interp_convert.cc::convert_feed_mode()`, `interp_convert.cc::convert_control_mode()`, and `interp_queue.cc`. +- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records + probe canonical boundary calls emitted by vendored + `interp_convert.cc::convert_probe()`: `TURN_PROBE_ON`, + `STRAIGHT_PROBE`, and `TURN_PROBE_OFF`. + `tests/fixtures/gcode/probe_semantics.ngc` and + `tests/fixtures/canon/probe_semantics.events` pin `G38.2`, `G38.3`, + `G38.4`, and `G38.5` probe type handling. - `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 5afee79..fb079e4 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 @@ -157,7 +157,26 @@ void STOP_CUTTER_RADIUS_COMPENSATION() {} void START_SPEED_FEED_SYNCH(int, double, bool) {} void STOP_SPEED_FEED_SYNCH() {} void RIGID_TAP(int, double, double, double, double) {} -void STRAIGHT_PROBE(int, double, double, double, double, double, double, double, double, double, unsigned char) {} +void STRAIGHT_PROBE(int lineno, + double x, double y, double z, + double a, double b, double c, + double u, double v, double w, + unsigned char probe_type) +{ + std::ostringstream oss; + oss << "STRAIGHT_PROBE line=" << lineno + << " x=" << x + << " y=" << y + << " z=" << z + << " a=" << a + << " b=" << b + << " c=" << c + << " u=" << u + << " v=" << v + << " w=" << w + << " probe_type=" << static_cast(probe_type); + standalone::push_canon_event(oss.str()); +} void STOP() {} void DWELL(double seconds) { @@ -264,8 +283,8 @@ void FLOOD_ON() { standalone::push_canon_event("FLOOD_ON"); } void MIST_OFF() { standalone::push_canon_event("MIST_OFF"); } void MIST_ON() { standalone::push_canon_event("MIST_ON"); } void PALLET_SHUTTLE() { standalone::push_canon_event("PALLET_SHUTTLE"); } -void TURN_PROBE_OFF() {} -void TURN_PROBE_ON() {} +void TURN_PROBE_OFF() { standalone::push_canon_event("TURN_PROBE_OFF"); } +void TURN_PROBE_ON() { standalone::push_canon_event("TURN_PROBE_ON"); } void UNCLAMP_AXIS(CANON_AXIS) {} void NURB_KNOT_VECTOR() {} void NURB_CONTROL_POINT(int, double, double, double, double) {} diff --git a/wasm-port/tests/fixtures/canon/probe_semantics.events b/wasm-port/tests/fixtures/canon/probe_semantics.events new file mode 100644 index 0000000..2e64ad6 --- /dev/null +++ b/wasm-port/tests/fixtures/canon/probe_semantics.events @@ -0,0 +1,15 @@ +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_FEED_RATE rate=25 +canon_event=TURN_PROBE_ON +canon_event=STRAIGHT_PROBE line=3 x=0 y=0 z=-1 a=0 b=0 c=0 u=0 v=0 w=0 probe_type=0 +canon_event=TURN_PROBE_OFF +canon_event=TURN_PROBE_ON +canon_event=STRAIGHT_PROBE line=4 x=1 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 probe_type=1 +canon_event=TURN_PROBE_OFF +canon_event=TURN_PROBE_ON +canon_event=STRAIGHT_PROBE line=5 x=0 y=1 z=0 a=0 b=0 c=0 u=0 v=0 w=0 probe_type=2 +canon_event=TURN_PROBE_OFF +canon_event=TURN_PROBE_ON +canon_event=STRAIGHT_PROBE line=6 x=0 y=0 z=1 a=0 b=0 c=0 u=0 v=0 w=0 probe_type=3 +canon_event=TURN_PROBE_OFF diff --git a/wasm-port/tests/fixtures/gcode/probe_semantics.ngc b/wasm-port/tests/fixtures/gcode/probe_semantics.ngc new file mode 100644 index 0000000..0150fd8 --- /dev/null +++ b/wasm-port/tests/fixtures/gcode/probe_semantics.ngc @@ -0,0 +1,6 @@ +G90 G17 G0 X0 Y0 Z0 +F25 +G38.2 Z-1 +G38.3 X1 +G38.4 Y1 +G38.5 Z1