I used your component as a starter and I modified it for my needs. At the moment this is work in progress and I plan to post the final version when it is finished and tested.
For now the switch logic and the short circuit delay seems to work, but I tested them only in Halshow. I still don't know how I will make use of the speed output, and if the spindle twitch is working.
Suggestions are welcomed.
PS. How can I read the value of the programmed S gcode(ex. S1000M3)? Now it reads
spindle-vel-cmd-rpm but that means that my component will try to make a gear change to neutral every time I hit spindle stop. The programmed S value is also immune to the spindle override, which is one of the requirements. Thanks!
PPS. After a bit o research and mental gymnastics I came to the conclusion that is easier to remap two M codes (ex. M100/M101) to communicate with HAL to set a pin to neutral = true/false. I will use this as
guide for remapping
. After this, if the component will see neutral = false and speed input 0 it will do nothing. If am am already in a gear and neutral = true , it will move to neutral position on the switch.