From 0965d60a71028f0ce23e5b1e70b86f4c7932cd4e Mon Sep 17 00:00:00 2001 From: Omar Zrien Date: Sat, 21 May 2016 02:08:35 -0400 Subject: [PATCH] Fixed a bug where using the two parameter constructor for CANTalon could cause invert-direction to not be initialized. (#26) Original fix from Jacob Caporuscio --- wpilibc/Athena/include/CANTalon.h | 6 +++++- wpilibc/Athena/src/CANTalon.cpp | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wpilibc/Athena/include/CANTalon.h b/wpilibc/Athena/include/CANTalon.h index 8463217c62..82d5f069b8 100644 --- a/wpilibc/Athena/include/CANTalon.h +++ b/wpilibc/Athena/include/CANTalon.h @@ -573,7 +573,11 @@ class CANTalon : public MotorSafety, // LiveWindow stuff. std::shared_ptr m_table; - bool m_isInverted; + /** + * Flips the output direction during open-loop modes like percent + * voltage, or certain closed loop modes like speed/current mode. + */ + bool m_isInverted = false; HasBeenMoved m_hasBeenMoved; }; diff --git a/wpilibc/Athena/src/CANTalon.cpp b/wpilibc/Athena/src/CANTalon.cpp index e94513fddd..fb6b66824b 100644 --- a/wpilibc/Athena/src/CANTalon.cpp +++ b/wpilibc/Athena/src/CANTalon.cpp @@ -38,7 +38,6 @@ CANTalon::CANTalon(int deviceNumber) m_safetyHelper(new MotorSafetyHelper(this)) { ApplyControlMode(m_controlMode); m_impl->SetProfileSlotSelect(m_profile); - m_isInverted = false; LiveWindow::GetInstance()->AddActuator("CANTalon", m_deviceNumber, this); } /**