bdurbrow / grbl-Mega

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on an Arduino Mega2560
https://github.com/gnea/grbl/wiki
MIT License
35 stars 8 forks source link

Created DONT_SWITCH_SPINDLE_ENABLE_FOR_LASER #26

Open Saur0o0n opened 4 years ago

Saur0o0n commented 4 years ago

Created DONT_SWITCH_SPINDLE_ENABLE_FOR_LASER switch to control weather to change state of SPINDLE_ENABLE pin wile operating with LASER. By default it's on - so no SPINDLE_ENABLE with laser. When disabled it does not change the code at all - so it should be completely safe. If you are unsure, you can make it disabled by default - but this is behaviour that I think should be default, at least with all the laser diode HW I had contact with.

sinfocomp commented 4 years ago

can this be optional ? i use a CO2 laser and use the spindle enable as a way to ARM my laser, this enable line provides the laser controller psu a way to be ready to fire and react to pwm faster than from a cold start (since tube is keept pre ionized)

Saur0o0n commented 4 years ago

It is optional - if you disable DONT_SWITCH_SPINDLE_ENABLE_FOR_LASER (comment out #define DONT_SWITCH_SPINDLE_ENABLE_FOR_LASER) - it's working like before and like spindle works. Everytime there is M3/M4 switched, SPINDLE_ENABLE goes high (or low - depedning on additional INVERT_SPINDLE_ENABLE_PIN). If you enable DONT_SWITCH_SPINDLE_ENABLE_FOR_LASER, and you switch GRBL into LASER mode (with $32=1 setting) - SPINDLE_ENABLE is not changed on M3/M4. So it's up to you which mode is for you. I've this change, because I have spindle driver connected all the time, and I only disconnect spindle when connecting laser. In this configuration spindle driver also was activated (even when only laser was working) - it does not seemed right to me :)