mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[commands] Add ConditionalCommand getInterruptionBehavior (#5161)
This commit is contained in:
@@ -53,6 +53,18 @@ bool ConditionalCommand::RunsWhenDisabled() const {
|
||||
return m_runsWhenDisabled;
|
||||
}
|
||||
|
||||
Command::InterruptionBehavior ConditionalCommand::GetInterruptionBehavior()
|
||||
const {
|
||||
if (m_onTrue->GetInterruptionBehavior() ==
|
||||
InterruptionBehavior::kCancelSelf ||
|
||||
m_onFalse->GetInterruptionBehavior() ==
|
||||
InterruptionBehavior::kCancelSelf) {
|
||||
return InterruptionBehavior::kCancelSelf;
|
||||
} else {
|
||||
return InterruptionBehavior::kCancelIncoming;
|
||||
}
|
||||
}
|
||||
|
||||
void ConditionalCommand::InitSendable(wpi::SendableBuilder& builder) {
|
||||
CommandBase::InitSendable(builder);
|
||||
builder.AddStringProperty(
|
||||
|
||||
@@ -72,6 +72,8 @@ class ConditionalCommand
|
||||
|
||||
bool RunsWhenDisabled() const override;
|
||||
|
||||
InterruptionBehavior GetInterruptionBehavior() const override;
|
||||
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user