From cf34d6894b012c3a5780539c987ccbbd255147e0 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 7 Jun 2026 16:26:51 +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 feed/control canonical 边界事件记录,并新增 G93、G94、G95、G61、G61.1、G64 P/Q 回归 fixture;原生 probe 验证通过。 --- wasm-port/docs/porting-steps-standalone.md | 9 +++++ .../linuxcnc_interp_minimal_runtime.cpp | 35 ++++++++++++++++--- .../fixtures/canon/feed_control_modes.events | 14 ++++++++ .../fixtures/gcode/feed_control_modes.ngc | 7 ++++ 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 wasm-port/tests/fixtures/canon/feed_control_modes.events create mode 100644 wasm-port/tests/fixtures/gcode/feed_control_modes.ngc diff --git a/wasm-port/docs/porting-steps-standalone.md b/wasm-port/docs/porting-steps-standalone.md index 1ff77ab..ff796ba 100644 --- a/wasm-port/docs/porting-steps-standalone.md +++ b/wasm-port/docs/porting-steps-standalone.md @@ -380,6 +380,15 @@ Current verified progress: `interp_convert.cc::convert_coordinate_system()`, `interp_convert.cc::convert_setup()`, and `interp_convert.cc::convert_axis_offsets()`. +- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records + feed/control canonical boundary calls emitted by vendored LinuxCNC + conversion and queue code: `SET_TRAVERSE_RATE`, `SET_FEED_REFERENCE`, + `SET_FEED_MODE`, `SET_MOTION_CONTROL_MODE`, and + `SET_NAIVECAM_TOLERANCE`. `tests/fixtures/gcode/feed_control_modes.ngc` + and `tests/fixtures/canon/feed_control_modes.events` pin `G93`, `G94`, + `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`. - `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 414728a..5afee79 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 @@ -121,11 +121,36 @@ void SELECT_PLANE(CANON_PLANE plane) 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) {} -void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE, double) {} -void SET_NAIVECAM_TOLERANCE(double) {} +void SET_TRAVERSE_RATE(double rate) +{ + std::ostringstream oss; + oss << "SET_TRAVERSE_RATE rate=" << rate; + standalone::push_canon_event(oss.str()); +} +void SET_FEED_REFERENCE(CANON_FEED_REFERENCE reference) +{ + std::ostringstream oss; + oss << "SET_FEED_REFERENCE reference=" << static_cast(reference); + standalone::push_canon_event(oss.str()); +} +void SET_FEED_MODE(int spindle, int mode) +{ + std::ostringstream oss; + oss << "SET_FEED_MODE spindle=" << spindle << " mode=" << mode; + standalone::push_canon_event(oss.str()); +} +void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode, double tolerance) +{ + std::ostringstream oss; + oss << "SET_MOTION_CONTROL_MODE mode=" << mode << " tolerance=" << tolerance; + standalone::push_canon_event(oss.str()); +} +void SET_NAIVECAM_TOLERANCE(double tolerance) +{ + std::ostringstream oss; + oss << "SET_NAIVECAM_TOLERANCE tolerance=" << tolerance; + standalone::push_canon_event(oss.str()); +} void SET_CUTTER_RADIUS_COMPENSATION(double) {} void START_CUTTER_RADIUS_COMPENSATION(int) {} void STOP_CUTTER_RADIUS_COMPENSATION() {} diff --git a/wasm-port/tests/fixtures/canon/feed_control_modes.events b/wasm-port/tests/fixtures/canon/feed_control_modes.events new file mode 100644 index 0000000..79f27a9 --- /dev/null +++ b/wasm-port/tests/fixtures/canon/feed_control_modes.events @@ -0,0 +1,14 @@ +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=COMMENT: interpreter: feed mode set to inverse time +canon_event=SET_FEED_MODE spindle=0 mode=0 +canon_event=COMMENT: interpreter: feed mode set to units per minute +canon_event=SET_FEED_MODE spindle=0 mode=0 +canon_event=SET_FEED_RATE rate=0 +canon_event=COMMENT: interpreter: feed mode set to units per revolution +canon_event=SET_FEED_MODE spindle=0 mode=1 +canon_event=SET_FEED_RATE rate=0 +canon_event=SET_MOTION_CONTROL_MODE mode=2 tolerance=0 +canon_event=SET_MOTION_CONTROL_MODE mode=1 tolerance=0 +canon_event=SET_MOTION_CONTROL_MODE mode=3 tolerance=0.02 +canon_event=SET_NAIVECAM_TOLERANCE tolerance=0.03 diff --git a/wasm-port/tests/fixtures/gcode/feed_control_modes.ngc b/wasm-port/tests/fixtures/gcode/feed_control_modes.ngc new file mode 100644 index 0000000..d474939 --- /dev/null +++ b/wasm-port/tests/fixtures/gcode/feed_control_modes.ngc @@ -0,0 +1,7 @@ +G90 G17 G0 X0 Y0 Z0 +G93 +G94 +G95 +G61 +G61.1 +G64 P0.02 Q0.03