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