LinuxCNC M30

M30 is a LinuxCNC G-code program-end command that also exchanges pallet shuttles. It ends the program, and pressing Cycle Start ("R" in the Axis GUI) restarts the program at the beginning of the file. M30 also returns the machine to a defined set of modal states, such as MDI mode, default origin offsets, XY plane, absolute distance mode and stopped spindle.

Source checked2/2 values · 2026-10-26

Specification

1 source
Languagegcode
CodeM30
GroupProgram End
DialectLinuxCNC

Study notes

  • M2 ends the program; M30 additionally exchanges pallet shuttles before ending the program.
  • After M30, pressing Cycle Start starts the program at the beginning of the file.
  • Both M2 and M30 change from Auto mode to MDI mode.
  • Origin offsets are set to the default (like G54) and the selected plane is set to XY (like G17).
  • Distance mode is set to absolute (like G90) and feed rate mode to units per minute (like G94).
  • Feed and speed overrides are set to ON (like M48).
  • Cutter compensation is turned off (like G40), the spindle is stopped (like M5) and coolant is turned off (like M9).
  • The current motion mode is set to feed (like G1).
  • Lines of code after M2/M30 will not be executed.

Safety

  • Using % to wrap the G-code does not do the same thing as a Program End.
↑↓ navigate↵ openesc close