Input debounce setting
-
Hello everyone. I’m wondering if there is any way to adjust or set a debounce filter on an input pin.
I have a filament runout sensor running on a duet 3 and randomly the print will pause because it thinks it ran out of filament. It in fact hasn’t so I think there is some electrical interference that occasionally triggers the input. For my application I don’t need something that reads a low to high signal the instant it happens but rather a change that is sustained for at least 1 second. That would help eliminate false triggers.
Another example, I have a duet 2 WiFi running a CMC router I built and I’m using a push button to launch my tool probe macro (it sets the z height). But I have found that it can be erroneously triggered by my M8 (coolant on) relay signals. It is just electrical noise that randomly triggers it. But again a 1second filter would work great.
Is there anything like that? I would think it would be a debounce setting.
Thanks.
-
@baird1fa
You can use conditional gcode to achieve this in your filament-error.g file
Note: This assumes you're running RRF 3.4
The names are different in earlier versions.In this case I'm using a small delay and checking that the sensor is now indicating "OK" which would mean it's bouncing.
You could just as easily use a longer delay and reverse the logic to make sure the sensor status is still "not OK"G4 P10 ; delay 10ms to debounce if sensors.filamentMonitors[0].status="ok" echo "switch bounce detected - error cancelled" M99 ; break out of macro if sensor value is zero again (bouncing)
EDIT:
For your CNC just check the value of the GPIn using the same methodG4 P10 ; delay 10ms to debounce if sensors.gpIn[6].value=0 echo "switch bounce detected - error cancelled" M99 ; break out of macro if sensor value is zero again (bouncing)
-
-
@owend said in Input debounce setting:
G4 P10 ; delay 10ms to debounce if sensors.filamentMonitors[0].status="ok" echo "switch bounce detected - error cancelled" M99 ; break out of macro if sensor value is zero again (bouncing)
This seems to have worked. I haven't fully tested it yet, also I needed add a filament-error.g where I put this code (incase someone comes across this post in the future) I was just using the pause.g for the filament runout.