Skip to content

feat: implement Excellon M70/M80/M90 axis transform commands#301

Open
rampageservices wants to merge 1 commit intogerbv:developfrom
SourceParts:fix/excellon-m70-m80-m90-axis-transforms
Open

feat: implement Excellon M70/M80/M90 axis transform commands#301
rampageservices wants to merge 1 commit intogerbv:developfrom
SourceParts:fix/excellon-m70-m80-m90-axis-transforms

Conversation

@rampageservices
Copy link
Copy Markdown
Contributor

Summary

  • M70 (swap axes): subsequent X values treated as Y and vice versa
  • M80 (mirror X): subsequent X values negated (reflect across Y axis)
  • M90 (mirror Y): subsequent Y values negated (reflect across X axis)

These are state toggles — issuing the same command twice cancels it. Some CAD tools emit these for bottom-side drill files or rotated boards. Previously these had enum values and display names but no parsing or dispatch — they fell through to "unknown M-code".

Changes

  • Add swap_axis/mirror_x/mirror_y state fields to drill_state_t
  • Add dispatch handlers that toggle state on each M-code
  • Apply transforms to raw parsed coordinates before absolute/incremental store (swap first so mirror applies to already-swapped axes)
  • Wire up M70/M80/M90 stats counting in drill_parse_M_code()
  • Add stats accumulation in drill_stats.c and UI display rows in callbacks.c
  • Add regression test with 4 holes verifying original, swapped, mirror-X, and mirror-Y

Test plan

  • cmake --build build — clean build, no warnings
  • test-drill-axis-transforms regression test passes (4 holes in distinct positions)
  • All other tests unaffected (95 pass, 10 pre-existing rendering mismatches)

M70 (swap axes), M80 (mirror X), and M90 (mirror Y) are Excellon
commands that transform coordinate interpretation for bottom-side
drill files or rotated boards. They act as state toggles — issuing
the same command twice cancels it.

- Add swap_axis/mirror_x/mirror_y state fields to drill_state_t
- Add dispatch handlers that toggle state on each M-code
- Apply transforms to raw parsed coordinates before absolute/incremental store
- Wire up M70/M80/M90 stats counting and UI display
- Add regression test with 4 holes verifying each transform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants