Macro lighting control

If you’re using gSender macros (not the e-stop button firmware macros) with a keybind, something like this should work:

%nextLight = global.lightState || 0
M356 P0 Q[nextLight % 3]
%global.lightState = Number(nextLight) + 1

It either retrieves the current lightState or sets it to 0 if it’s undefined, sets the light to the current state modulus 3 (so the value will never go above 2) and then stores the next state sequence.

Any variables stored in global persist until the application is closed.

From a cursory glance it seems to be working as expected to cycle between auto, white, and off.

image

3 Likes