mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Fix main function initialization (#1176)
I don't have a good way to ensure this always works, so this is going to be a documentation issue. But initializeHardwareConfiguration is now reentrant, so we can just have all tests call it.
This commit is contained in:
committed by
Peter Johnson
parent
f5b1028b5a
commit
89d15f061b
@@ -7,52 +7,24 @@
|
||||
|
||||
#include "RobotState.h"
|
||||
|
||||
#include "Base.h"
|
||||
#include "DriverStation.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::shared_ptr<RobotStateInterface> RobotState::impl;
|
||||
|
||||
void RobotState::SetImplementation(RobotStateInterface& i) {
|
||||
impl = std::shared_ptr<RobotStateInterface>(
|
||||
&i, NullDeleter<RobotStateInterface>());
|
||||
}
|
||||
|
||||
void RobotState::SetImplementation(std::shared_ptr<RobotStateInterface> i) {
|
||||
impl = i;
|
||||
}
|
||||
|
||||
bool RobotState::IsDisabled() {
|
||||
if (impl != nullptr) {
|
||||
return impl->IsDisabled();
|
||||
}
|
||||
return true;
|
||||
return DriverStation::GetInstance().IsDisabled();
|
||||
}
|
||||
|
||||
bool RobotState::IsEnabled() {
|
||||
if (impl != nullptr) {
|
||||
return impl->IsEnabled();
|
||||
}
|
||||
return false;
|
||||
return DriverStation::GetInstance().IsEnabled();
|
||||
}
|
||||
|
||||
bool RobotState::IsOperatorControl() {
|
||||
if (impl != nullptr) {
|
||||
return impl->IsOperatorControl();
|
||||
}
|
||||
return true;
|
||||
return DriverStation::GetInstance().IsOperatorControl();
|
||||
}
|
||||
|
||||
bool RobotState::IsAutonomous() {
|
||||
if (impl != nullptr) {
|
||||
return impl->IsAutonomous();
|
||||
}
|
||||
return false;
|
||||
return DriverStation::GetInstance().IsAutonomous();
|
||||
}
|
||||
|
||||
bool RobotState::IsTest() {
|
||||
if (impl != nullptr) {
|
||||
return impl->IsTest();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool RobotState::IsTest() { return DriverStation::GetInstance().IsTest(); }
|
||||
|
||||
Reference in New Issue
Block a user