I added the M2001 gcode command to control power domains. When certain domains are enabled the screen and controller are automatically rebooted.
Snapmaker_V4.0.1_20201231.zip (141.1 KB)
And example pair of Luban macros to do a toolhead would looks like this now:
Macro 1: “Start Tool Change”
G28 O F3000; Move home if needed
M1010 S3 P255; Turn the lights on
G53 G1 X250 Z150 F5000; Actual Machine Coordinate System,- Move to X250 Z150 with Speed of F500
M2001 T0 ; Disable power to the toolhead
Macro 2: “Finish Tool Change”
M2001 T ; Enable Tool Power, rebooting machine
Command documentation:
/*
* Power domain control:
* S: just for screen
* T: for the toolhead and all linear modules
* B: for bed and addons, like the enclosure
*
* Call with:
* M2001 S{0} T{0} B{0}
*/
Example usage:
M2001 ; Get status of each power domain
M2001 T0 ; Turn off the toolhead/linear modules
M2001 T0 B0 ; Turn off the toolhead/linear modules and bed/enclosure
M2001 S T B ; Turn everything on. Will reboot, if T or B was off previously