mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Fix Debouncer type-changing behavior (#7870)
Closes #7867 Properly resets the baseline upon switching the debounce type, and adds a test for such. Signed-off-by: swurl <swurl@swurl.xyz>
This commit is contained in:
@@ -71,7 +71,11 @@ class WPILIB_DLLEXPORT Debouncer {
|
||||
*
|
||||
* @param type Which type of state change the debouncing will be performed on.
|
||||
*/
|
||||
constexpr void SetDebounceType(DebounceType type) { m_debounceType = type; }
|
||||
constexpr void SetDebounceType(DebounceType type) {
|
||||
m_debounceType = type;
|
||||
|
||||
m_baseline = m_debounceType == DebounceType::kFalling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the debounce type.
|
||||
|
||||
Reference in New Issue
Block a user