gnea/grbl

Limit switch alarm triggered also when releasing

SebastianKusykIFJ opened this issue · 8 comments

Hello,
I hit a limit switch, got error info from GRBL and resetted and unlocked it. However, when I started moving in the opposite direction, I also got the limit switch error when the switch was released and had to reset and unlock again. How to prevent this? Is it caused by switch bouncing / electrical oscillations or by GRBL itself? First I had NO wiring, changed to NC (and of course changed GRBL configuration - inverted limit pins), but it doesn't help. Also I have very long homing switch debounce time, 250 ms, but does this setting work only in homing mode or always for limit switches?

How can I prevent this from happening? I want the limit switch error to appear only when it's pressed, not released. Does GRBL interpret every change in input state as limit switch error, disregarding whether it's change from 0 to 1 or vice versa? Or can it be fixed with some low-pass filter, i.e. RC?

But nothing stops instantaneously so it has kept moving a certain distance, depends on speed, inertia…., past the trigger point.

It doesn't change anything. After I read the "limit switch" message, click reset, click unlock, send a command to move in the opposite direction, it has more than enough time to stop moving. Even if it were moving, it wouldn't affect limit switch's state (of course unless it's crushed) - it can be either pressed or not, nothing else.

Also the trigger point, the position where the switch triggers, is not the same as the ‘un-trigger’ point, the position at which the switch releases.

I know the 'trigger' point is a bit deeper than 'un-trigger', but again: the switch is still pressed when I reset GRBL, then I start moving in the opposite direction and I release the limit switch - so why GRBL behaves like I pressed it, not released?

Which parts of source code are responsible for limit switches? I tried to find it, but I couldn't.