mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
C++ Shuffleboard fixes (#1595)
* Fix C++ ShuffleboardComponent template type * Fix `WithWidget(WidgetType&)`not being properly capitalized * Fix data members across dll boundaries by using enum for built in types
This commit is contained in:
committed by
Peter Johnson
parent
182758c05b
commit
e8b24717c7
@@ -18,7 +18,7 @@ constexpr std::chrono::milliseconds Watchdog::kMinPrintPeriod;
|
||||
class Watchdog::Thread : public wpi::SafeThread {
|
||||
public:
|
||||
template <typename T>
|
||||
struct DerefGreater : public std::binary_function<T, T, bool> {
|
||||
struct DerefGreater {
|
||||
constexpr bool operator()(const T& lhs, const T& rhs) const {
|
||||
return *lhs > *rhs;
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 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. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "frc/shuffleboard/BuiltInLayouts.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const LayoutType BuiltInLayouts::kList{"List Layout"};
|
||||
const LayoutType BuiltInLayouts::kGrid{"Grid Layout"};
|
||||
@@ -1,35 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 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. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "frc/shuffleboard/BuiltInWidgets.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const WidgetType BuiltInWidgets::kTextView{"Text View"};
|
||||
const WidgetType BuiltInWidgets::kNumberSlider{"Number Slider"};
|
||||
const WidgetType BuiltInWidgets::kNumberBar{"Number Bar"};
|
||||
const WidgetType BuiltInWidgets::kDial{"Simple Dial"};
|
||||
const WidgetType BuiltInWidgets::kGraph{"Graph"};
|
||||
const WidgetType BuiltInWidgets::kBooleanBox{"Boolean Box"};
|
||||
const WidgetType BuiltInWidgets::kToggleButton{"Toggle Button"};
|
||||
const WidgetType BuiltInWidgets::kToggleSwitch{"Toggle Switch"};
|
||||
const WidgetType BuiltInWidgets::kVoltageView{"Voltage View"};
|
||||
const WidgetType BuiltInWidgets::kPowerDistributionPanel{"PDP"};
|
||||
const WidgetType BuiltInWidgets::kComboBoxChooser{"ComboBox Chooser"};
|
||||
const WidgetType BuiltInWidgets::kSplitButtonChooser{"Split Button Chooser"};
|
||||
const WidgetType BuiltInWidgets::kEncoder{"Encoder"};
|
||||
const WidgetType BuiltInWidgets::kSpeedController{"Speed Controller"};
|
||||
const WidgetType BuiltInWidgets::kCommand{"Command"};
|
||||
const WidgetType BuiltInWidgets::kPIDCommand{"PID Command"};
|
||||
const WidgetType BuiltInWidgets::kPIDController{"PID Controller"};
|
||||
const WidgetType BuiltInWidgets::kAccelerometer{"Accelerometer"};
|
||||
const WidgetType BuiltInWidgets::k3AxisAccelerometer{"3-Axis Accelerometer"};
|
||||
const WidgetType BuiltInWidgets::kGyro{"Gyro"};
|
||||
const WidgetType BuiltInWidgets::kRelay{"Relay"};
|
||||
const WidgetType BuiltInWidgets::kDifferentialDrive{"Differential Drivebase"};
|
||||
const WidgetType BuiltInWidgets::kMecanumDrive{"Mecanum Drivebase"};
|
||||
const WidgetType BuiltInWidgets::kCameraStream{"Camera Stream"};
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static constexpr const char* layoutStrings[] = {"List Layout", "Grid Layout"};
|
||||
|
||||
static constexpr const char* GetStringFromBuiltInLayout(BuiltInLayouts layout) {
|
||||
return layoutStrings[static_cast<int>(layout)];
|
||||
}
|
||||
|
||||
ShuffleboardContainer::ShuffleboardContainer(const wpi::Twine& title)
|
||||
: ShuffleboardValue(title) {}
|
||||
|
||||
@@ -26,6 +32,11 @@ ShuffleboardContainer::GetComponents() const {
|
||||
return m_components;
|
||||
}
|
||||
|
||||
ShuffleboardLayout& ShuffleboardContainer::GetLayout(const wpi::Twine& title,
|
||||
BuiltInLayouts type) {
|
||||
return GetLayout(title, GetStringFromBuiltInLayout(type));
|
||||
}
|
||||
|
||||
ShuffleboardLayout& ShuffleboardContainer::GetLayout(const wpi::Twine& title,
|
||||
const LayoutType& type) {
|
||||
return GetLayout(title, type.GetLayoutName());
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 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. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardWidget.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static constexpr const char* widgetStrings[] = {
|
||||
"Text View",
|
||||
"Number Slider",
|
||||
"Number Bar",
|
||||
"Simple Dial",
|
||||
"Graph",
|
||||
"Boolean Box",
|
||||
"Toggle Button",
|
||||
"Toggle Switch",
|
||||
"Voltage View",
|
||||
"PDP",
|
||||
"ComboBox Chooser",
|
||||
"Split Button Chooser",
|
||||
"Encoder",
|
||||
"Speed Controller",
|
||||
"Command",
|
||||
"PID Command",
|
||||
"PID Controller",
|
||||
"Accelerometer",
|
||||
"3-Axis Accelerometer",
|
||||
"Gyro",
|
||||
"Relay",
|
||||
"Differential Drivebase",
|
||||
"Mecanum Drivebase",
|
||||
"Camera Stream",
|
||||
};
|
||||
|
||||
const char* detail::GetStringForWidgetType(BuiltInWidgets type) {
|
||||
return widgetStrings[static_cast<int>(type)];
|
||||
}
|
||||
Reference in New Issue
Block a user