增加G1零进给错误fixture验证

结论:新增 g1_zero_feed 负向 fixture,固定 G1 在 feed rate 为 0 时返回 INTERP_ERROR=5、输出 LinuxCNC 对应错误文本、不产生 STRAIGHT_FEED,且失败前不更新当前位置和 #5420/#5421/#5422。检查:git diff --check 通过;wasm-port/tests/native/verify_native_probes.sh 通过。
This commit is contained in:
cnc
2026-06-06 23:03:32 +08:00
parent 7d71e3bc6d
commit 15b04e8758
5 changed files with 57 additions and 2 deletions

View File

@@ -10,6 +10,7 @@
#include "emc/rs274ngc/rs274ngc_interp.hh"
#undef private
#include "emc/rs274ngc/rs274ngc_return.hh"
#include "canon_event_sink.hh"
PythonPlugin *python_plugin = nullptr;
@@ -381,6 +382,13 @@ int Interp::convert_g(block_pointer block, setup_pointer settings)
SET_FEED_RATE(block->f_number);
}
if ((block->motion_to_be == G_1) &&
(settings->feed_mode == FEED_MODE::UNITS_PER_MINUTE) &&
(settings->feed_rate == 0.0)) {
setError("%s", NCE_CANNOT_DO_G1_WITH_ZERO_FEED_RATE);
return INTERP_ERROR;
}
const bool incremental = settings->distance_mode == DISTANCE_MODE::INCREMENTAL;
if (block->x_flag) {
settings->current_x = incremental ? settings->current_x + block->x_number