Skip to content

feat: complete LinuxCNC G-code and M-code coverage - #155

Merged
misiekhardcore merged 2 commits into
mainfrom
feat/linuxcnc-full-command-coverage
Jun 2, 2026
Merged

misiekhardcore merged 2 commits into
mainfrom
feat/linuxcnc-full-command-coverage

Conversation

@misiekhardcore

Copy link
Copy Markdown
Contributor

Description

Brings the LinuxCNC dialect database to full parity with the official LinuxCNC command set. Previously only ~40 of the ~100 supported commands had hover documentation and completions. This adds the remaining 60 commands across G-codes and M-codes, and introduces 10 new CommandGroup categories to properly classify them.

Type of Change

  • New feature (non-breaking change which adds functionality)

Related Issues

N/A

Changes Made

src/databases/types.ts

  • Added 10 new CommandGroup enum values (alphabetically sorted): ARC_MODE, IO, LATHE, LATHE_CYCLE, OVERRIDES, PATH_CONTROL, PROBING, SPINDLE_MODE, SPINDLE_SYNC, STATE
  • Added corresponding sort-order entries for all new groups in GROUP_SORT_ORDER

src/databases/dialects/LinuxcncGCodeCommandDatabase.ts — 40 new G-codes:

  • Motion / spline: G5 (Cubic Spline), G5.1 (Quadratic B-Spline), G5.2 (NURBS Add Control Point), G5.3 (NURBS Execute)
  • Lathe modes: G7 (Diameter Mode), G8 (Radius Mode)
  • Extended plane selection: G17.1 (UV), G18.1 (UW), G19.1 (VW)
  • Predefined position store: G28.1, G30.1
  • Spindle sync: G33 (Spindle Synchronized Motion), G33.1 (Rigid Tapping)
  • Probing: G38.2, G38.3, G38.4, G38.5
  • Dynamic compensation: G41.1, G42.1 (dynamic cutter comp), G43.1 (dynamic tool length), G43.2 (additional tool length)
  • Coordinate commands: G52 (Local Offset), G53 (Machine Coordinates), G59.1–G59.3 (WCS 7–9)
  • Path control: G61 (Exact Path), G61.1 (Exact Stop), G64 (Path Blending)
  • Lathe cycles: G70 (Finishing), G71 (Rough Turning), G72 (Facing), G76 (Threading)
  • Canned cycles: G73 (Chip Break Drilling), G74 (Left-Hand Tapping)
  • Arc center mode: G90.1, G91.1
  • G92 variants: G92.1 (Clear), G92.2 (Suspend), G92.3 (Restore)
  • Feed / spindle modes: G93 (Inverse Time Feed), G96 (Constant Surface Speed), G97 (Constant RPM)
  • Updated G10 description to cover all L-word variants (L0, L1, L2, L10, L11, L20)
  • Updated G87/G88 descriptions to note they are not implemented in LinuxCNC

src/databases/dialects/LinuxcncGCodeCommandDatabase.ts — 20 new M-codes:

  • Spindle: M19 (Orient Spindle)
  • Overrides: M48 (Enable), M49 (Disable), M50 (Feed Override), M51 (Spindle Override), M52 (Adaptive Feed), M53 (Feed Hold)
  • Program/tool: M60 (Pallet Change Pause), M61 (Set Current Tool)
  • I/O: M62–M65 (digital output on/off, sync/immediate), M66 (Wait On Input), M67/M68 (analog output sync/immediate)
  • Modal state: M70 (Save), M71 (Invalidate), M72 (Restore), M73 (Save + Auto-Restore)

Testing

  • All existing tests pass (npm test — 1389 tests, 83 suites, all green)
  • Build succeeds (npm run build)
  • New tests added — not applicable; all additions are pure data entries with no branching logic, consistent with the pattern used throughout the database

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • Documentation updated (CHANGELOG)
  • No new warnings generated
  • Type checking passes (enforced by tsc --noEmit in the pre-commit hook)
  • Build succeeds (npm run build)

Additional Notes

The CommandGroup enum is now sorted alphabetically. The GROUP_SORT_ORDER record requires all enum values as keys (enforced by TypeScript's Record<CommandGroup, string> type), so the compiler would catch any missing entries.

misiekhardcore and others added 2 commits June 2, 2026 20:07
Adds 40 missing G-codes and 20 missing M-codes to the LinuxCNC dialect
database, bringing it to full parity with the official LinuxCNC command set.

New G-codes: G5/G5.1/G5.2/G5.3 (spline/NURBS), G7/G8 (lathe diameter/radius
mode), G17.1/G18.1/G19.1 (UV/UW/VW planes), G28.1/G30.1 (store predefined
positions), G33/G33.1 (spindle-sync motion and rigid tapping), G38.2–G38.5
(probing), G41.1/G42.1 (dynamic cutter comp), G43.1/G43.2 (dynamic/additive
tool length offset), G52/G53 (local offset and machine coords), G59.1–G59.3
(WCS 7–9), G61/G61.1/G64 (path control modes), G70/G71/G72/G76 (lathe
cycles), G73/G74 (chip-break and left-hand tapping), G90.1/G91.1 (arc center
mode), G92.1–G92.3 (G92 offset control), G93 (inverse-time feed), G96/G97
(constant surface speed and RPM).

New M-codes: M19 (orient spindle), M48/M49 (enable/disable overrides),
M50–M53 (individual override controls), M60 (pallet change pause), M61 (set
current tool), M62–M68 (digital/analog I/O), M70–M73 (modal state
save/restore).

New CommandGroup enum values: ARC_MODE, IO, LATHE, LATHE_CYCLE, OVERRIDES,
PATH_CONTROL, PROBING, SPINDLE_MODE, SPINDLE_SYNC, STATE.
@misiekhardcore
misiekhardcore merged commit adbc9f2 into main Jun 2, 2026
7 of 8 checks passed
@misiekhardcore
misiekhardcore deleted the feat/linuxcnc-full-command-coverage branch June 2, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant