Propagate LinuxCNC canon event line numbers

This commit is contained in:
CNC Local
2026-05-22 04:48:37 +08:00
parent 55d9fff9f0
commit bf7192cc07
7 changed files with 42 additions and 15 deletions

View File

@@ -68,6 +68,7 @@ int main() {
bool saw_g5x_offset = false;
bool saw_xy_rotation = false;
bool saw_g92_clear = false;
bool saw_coordinate_end_line = false;
for (const auto &event : events) {
saw_tool = saw_tool || event.type == CNC_SIM_EVENT_TOOL_CHANGE;
saw_rapid = saw_rapid || event.type == CNC_SIM_EVENT_RAPID;
@@ -128,22 +129,29 @@ int main() {
for (const auto &event : events) {
saw_g5x_offset = saw_g5x_offset ||
(event.type == CNC_SIM_EVENT_SET_G5X_OFFSET &&
event.line == 2 &&
event.tool == 1 &&
event.start.x == 12.5 &&
event.start.y == -3.0 &&
event.start.z == 4.0);
saw_xy_rotation = saw_xy_rotation ||
(event.type == CNC_SIM_EVENT_SET_XY_ROTATION &&
event.line == 2 &&
event.feed == 30.0);
saw_g92_clear = saw_g92_clear ||
(event.type == CNC_SIM_EVENT_SET_G92_OFFSET &&
event.line == 4 &&
event.start.x == 0.0 &&
event.start.y == 0.0 &&
event.start.z == 0.0);
saw_coordinate_end_line = saw_coordinate_end_line ||
(event.type == CNC_SIM_EVENT_PROGRAM_END &&
event.line == 5);
}
ok &= expect(saw_g5x_offset, "expected LinuxCNC G10 L2 G5X offset event");
ok &= expect(saw_xy_rotation, "expected LinuxCNC G10 L2 XY rotation event");
ok &= expect(saw_g92_clear, "expected LinuxCNC G92.1 clear offset event");
ok &= expect(saw_coordinate_end_line, "expected LinuxCNC coordinate program end line number");
cnc_sim_destroy(sim);