[wpilib] Don't print PD errors for LiveWindow reads (#3708)

If something happens with the PD connection, these would have spammed messages continuously.
This wasn't the case previously, and we don't want this behavior now.
This commit is contained in:
Thad House
2021-11-07 13:45:28 -08:00
committed by GitHub
parent 7699a1f827
commit 3dd41c0d37
4 changed files with 117 additions and 9 deletions

View File

@@ -292,4 +292,74 @@ Java_edu_wpi_first_hal_PowerDistributionJNI_getSwitchableChannel
return state;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getVoltageNoError
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getVoltageNoError
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double voltage = HAL_GetPowerDistributionVoltage(handle, &status);
return voltage;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getChannelCurrentNoError
* Signature: (II)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getChannelCurrentNoError
(JNIEnv* env, jclass, jint handle, jint channel)
{
int32_t status = 0;
double current =
HAL_GetPowerDistributionChannelCurrent(handle, channel, &status);
return current;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getTotalCurrentNoError
* Signature: (I)D
*/
JNIEXPORT jdouble JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getTotalCurrentNoError
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
double current = HAL_GetPowerDistributionTotalCurrent(handle, &status);
return current;
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: setSwitchableChannelNoError
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_setSwitchableChannelNoError
(JNIEnv* env, jclass, jint handle, jboolean enabled)
{
int32_t status = 0;
HAL_SetPowerDistributionSwitchableChannel(handle, enabled, &status);
}
/*
* Class: edu_wpi_first_hal_PowerDistributionJNI
* Method: getSwitchableChannelNoError
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_hal_PowerDistributionJNI_getSwitchableChannelNoError
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
auto state = HAL_GetPowerDistributionSwitchableChannel(handle, &status);
return state;
}
} // extern "C"