Welcome to Our Community

Some features disabled for guests. Register Today.

Spindle/Laser Mode Toggle

Discussion in 'Control Software' started by Doug Martin, Oct 3, 2021.

  1. Doug Martin

    Builder

    Joined:
    Sep 21, 2017
    Messages:
    13
    Likes Received:
    1
    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.
     
  2. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    13,751
    Likes Received:
    4,070

    Macros indeed. Just put $32=1/0 as gcode commands each in its own macro.
     
  3. Doug Martin

    Builder

    Joined:
    Sep 21, 2017
    Messages:
    13
    Likes Received:
    1
    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.
     
  4. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    13,751
    Likes Received:
    4,070
    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
     
  5. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,239
    Likes Received:
    1,815
    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.
     
    Peter Van Der Walt likes this.
  6. Doug Martin

    Builder

    Joined:
    Sep 21, 2017
    Messages:
    13
    Likes Received:
    1
    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.
     
  7. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    13,751
    Likes Received:
    4,070
    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
     
    David the swarfer likes this.
  8. Doug Martin

    Builder

    Joined:
    Sep 21, 2017
    Messages:
    13
    Likes Received:
    1
    Thanks, Peter. I appreciate your help with this.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice