Bring PowerDistributionPanel in ahal up-to-date
The previous code wasn't working with 2020 WPILib/images. Not that we
really rely on this code, but it's good to keep it working.
Change-Id: I2b5e013f71181119db41c09482183c4cbb708f2f
diff --git a/frc971/wpilib/ahal/PowerDistributionPanel.cc b/frc971/wpilib/ahal/PowerDistributionPanel.cc
index d9d106b..8359cdb 100644
--- a/frc971/wpilib/ahal/PowerDistributionPanel.cc
+++ b/frc971/wpilib/ahal/PowerDistributionPanel.cc
@@ -22,13 +22,10 @@
/**
* Initialize the PDP.
*/
-PowerDistributionPanel::PowerDistributionPanel(int module) : m_module(module) {
+PowerDistributionPanel::PowerDistributionPanel(int module) {
int32_t status = 0;
- HAL_InitializePDP(m_module, &status);
+ m_handle = HAL_InitializePDP(module, &status);
if (status != 0) {
- // wpi_setErrorWithContextRange(status, 0, HAL_GetNumPDPModules(), module,
- // HAL_GetErrorMessage(status));
- m_module = -1;
return;
}
}
@@ -41,7 +38,7 @@
double PowerDistributionPanel::GetVoltage() const {
int32_t status = 0;
- double voltage = HAL_GetPDPVoltage(m_module, &status);
+ double voltage = HAL_GetPDPVoltage(m_handle, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");
@@ -58,7 +55,7 @@
double PowerDistributionPanel::GetTemperature() const {
int32_t status = 0;
- double temperature = HAL_GetPDPTemperature(m_module, &status);
+ double temperature = HAL_GetPDPTemperature(m_handle, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");
@@ -81,7 +78,7 @@
WPI_LIB_FATAL_ERROR(ChannelIndexOutOfRange, buf.str());
}
- double current = HAL_GetPDPChannelCurrent(m_module, channel, &status);
+ double current = HAL_GetPDPChannelCurrent(m_handle, channel, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");
@@ -98,7 +95,7 @@
double PowerDistributionPanel::GetTotalCurrent() const {
int32_t status = 0;
- double current = HAL_GetPDPTotalCurrent(m_module, &status);
+ double current = HAL_GetPDPTotalCurrent(m_handle, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");
@@ -115,7 +112,7 @@
double PowerDistributionPanel::GetTotalPower() const {
int32_t status = 0;
- double power = HAL_GetPDPTotalPower(m_module, &status);
+ double power = HAL_GetPDPTotalPower(m_handle, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");
@@ -132,7 +129,7 @@
double PowerDistributionPanel::GetTotalEnergy() const {
int32_t status = 0;
- double energy = HAL_GetPDPTotalEnergy(m_module, &status);
+ double energy = HAL_GetPDPTotalEnergy(m_handle, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");
@@ -149,7 +146,7 @@
void PowerDistributionPanel::ResetTotalEnergy() {
int32_t status = 0;
- HAL_ResetPDPTotalEnergy(m_module, &status);
+ HAL_ResetPDPTotalEnergy(m_handle, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");
@@ -162,7 +159,7 @@
void PowerDistributionPanel::ClearStickyFaults() {
int32_t status = 0;
- HAL_ClearPDPStickyFaults(m_module, &status);
+ HAL_ClearPDPStickyFaults(m_handle, &status);
if (status) {
WPI_LIB_FATAL_ERROR(Timeout, "");