Squashed 'third_party/allwpilib_2019/' changes from bd05dfa1c..99e4f7dd2
99e4f7dd2 Fix SPI CS1 not working correctly (#1614)
60c2f5905 C++ CameraServer: initialize default Usb camera device number (#1601)
d55ca191b CameraServer: Add switched camera support (#1600)
e8b24717c C++ Shuffleboard fixes (#1595)
182758c05 Fix Ultrasonic sensor runner thread (#1598)
74f7ba04b Java PIDBase: Make setPIDSourceType and getPIDSourceType public (#1599)
997d4fdf4 Update HAL GetStackTrace to properly report user errors (#1594)
76d9e2663 uv: Add reuse to pipe (#1577)
a230c814c Add support for WPILib vscode extension for allwpilib C++ intellisense (#1590)
12cb77cd7 Fix DS Comm button tests (#1591)
8a9822a96 Allow multiple instances of the same PDP (#1582)
a9371a758 Fix missing exposure property on windows USB cameras (#1571)
6992f5421 cscore: Avoid crash if invalid (null) source set in MjpegServer (#1585)
43696956d Fix Watchdog incorrectly resetting expiration flag upon disable (#1580)
ae3fd5ada Fix docs search having unspecified module directory (#1568)
404666b29 Fix Halsim DS Button Format (#1583)
1eb4c99d1 Update README for 2019 changes (#1569)
910b9f3af Add support for camera descriptions on windows (#1572)
09d90b02f Remove prints and unecessary items from windows GetNetworkInterfaces (#1573)
0e1f9c2ed ntcore: Read ini escaped quotes correctly (#1579)
f156a0011 wpiutil uv: Pass IPC value of listening pipe to accepted pipe (#1576)
4a6087ed5 Disable watchdog test on mac (#1578)
88a09dd13 cscore: Handle USB camera integer menus (#1561)
7d1959636 Changed terminology from "Overload" to "Override" (#1563)
Change-Id: If58e497053b7e80f1f3d6182ad6060a186616a0f
git-subtree-dir: third_party/allwpilib_2019
git-subtree-split: 99e4f7dd2c497d24016b7cb0e6fe16b04d2db1e8
diff --git a/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp b/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp
index 771d81f..0de2004 100644
--- a/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp
+++ b/wpilibc/src/main/native/cpp/IterativeRobotBase.cpp
@@ -26,29 +26,29 @@
m_watchdog(period, [this] { PrintLoopOverrunMessage(); }) {}
void IterativeRobotBase::RobotInit() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void IterativeRobotBase::DisabledInit() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void IterativeRobotBase::AutonomousInit() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void IterativeRobotBase::TeleopInit() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void IterativeRobotBase::TestInit() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void IterativeRobotBase::RobotPeriodic() {
static bool firstRun = true;
if (firstRun) {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
firstRun = false;
}
}
@@ -56,7 +56,7 @@
void IterativeRobotBase::DisabledPeriodic() {
static bool firstRun = true;
if (firstRun) {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
firstRun = false;
}
}
@@ -64,7 +64,7 @@
void IterativeRobotBase::AutonomousPeriodic() {
static bool firstRun = true;
if (firstRun) {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
firstRun = false;
}
}
@@ -72,7 +72,7 @@
void IterativeRobotBase::TeleopPeriodic() {
static bool firstRun = true;
if (firstRun) {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
firstRun = false;
}
}
@@ -80,7 +80,7 @@
void IterativeRobotBase::TestPeriodic() {
static bool firstRun = true;
if (firstRun) {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
firstRun = false;
}
}
diff --git a/wpilibc/src/main/native/cpp/SampleRobot.cpp b/wpilibc/src/main/native/cpp/SampleRobot.cpp
index 338f7be..190f5d8 100644
--- a/wpilibc/src/main/native/cpp/SampleRobot.cpp
+++ b/wpilibc/src/main/native/cpp/SampleRobot.cpp
@@ -59,23 +59,23 @@
}
void SampleRobot::RobotInit() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void SampleRobot::Disabled() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void SampleRobot::Autonomous() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void SampleRobot::OperatorControl() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void SampleRobot::Test() {
- wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
+ wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
}
void SampleRobot::RobotMain() { m_robotMainOverridden = false; }
diff --git a/wpilibc/src/main/native/cpp/Watchdog.cpp b/wpilibc/src/main/native/cpp/Watchdog.cpp
index b67f94d..f7c1778 100644
--- a/wpilibc/src/main/native/cpp/Watchdog.cpp
+++ b/wpilibc/src/main/native/cpp/Watchdog.cpp
@@ -18,7 +18,7 @@
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;
}
@@ -160,8 +160,6 @@
auto thr = m_owner->GetThread();
if (!thr) return;
- m_isExpired = false;
-
thr->m_watchdogs.remove(this);
thr->m_cond.notify_all();
}
diff --git a/wpilibc/src/main/native/cpp/shuffleboard/BuiltInLayouts.cpp b/wpilibc/src/main/native/cpp/shuffleboard/BuiltInLayouts.cpp
deleted file mode 100644
index 5d09310..0000000
--- a/wpilibc/src/main/native/cpp/shuffleboard/BuiltInLayouts.cpp
+++ /dev/null
@@ -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"};
diff --git a/wpilibc/src/main/native/cpp/shuffleboard/BuiltInWidgets.cpp b/wpilibc/src/main/native/cpp/shuffleboard/BuiltInWidgets.cpp
deleted file mode 100644
index df6a1f3..0000000
--- a/wpilibc/src/main/native/cpp/shuffleboard/BuiltInWidgets.cpp
+++ /dev/null
@@ -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"};
diff --git a/wpilibc/src/main/native/cpp/shuffleboard/ShuffleboardContainer.cpp b/wpilibc/src/main/native/cpp/shuffleboard/ShuffleboardContainer.cpp
index 4954cff..f13116d 100644
--- a/wpilibc/src/main/native/cpp/shuffleboard/ShuffleboardContainer.cpp
+++ b/wpilibc/src/main/native/cpp/shuffleboard/ShuffleboardContainer.cpp
@@ -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) {}
@@ -27,6 +33,11 @@
}
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());
}
diff --git a/wpilibc/src/main/native/cpp/shuffleboard/ShuffleboardWidget.cpp b/wpilibc/src/main/native/cpp/shuffleboard/ShuffleboardWidget.cpp
new file mode 100644
index 0000000..4573516
--- /dev/null
+++ b/wpilibc/src/main/native/cpp/shuffleboard/ShuffleboardWidget.cpp
@@ -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)];
+}