I use the laser mode quite a bit and it would really nice to have a button (and mode indicator) that toggles between spindle ($32=0) and laser ($32=1) mode. I've been playing around with gSender and they have a pretty nice mechanism for toggling between spindle and laser and I would really like to see this in Control. I've toyed around with adding a macro to do this but I'm not too sure how to read/write GRBL settings and call custom functions using the Control Javascript interface. Is it possible to do either of these things (read and write GRBL settings and call custom functions) and, if so, is there a resource available that talks through the Control API in order to make this happen.
Yeah, I know I can do a quick macro for each function but I was hoping to create an indicator button in the top button bar to report the current status of the $32 setting and allow for toggling the setting. I wanted some quick indicator to show which mode I was in at any point in time with out having to go to the troubleshooting screen or run a $$ command in the console.
Or just setup your CAM toolchains to include $32=1 in laser jobs and $32=0 in non-laser jobs, then you don't have to be involved at all For injecting buttons and indicators, you'd have to use JS macros - but sending the command is a better way that relying on the manual process and indicators etc. Force the mode you want to be in for each job by having your CAM add the command to the headers
if you do this, remember to put a G4 P0.1 after any $xx=yy commands to allow/force GRBL to remain synced with the command stream. So you would have $32=1 G4 P0.1 to set laser mode. This does involve an EEPROM write and will use up your write cycles causing eventual death of the controller. A macro that probes the value and only changes it if needed will extend the life of the EEPROM a bit.
Thanks Peter and David. I guess I was wanting to go the macro/button/indicator path as I wasn't sure how well toggling the laser mode off an on in the g-code would work given that it involved an EEPROM write. David would you be able to point me to any resources that talk through the information you mentioned (using G4 to sync the command stream and write cycles affecting the controller life span). I suppose I probably wouldn't understand much of it but it might be pretty interesting anyway.
At least 100k - that's at least 100,000 times that it can be changed from one mode to the other (not times you send the command, if that bit doesn't change, that sector doesn't have a write) - ie not something to practically worry about See Grbl v1.1 Interface · gnea/grbl Wiki