mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[newCommands] Trigger: Allow override of debounce type (#3845)
Previously Trigger could only be debounced on rising edges. This change preserves the default behavior but adds the capability to override it.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include <frc/filter/Debouncer.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/span.h>
|
||||
|
||||
@@ -350,10 +351,13 @@ class Trigger {
|
||||
* Creates a new debounced trigger from this trigger - it will become active
|
||||
* when this trigger has been active for longer than the specified period.
|
||||
*
|
||||
* @param debounceTime the debounce period
|
||||
* @return the debounced trigger
|
||||
* @param debounceTime The debounce period.
|
||||
* @param type The debounce type.
|
||||
* @return The debounced trigger.
|
||||
*/
|
||||
Trigger Debounce(units::second_t debounceTime);
|
||||
Trigger Debounce(units::second_t debounceTime,
|
||||
frc::Debouncer::DebounceType type =
|
||||
frc::Debouncer::DebounceType::kRising);
|
||||
|
||||
private:
|
||||
std::function<bool()> m_isActive;
|
||||
|
||||
Reference in New Issue
Block a user