mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Add methods to check game and enabled state together (#2661)
This avoids users having to call both IsOperatorControl() and IsEnabled() to figure out if their robot is enabled and in the teleop state. The expression above involves calling two methods that each have their own lock. These new methods should only involve locking one mutex, since only one call is made to HAL_GetControlWord().
This commit is contained in:
committed by
GitHub
parent
5d1220e629
commit
526f26685d
@@ -154,8 +154,16 @@ bool RobotBase::IsDisabled() const { return m_ds.IsDisabled(); }
|
||||
|
||||
bool RobotBase::IsAutonomous() const { return m_ds.IsAutonomous(); }
|
||||
|
||||
bool RobotBase::IsAutonomousEnabled() const {
|
||||
return m_ds.IsAutonomousEnabled();
|
||||
}
|
||||
|
||||
bool RobotBase::IsOperatorControl() const { return m_ds.IsOperatorControl(); }
|
||||
|
||||
bool RobotBase::IsOperatorControlEnabled() const {
|
||||
return m_ds.IsOperatorControlEnabled();
|
||||
}
|
||||
|
||||
bool RobotBase::IsTest() const { return m_ds.IsTest(); }
|
||||
|
||||
bool RobotBase::IsNewDataAvailable() const { return m_ds.IsNewControlData(); }
|
||||
|
||||
Reference in New Issue
Block a user