mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Merge "Make PDP parameters consistent with other HAL functions."
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void initializePDP(int module);
|
||||
double getPDPTemperature(int32_t *status, uint8_t module);
|
||||
double getPDPVoltage(int32_t *status, uint8_t module);
|
||||
double getPDPChannelCurrent(uint8_t channel, int32_t *status, uint8_t module);
|
||||
double getPDPTotalCurrent(int32_t *status, uint8_t module);
|
||||
double getPDPTotalPower(int32_t *status, uint8_t module);
|
||||
double getPDPTotalEnergy(int32_t *status, uint8_t module);
|
||||
void resetPDPTotalEnergy(int32_t *status, uint8_t module);
|
||||
void clearPDPStickyFaults(int32_t *status, uint8_t module);
|
||||
void initializePDP(uint8_t module);
|
||||
double getPDPTemperature(uint8_t module, int32_t *status);
|
||||
double getPDPVoltage(uint8_t module, int32_t *status);
|
||||
double getPDPChannelCurrent(uint8_t module, uint8_t channel, int32_t *status);
|
||||
double getPDPTotalCurrent(uint8_t module, int32_t *status);
|
||||
double getPDPTotalPower(uint8_t module, int32_t *status);
|
||||
double getPDPTotalEnergy(uint8_t module, int32_t *status);
|
||||
void resetPDPTotalEnergy(uint8_t module, int32_t *status);
|
||||
void clearPDPStickyFaults(uint8_t module, int32_t *status);
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ static const int NUM_MODULE_NUMBERS = 63;
|
||||
|
||||
static PDP *pdp[NUM_MODULE_NUMBERS] = { NULL };
|
||||
|
||||
void initializePDP(int module) {
|
||||
void initializePDP(uint8_t module) {
|
||||
if(!pdp[module]) {
|
||||
pdp[module] = new PDP(module);
|
||||
}
|
||||
}
|
||||
|
||||
double getPDPTemperature(int32_t *status, uint8_t module) {
|
||||
double getPDPTemperature(uint8_t module, int32_t *status) {
|
||||
double temperature;
|
||||
|
||||
*status = pdp[module]->GetTemperature(temperature);
|
||||
@@ -20,7 +20,7 @@ double getPDPTemperature(int32_t *status, uint8_t module) {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
double getPDPVoltage(int32_t *status, uint8_t module) {
|
||||
double getPDPVoltage(uint8_t module, int32_t *status) {
|
||||
double voltage;
|
||||
|
||||
*status = pdp[module]->GetVoltage(voltage);
|
||||
@@ -28,7 +28,7 @@ double getPDPVoltage(int32_t *status, uint8_t module) {
|
||||
return voltage;
|
||||
}
|
||||
|
||||
double getPDPChannelCurrent(uint8_t channel, int32_t *status, uint8_t module) {
|
||||
double getPDPChannelCurrent(uint8_t module, uint8_t channel, int32_t *status) {
|
||||
double current;
|
||||
|
||||
*status = pdp[module]->GetChannelCurrent(channel, current);
|
||||
@@ -36,7 +36,7 @@ double getPDPChannelCurrent(uint8_t channel, int32_t *status, uint8_t module) {
|
||||
return current;
|
||||
}
|
||||
|
||||
double getPDPTotalCurrent(int32_t *status, uint8_t module) {
|
||||
double getPDPTotalCurrent(uint8_t module, int32_t *status) {
|
||||
double current;
|
||||
|
||||
*status = pdp[module]->GetTotalCurrent(current);
|
||||
@@ -44,7 +44,7 @@ double getPDPTotalCurrent(int32_t *status, uint8_t module) {
|
||||
return current;
|
||||
}
|
||||
|
||||
double getPDPTotalPower(int32_t *status, uint8_t module) {
|
||||
double getPDPTotalPower(uint8_t module, int32_t *status) {
|
||||
double power;
|
||||
|
||||
*status = pdp[module]->GetTotalPower(power);
|
||||
@@ -52,7 +52,7 @@ double getPDPTotalPower(int32_t *status, uint8_t module) {
|
||||
return power;
|
||||
}
|
||||
|
||||
double getPDPTotalEnergy(int32_t *status, uint8_t module) {
|
||||
double getPDPTotalEnergy(uint8_t module, int32_t *status) {
|
||||
double energy;
|
||||
|
||||
*status = pdp[module]->GetTotalEnergy(energy);
|
||||
@@ -60,11 +60,11 @@ double getPDPTotalEnergy(int32_t *status, uint8_t module) {
|
||||
return energy;
|
||||
}
|
||||
|
||||
void resetPDPTotalEnergy(int32_t *status, uint8_t module) {
|
||||
void resetPDPTotalEnergy(uint8_t module, int32_t *status) {
|
||||
*status = pdp[module]->ResetEnergy();
|
||||
}
|
||||
|
||||
void clearPDPStickyFaults(int32_t *status, uint8_t module) {
|
||||
void clearPDPStickyFaults(uint8_t module, int32_t *status) {
|
||||
*status = pdp[module]->ClearStickyFaults();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ PowerDistributionPanel::PowerDistributionPanel(uint8_t module)
|
||||
double PowerDistributionPanel::GetVoltage() const {
|
||||
int32_t status = 0;
|
||||
|
||||
double voltage = getPDPVoltage(&status, m_module);
|
||||
double voltage = getPDPVoltage(m_module, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
@@ -45,7 +45,7 @@ double PowerDistributionPanel::GetVoltage() const {
|
||||
double PowerDistributionPanel::GetTemperature() const {
|
||||
int32_t status = 0;
|
||||
|
||||
double temperature = getPDPTemperature(&status, m_module);
|
||||
double temperature = getPDPTemperature(m_module, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
@@ -67,7 +67,7 @@ double PowerDistributionPanel::GetCurrent(uint8_t channel) const {
|
||||
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
|
||||
}
|
||||
|
||||
double current = getPDPChannelCurrent(channel, &status, m_module);
|
||||
double current = getPDPChannelCurrent(m_module, channel, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
@@ -83,7 +83,7 @@ double PowerDistributionPanel::GetCurrent(uint8_t channel) const {
|
||||
double PowerDistributionPanel::GetTotalCurrent() const {
|
||||
int32_t status = 0;
|
||||
|
||||
double current = getPDPTotalCurrent(&status, m_module);
|
||||
double current = getPDPTotalCurrent(m_module, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
@@ -99,7 +99,7 @@ double PowerDistributionPanel::GetTotalCurrent() const {
|
||||
double PowerDistributionPanel::GetTotalPower() const {
|
||||
int32_t status = 0;
|
||||
|
||||
double power = getPDPTotalPower(&status, m_module);
|
||||
double power = getPDPTotalPower(m_module, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
@@ -115,7 +115,7 @@ double PowerDistributionPanel::GetTotalPower() const {
|
||||
double PowerDistributionPanel::GetTotalEnergy() const {
|
||||
int32_t status = 0;
|
||||
|
||||
double energy = getPDPTotalEnergy(&status, m_module);
|
||||
double energy = getPDPTotalEnergy(m_module, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
@@ -131,7 +131,7 @@ double PowerDistributionPanel::GetTotalEnergy() const {
|
||||
void PowerDistributionPanel::ResetTotalEnergy() {
|
||||
int32_t status = 0;
|
||||
|
||||
resetPDPTotalEnergy(&status, m_module);
|
||||
resetPDPTotalEnergy(m_module, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
@@ -144,7 +144,7 @@ void PowerDistributionPanel::ResetTotalEnergy() {
|
||||
void PowerDistributionPanel::ClearStickyFaults() {
|
||||
int32_t status = 0;
|
||||
|
||||
clearPDPStickyFaults(&status, m_module);
|
||||
clearPDPStickyFaults(m_module, &status);
|
||||
|
||||
if (status) {
|
||||
wpi_setWPIErrorWithContext(Timeout, "");
|
||||
|
||||
@@ -24,7 +24,7 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTemperatur
|
||||
(JNIEnv *env, jclass, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
double temperature = getPDPTemperature(&status, module);
|
||||
double temperature = getPDPTemperature(module, &status);
|
||||
CheckStatus(env, status, false);
|
||||
return temperature;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPVoltage
|
||||
(JNIEnv *env, jclass, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
double voltage = getPDPVoltage(&status, module);
|
||||
double voltage = getPDPVoltage(module, &status);
|
||||
CheckStatus(env, status, false);
|
||||
return voltage;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPChannelCur
|
||||
(JNIEnv *env, jclass, jbyte channel, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
double current = getPDPChannelCurrent(channel, &status, module);
|
||||
double current = getPDPChannelCurrent(module, channel, &status);
|
||||
CheckStatus(env, status, false);
|
||||
return current;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalCurre
|
||||
(JNIEnv *env, jclass, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
double current = getPDPTotalCurrent(&status, module);
|
||||
double current = getPDPTotalCurrent(module, &status);
|
||||
CheckStatus(env, status, false);
|
||||
return current;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalPower
|
||||
(JNIEnv *env, jclass, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
double power = getPDPTotalPower(&status, module);
|
||||
double power = getPDPTotalPower(module, &status);
|
||||
CheckStatus(env, status, false);
|
||||
return power;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_getPDPTotalEnerg
|
||||
(JNIEnv *env, jclass, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
double energy = getPDPTotalEnergy(&status, module);
|
||||
double energy = getPDPTotalEnergy(module, &status);
|
||||
CheckStatus(env, status, false);
|
||||
return energy;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_resetPDPTotalEnergy
|
||||
(JNIEnv *env, jclass, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
resetPDPTotalEnergy(&status, module);
|
||||
resetPDPTotalEnergy(module, &status);
|
||||
CheckStatus(env, status, false);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_PDPJNI_clearPDPStickyFault
|
||||
(JNIEnv *env, jclass, jint module)
|
||||
{
|
||||
int32_t status = 0;
|
||||
clearPDPStickyFaults(&status, module);
|
||||
clearPDPStickyFaults(module, &status);
|
||||
CheckStatus(env, status, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user