mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Fix PowerDistribution.GetAllCurrents() (#6025)
This commit is contained in:
@@ -179,15 +179,18 @@ JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_PowerDistributionJNI_getAllCurrents
|
||||
(JNIEnv* env, jclass, jint handle, jdoubleArray jarr)
|
||||
{
|
||||
double storage[16];
|
||||
int32_t status = 0;
|
||||
// TODO fix me
|
||||
HAL_GetPowerDistributionAllChannelCurrents(handle, storage, 16, &status);
|
||||
int32_t size = HAL_GetPowerDistributionNumChannels(handle, &status);
|
||||
wpi::SmallVector<double, 24> storage;
|
||||
storage.resize_for_overwrite(size);
|
||||
|
||||
HAL_GetPowerDistributionAllChannelCurrents(handle, storage.data(), size,
|
||||
&status);
|
||||
if (!CheckStatus(env, status, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
env->SetDoubleArrayRegion(jarr, 0, 16, storage);
|
||||
env->SetDoubleArrayRegion(jarr, 0, size, storage.data());
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user