Open
Description
Describe the bug
After #7839, the debounce filter can have its debounce type changed on the fly. Changing the debounce type does not properly set the baseline value, so the debouncer does not work as expected. For example, if you construct a kRising
filter and change it to a kFalling
filter, m_baseline
is not reset to true
.
To Reproduce
Steps to reproduce the behavior:
Run this unit test:
@Test
public void testChangeDebouncer() throws Exception {
var debouncer = new Debouncer(0.1, DebounceType.kRising);
debouncer.setDebounceType(DebounceType.kFalling);
assertTrue(debouncer.calculate(false));
}
Expected behavior
If the debounce type can be changed on the fly, the debounce behavior must also change.