Iām interested in creating a macro for changing the rail lights. Ideally, I would assign a button on the SLB E-Stop. The purpose would be to toggle through the light settings.
I would think the default operation of the rail is āautomaticā so pressing the button once would turn on all lights white, press again, then a final press would be back to auto.
Iām trying to find macro references to see if this is possible to do and if even makes sense.
Correct. This is a new SLB feature. Iām trying to combine the new E-Stop programmable buttons to control the new rail lighting. If youāre on Facebook, I posted my lighting video proof of concept in the LongMill group
Chatting with the team, we donāt have the ability to ātoggle throughā the light settings, but that may be something we could look into add in the future. You can control the lights with the Action Buttons on the Estop, but you canāt cycle through settings at this time.
I figured macros were the best at least for now. I wasnāt sure if it was possible to write a macro to store a state variable and then read that on the next button press (macro run).
Does anyone have example macros I could plagiarize? Just looking for examples to maintain the same style references. Iāll dig through GitHub and cobble something together
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.
Thatās exactly how I was thinking, I just wasnāt sure of valid syntax or formatting rules. I was originally thinking the e-stop button but when I went back and re-read the manual, I missed the part where it was the macros were specified in the firmware and not the regular macros. (This is what I get for skimming documentation)
@hamanjam Jim, this is a bit off topic, but you can enter macro text for the 3 buttons on the e-stop. I have done it by entering macro text in $450-452. We are limited to 127 characters. I believe that @KGN point was that we could not assign his macro to those buttons.
This is from the documentation:
āThe buttons are customized in the SLBs EEPROM settings, using the Firmware section of either gSender or ioSender. Look for settings $450-452 to select one of the actions from the premade list, or select the first āMacroā option and type in your own g-code string to execute in settings $450-452.
Each macro can hold up to 127 characters, can run multiple lines using ā|ā for a line break, and runs any vanilla g-code but no math operations.ā
I tried out a few macros in firmware and they do work for a single state. I didnāt want to dedicate multiple buttons to the lighting which was why I was trying to work out the cycling script but options are nice to have. I expect over time, the workflow would determine how I will use it. Most likely a joystick shortcut is a good compromise. (I did find out while testing yesterday that I technically Q3 was valid to turn all lights on green)
@hamanjam I use an android tablet to control gSender so I can simply map @KGN macro to a key press on the tablet. I have yet to buy the led strip. Would you mind telling me what leds you are using and what power supply? Tks, Jim.
Yeah, Q3 is all green, anything higher just turns the lights off.
I took a peek at the RGB plugin and it should be relatively straight forward to add an option to cycle. Time permitting/no promises Iāll probably try to put together a pull request adding that option some time within the next few firmware releases.
Not really a product endorsement but hereās the notes I took. I bought these simply because I could get them overnight from Amazon. Anything with similar specs should work. Many LED strips have an additional red/white wires if they are longer for a power boost, and I canāt speak to if/how that is used. I didnāt need the extra power since my strip is only a single run.
One more option is to use one of the two aux switch output in series with the red wire going to ring connector or the power wire for the rail connector. Then set that aux output to mist enable and button action to mist.
Then that button with toggle power on/off to that set of LEDs. When power toggled back on the LEDs will not come back on until first movement of the axis
To add to the discussion, since Kevin made a really cool macro I had to add it to the gSender macro docs for future reference because I think it does a great job demoing how to work with macros in gSender. Also the tweak to the plugin Iām sure we could make since it may be handy to have available