按源修正外部单位换算

结论:依据 LinuxCNC emccanon.cc 与 units.h,GET_EXTERNAL_LENGTH_UNITS 返回 user-units-per-mm 而非当前程序单位;新增 G20/G21 后 G92.3 恢复覆盖,native/source-link/test-native 均通过。
This commit is contained in:
cnc
2026-06-06 08:26:21 +08:00
parent ccd51ff373
commit 25cb6885bf
4 changed files with 70 additions and 2 deletions

View File

@@ -782,11 +782,16 @@ int GET_EXTERNAL_FLOOD() {
}
CANON_UNITS GET_EXTERNAL_LENGTH_UNIT_TYPE() {
return active_sink && active_sink->unit_scale() == 25.4 ? CANON_UNITS_INCHES : CANON_UNITS_MM;
// LinuxCNC src/emc/task/emccanon.cc derives this from INI machine/user
// units, not from the active G20/G21 program units.
return CANON_UNITS_MM;
}
double GET_EXTERNAL_LENGTH_UNITS() {
return active_sink ? active_sink->unit_scale() : 1.0;
// LinuxCNC src/emc/task/emccanon.cc returns traj.linearUnits here:
// external/user units per internal millimeter. The simulator has no INI
// machine-units bridge yet, so the source-linked default is metric.
return 1.0;
}
double GET_EXTERNAL_ANGLE_UNITS() {