mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +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
@@ -31,7 +31,7 @@ class MatchDataSender;
|
||||
* Provide access to the network communication data to / from the Driver
|
||||
* Station.
|
||||
*/
|
||||
class DriverStation : public ErrorBase, public RobotStateInterface {
|
||||
class DriverStation : public ErrorBase {
|
||||
public:
|
||||
enum Alliance { kRed, kBlue, kInvalid };
|
||||
enum MatchType { kNone, kPractice, kQualification, kElimination };
|
||||
@@ -186,35 +186,35 @@ class DriverStation : public ErrorBase, public RobotStateInterface {
|
||||
*
|
||||
* @return True if the robot is enabled and the DS is connected
|
||||
*/
|
||||
bool IsEnabled() const override;
|
||||
bool IsEnabled() const;
|
||||
|
||||
/**
|
||||
* Check if the robot is disabled.
|
||||
*
|
||||
* @return True if the robot is explicitly disabled or the DS is not connected
|
||||
*/
|
||||
bool IsDisabled() const override;
|
||||
bool IsDisabled() const;
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding autonomous mode.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in autonomous mode
|
||||
*/
|
||||
bool IsAutonomous() const override;
|
||||
bool IsAutonomous() const;
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding teleop mode.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in teleop mode
|
||||
*/
|
||||
bool IsOperatorControl() const override;
|
||||
bool IsOperatorControl() const;
|
||||
|
||||
/**
|
||||
* Check if the DS is commanding test mode.
|
||||
*
|
||||
* @return True if the robot is being commanded to be in test mode
|
||||
*/
|
||||
bool IsTest() const override;
|
||||
bool IsTest() const;
|
||||
|
||||
/**
|
||||
* Check if the DS is attached.
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace frc {
|
||||
|
||||
class HLUsageReportingInterface {
|
||||
public:
|
||||
virtual ~HLUsageReportingInterface() = default;
|
||||
virtual void ReportScheduler() = 0;
|
||||
virtual void ReportSmartDashboard() = 0;
|
||||
};
|
||||
|
||||
class HLUsageReporting {
|
||||
private:
|
||||
static HLUsageReportingInterface* impl;
|
||||
|
||||
public:
|
||||
static void SetImplementation(HLUsageReportingInterface* i);
|
||||
static void ReportScheduler();
|
||||
static void ReportSmartDashboard();
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -1,20 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HLUsageReporting.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class HardwareHLReporting : public HLUsageReportingInterface {
|
||||
public:
|
||||
virtual void ReportScheduler();
|
||||
virtual void ReportSmartDashboard();
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -11,23 +11,8 @@
|
||||
|
||||
namespace frc {
|
||||
|
||||
class RobotStateInterface {
|
||||
public:
|
||||
virtual ~RobotStateInterface() = default;
|
||||
virtual bool IsDisabled() const = 0;
|
||||
virtual bool IsEnabled() const = 0;
|
||||
virtual bool IsOperatorControl() const = 0;
|
||||
virtual bool IsAutonomous() const = 0;
|
||||
virtual bool IsTest() const = 0;
|
||||
};
|
||||
|
||||
class RobotState {
|
||||
private:
|
||||
static std::shared_ptr<RobotStateInterface> impl;
|
||||
|
||||
public:
|
||||
static void SetImplementation(RobotStateInterface& i);
|
||||
static void SetImplementation(std::shared_ptr<RobotStateInterface> i);
|
||||
static bool IsDisabled();
|
||||
static bool IsEnabled();
|
||||
static bool IsOperatorControl();
|
||||
|
||||
Reference in New Issue
Block a user