From 628811ed03df8f7b3f0d83b6be08485fc1b248d0 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 6 Jan 2016 20:45:47 -0800 Subject: [PATCH] Correctly set smart dashboard type for AnalogGyro and ADXRS450_Gyro. The GetSmartDashboardType() function defined by GyroBase was returning the correct "Gyro", but the overrides in AnalogGyro and ADXRS450_Gyro were incorrectly changing this, resulting in SmartDashboard not recognizing these as being gyros. Additionally, AddSensor in the C++ AnalogGyro was setting the name to Gyro rather than AnalogGyro. Change-Id: Ib2e31cd2712cc2bc26c8082ed760175d0ee80fb6 --- wpilibc/Athena/include/ADXRS450_Gyro.h | 2 -- wpilibc/Athena/include/AnalogGyro.h | 2 -- wpilibc/Athena/src/ADXRS450_Gyro.cpp | 4 ---- wpilibc/Athena/src/AnalogGyro.cpp | 4 +--- .../athena/java/edu/wpi/first/wpilibj/ADXRS450_Gyro.java | 4 ---- .../src/athena/java/edu/wpi/first/wpilibj/AnalogGyro.java | 8 -------- 6 files changed, 1 insertion(+), 23 deletions(-) diff --git a/wpilibc/Athena/include/ADXRS450_Gyro.h b/wpilibc/Athena/include/ADXRS450_Gyro.h index 9317c8a318..7717f578fd 100644 --- a/wpilibc/Athena/include/ADXRS450_Gyro.h +++ b/wpilibc/Athena/include/ADXRS450_Gyro.h @@ -36,8 +36,6 @@ class ADXRS450_Gyro : public GyroBase { void Reset() override; void Calibrate() override; - std::string GetSmartDashboardType() const override; - private: SPI m_spi; diff --git a/wpilibc/Athena/include/AnalogGyro.h b/wpilibc/Athena/include/AnalogGyro.h index 818e4bd0f7..acb5b0f4c1 100644 --- a/wpilibc/Athena/include/AnalogGyro.h +++ b/wpilibc/Athena/include/AnalogGyro.h @@ -54,8 +54,6 @@ class AnalogGyro : public GyroBase { virtual void InitGyro(); void Calibrate() override; - std::string GetSmartDashboardType() const override; - protected: std::shared_ptr m_analog; diff --git a/wpilibc/Athena/src/ADXRS450_Gyro.cpp b/wpilibc/Athena/src/ADXRS450_Gyro.cpp index 7c91af68ef..a1ec4e3e77 100644 --- a/wpilibc/Athena/src/ADXRS450_Gyro.cpp +++ b/wpilibc/Athena/src/ADXRS450_Gyro.cpp @@ -151,7 +151,3 @@ float ADXRS450_Gyro::GetAngle() const { double ADXRS450_Gyro::GetRate() const { return (double)m_spi.GetAccumulatorLastValue() * kDegreePerSecondPerLSB; } - -std::string ADXRS450_Gyro::GetSmartDashboardType() const { - return "ADXRS450_Gyro"; -} diff --git a/wpilibc/Athena/src/AnalogGyro.cpp b/wpilibc/Athena/src/AnalogGyro.cpp index da88bcdda3..2574792d35 100644 --- a/wpilibc/Athena/src/AnalogGyro.cpp +++ b/wpilibc/Athena/src/AnalogGyro.cpp @@ -132,7 +132,7 @@ void AnalogGyro::InitGyro() { SetPIDSourceType(PIDSourceType::kDisplacement); HALReport(HALUsageReporting::kResourceType_Gyro, m_analog->GetChannel()); - LiveWindow::GetInstance()->AddSensor("Gyro", m_analog->GetChannel(), this); + LiveWindow::GetInstance()->AddSensor("AnalogGyro", m_analog->GetChannel(), this); } /** @@ -251,5 +251,3 @@ void AnalogGyro::SetDeadband(float volts) { (1 << m_analog->GetOversampleBits()); m_analog->SetAccumulatorDeadband(deadband); } - -std::string AnalogGyro::GetSmartDashboardType() const { return "AnalogGyro"; } diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/ADXRS450_Gyro.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/ADXRS450_Gyro.java index 4e99e95fdf..b5c6b255b6 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/ADXRS450_Gyro.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/ADXRS450_Gyro.java @@ -163,8 +163,4 @@ public class ADXRS450_Gyro extends GyroBase implements Gyro, PIDSource, LiveWind if (m_spi == null) return 0.0; return m_spi.getAccumulatorLastValue() * kDegreePerSecondPerLSB; } - - public String getSmartDashboardType() { - return "ADXRS450_Gyro"; - } } diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/AnalogGyro.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/AnalogGyro.java index 0ac50583e0..9b1d8b5775 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/AnalogGyro.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/AnalogGyro.java @@ -238,12 +238,4 @@ public class AnalogGyro extends GyroBase implements Gyro, PIDSource, LiveWindowS (int) (volts * 1e9 / m_analog.getLSBWeight() * (1 << m_analog.getOversampleBits())); m_analog.setAccumulatorDeadband(deadband); } - - /* - * Live Window code, only does anything if live window is activated. - */ - @Override - public String getSmartDashboardType() { - return "AnalogGyro"; - } }