The gcodes in the ‘M’ family are decoded in CNC_Functions.h starting around line 1647 in ‘executeMcodeLine()’.
Codes 0, 1, 2, 3, 4, 5, 6 and 30 are implemented.
0 - program pause
1 - optional pause/halt/stop
2 - program end
3 - spindle on - clockwise
4 - spindle on counterclockwise (here, same as #3)
5 - spindle off
6 - tool change, pause for response
30 - program end with return to top
3 & 4 turn the spindle on, 2, 5, 6 & 30 turn it off.