grbl / grbl

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino
https://github.com/gnea/grbl/wiki
Other
5.48k stars 3.05k forks source link

Suggestion for a new $ command #1791

Open AntonioFromBrazil opened 2 years ago

AntonioFromBrazil commented 2 years ago

What about a new $33 command to say VARIABLE_SPINDLE = yes/no ? This would avoid the necessity to recompile & reload the Grbl firmware every time laser to spindle or vice-versa was changed...

langwadt commented 2 years ago

why do you need to change it between spindle and laser?

AntonioFromBrazil commented 2 years ago

My CNC accept both laser and spindle. For laser I use the power control through D11 (-Z). For spindle I use only on/off through spindle enable pin D12. So every time when I change tool from laser to spindle or spindle to laser I should change the variable_spindle definition in config.h and recompile/reload the grbl... When variable_spindle is defined M3 M5 commands affect only D11 but does not affect D12. I do not know why. To have D12 acting as spindle on/off switch you should to undef variable_spindle option in config.h It is crazy !!!

langwadt commented 2 years ago

look at the code in spindle_control.c try USE_SPINDLE_DIR_AS_ENABLE_PIN

and unless you are using a very old grbl you should be at https://github.com/gnea/grbl/ not here

AntonioFromBrazil commented 2 years ago

Great. It works but there is only one small problem. The D13 is put in active state for few seconds when the Arduino is turned on or reseted. But I think I can find a solution for this small inconvenience. Thanks for help.