Beckhoff-USA-Community / SPT-Libraries

MIT License
88 stars 21 forks source link

DigitalSensor.ProcessInput not debouncing on falling edge #64

Open CalebStoll-DMC opened 4 months ago

CalebStoll-DMC commented 4 months ago

For E_DebounceMode.SimpleFlickerFilter mode on the DigitalSensor component, the Debounce Timer does not appear to work correctly when transitioning from 1 -> 0 on the Input. The "DebouncedInput" variable is a VAR type instead of VAR_INST so when it is reset at the top of the method call, TON_DebounceTimer.IN is always true when the Input is 1. The "Active" bit will turn on correctly because the timer stays on, but the timer doesn't reset when the Input changes from 1->0 and the "Active" bit will turn off immediately.

I believe a fix would just involve moving the DebouncedInput variable into the VAR_INST section to make sure the value is persistent. Am I using this wrong or is this a bug?

AB#5023