mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
Remove old driver station code
We don't need to send status data from the user program anymore Change-Id: Ifbdb037cfb4e36681914dd7a3a2f5c56cbead6a2
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "DashboardBase.h"
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include "HAL/HAL.hpp"
|
||||
#include "HAL/Semaphore.hpp"
|
||||
|
||||
/**
|
||||
* Pack data into the "user data" field that gets sent to the dashboard laptop
|
||||
* via the driver station.
|
||||
*/
|
||||
class Dashboard : public DashboardBase
|
||||
{
|
||||
public:
|
||||
explicit Dashboard(MUTEX_ID statusDataSemaphore);
|
||||
virtual ~Dashboard();
|
||||
|
||||
enum Type {kI8, kI16, kI32, kU8, kU16, kU32, kFloat, kDouble, kBoolean, kString, kOther};
|
||||
enum ComplexType {kArray, kCluster};
|
||||
|
||||
void AddI8(int8_t value);
|
||||
void AddI16(int16_t value);
|
||||
void AddI32(int32_t value);
|
||||
void AddU8(uint8_t value);
|
||||
void AddU16(uint16_t value);
|
||||
void AddU32(uint32_t value);
|
||||
void AddFloat(float value);
|
||||
void AddDouble(double value);
|
||||
void AddBoolean(bool value);
|
||||
void AddString(char* value);
|
||||
void AddString(char* value, int32_t length);
|
||||
|
||||
void AddArray();
|
||||
void FinalizeArray();
|
||||
void AddCluster();
|
||||
void FinalizeCluster();
|
||||
|
||||
void Printf(const char *writeFmt, ...);
|
||||
|
||||
int32_t Finalize();
|
||||
void GetStatusBuffer(char** userStatusData, int32_t* userStatusDataSize);
|
||||
void Flush() {}
|
||||
private:
|
||||
static const int32_t kMaxDashboardDataSize = HAL_USER_STATUS_DATA_SIZE - sizeof(uint32_t) * 3 - sizeof(uint8_t); // 13 bytes needed for 3 size parameters and the sequence number
|
||||
|
||||
// Usage Guidelines...
|
||||
DISALLOW_COPY_AND_ASSIGN(Dashboard);
|
||||
|
||||
bool ValidateAdd(int32_t size);
|
||||
void AddedElement(Type type);
|
||||
bool IsArrayRoot();
|
||||
|
||||
char *m_userStatusData;
|
||||
int32_t m_userStatusDataSize;
|
||||
char *m_localBuffer;
|
||||
char *m_localPrintBuffer;
|
||||
char *m_packPtr;
|
||||
std::vector<Type> m_expectedArrayElementType;
|
||||
std::vector<int32_t> m_arrayElementCount;
|
||||
std::vector<int32_t*> m_arraySizePtr;
|
||||
std::stack<ComplexType> m_complexTypeStack;
|
||||
MUTEX_ID m_printSemaphore;
|
||||
MUTEX_ID m_statusDataSemaphore;
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "HAL/HAL.hpp"
|
||||
#include "ErrorBase.h"
|
||||
|
||||
class DashboardBase : public ErrorBase
|
||||
{
|
||||
public:
|
||||
virtual void GetStatusBuffer(char** userStatusData, int32_t* userStatusDataSize) = 0;
|
||||
virtual void Flush() = 0;
|
||||
virtual ~DashboardBase() {}
|
||||
protected:
|
||||
DashboardBase()
|
||||
{
|
||||
}
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(DashboardBase);
|
||||
};
|
||||
@@ -5,7 +5,6 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "Dashboard.h"
|
||||
#include "SensorBase.h"
|
||||
#include "Task.h"
|
||||
|
||||
@@ -48,45 +47,6 @@ public:
|
||||
double GetMatchTime();
|
||||
float GetBatteryVoltage();
|
||||
|
||||
// Get the default dashboard packers. These instances stay around even after
|
||||
// a call to SetHigh|LowPriorityDashboardPackerToUse() changes which packer
|
||||
// is in use. You can restore the default high priority packer by calling
|
||||
// SetHighPriorityDashboardPackerToUse(&GetHighPriorityDashboardPacker()).
|
||||
Dashboard& GetHighPriorityDashboardPacker()
|
||||
{
|
||||
return m_dashboardHigh;
|
||||
}
|
||||
Dashboard& GetLowPriorityDashboardPacker()
|
||||
{
|
||||
return m_dashboardLow;
|
||||
}
|
||||
|
||||
// Get/set the dashboard packers to use. This can sideline or restore the
|
||||
// default packers. Initializing SmartDashboard changes the high priority
|
||||
// packer in use so beware that the default packer will then be idle. These
|
||||
// methods support any kind of DashboardBase, e.g. a Dashboard or a
|
||||
// SmartDashboard.
|
||||
DashboardBase* GetHighPriorityDashboardPackerInUse()
|
||||
{
|
||||
return m_dashboardInUseHigh;
|
||||
}
|
||||
DashboardBase* GetLowPriorityDashboardPackerInUse()
|
||||
{
|
||||
return m_dashboardInUseLow;
|
||||
}
|
||||
void SetHighPriorityDashboardPackerToUse(DashboardBase* db)
|
||||
{
|
||||
m_dashboardInUseHigh = db;
|
||||
}
|
||||
void SetLowPriorityDashboardPackerToUse(DashboardBase* db)
|
||||
{
|
||||
m_dashboardInUseLow = db;
|
||||
}
|
||||
|
||||
void IncrementUpdateNumber()
|
||||
{
|
||||
m_updateNumber++;
|
||||
}
|
||||
MUTEX_ID GetUserStatusDataSem()
|
||||
{
|
||||
return m_statusDataSemaphore;
|
||||
@@ -142,10 +102,6 @@ private:
|
||||
uint8_t m_digitalOut;
|
||||
MUTEX_ID m_statusDataSemaphore;
|
||||
Task m_task;
|
||||
Dashboard m_dashboardHigh; // the default dashboard packers
|
||||
Dashboard m_dashboardLow;
|
||||
DashboardBase* m_dashboardInUseHigh; // the current dashboard packers in use
|
||||
DashboardBase* m_dashboardInUseLow;
|
||||
SEMAPHORE_ID m_newControlData;
|
||||
MUTEX_ID m_packetDataAvailableSem;
|
||||
MULTIWAIT_ID m_waitForDataSem;
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "Commands/WaitUntilCommand.h"
|
||||
#include "Compressor.h"
|
||||
#include "Counter.h"
|
||||
#include "Dashboard.h"
|
||||
#include "DigitalInput.h"
|
||||
#include "DigitalOutput.h"
|
||||
#include "DigitalSource.h"
|
||||
|
||||
Reference in New Issue
Block a user