From 6a8fcbc40783ee01a3e89e876282c3d8174ce9d5 Mon Sep 17 00:00:00 2001 From: James Kuszmaul Date: Thu, 3 Dec 2015 16:18:51 -0500 Subject: [PATCH] Make C++ Analog Potentiometer test work. Previously, the AnalogOutput simulating a potentiometer was setting the output voltage assuming a supply votlage of 5V. Now it uses the actual "5V" that is being output. The Java test was already doing this correctly. Change-Id: Icbba89f9bc14ebe0005416de55dcac3a2727bf21 --- wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp b/wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp index c812029afb..70ca4e8823 100644 --- a/wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp +++ b/wpilibcIntegrationTests/src/AnalogPotentiometerTest.cpp @@ -8,11 +8,11 @@ #include #include #include +#include #include "TestBench.h" #include "gtest/gtest.h" static const double kScale = 270.0; -static const double kVoltage = 3.33; static const double kAngle = 180.0; class AnalogPotentiometerTest : public testing::Test { @@ -40,7 +40,7 @@ TEST_F(AnalogPotentiometerTest, TestInitialSettings) { } TEST_F(AnalogPotentiometerTest, TestRangeValues) { - m_fakePot->SetVoltage(kVoltage); + m_fakePot->SetVoltage(kAngle / kScale * ControllerPower::GetVoltage5V()); Wait(0.1); EXPECT_NEAR(kAngle, m_pot->Get(), 2.0) << "The potentiometer did not measure the correct angle.";