mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal] Report previous allocation location for indexed resource duplicates (#3322)
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <wpi/jni_util.h>
|
||||
|
||||
#include "HALUtil.h"
|
||||
#include "edu_wpi_first_hal_AnalogJNI.h"
|
||||
#include "hal/AnalogAccumulator.h"
|
||||
@@ -29,9 +31,10 @@ Java_edu_wpi_first_hal_AnalogJNI_initializeAnalogInputPort
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto analog = HAL_InitializeAnalogInputPort((HAL_PortHandle)id, &status);
|
||||
CheckStatusRange(env, status, 0, HAL_GetNumAnalogInputs(),
|
||||
hal::getPortHandleChannel((HAL_PortHandle)id));
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
auto analog =
|
||||
HAL_InitializeAnalogInputPort((HAL_PortHandle)id, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return (jint)analog;
|
||||
}
|
||||
|
||||
@@ -57,10 +60,10 @@ Java_edu_wpi_first_hal_AnalogJNI_initializeAnalogOutputPort
|
||||
(JNIEnv* env, jclass, jint id)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AnalogOutputHandle analog =
|
||||
HAL_InitializeAnalogOutputPort((HAL_PortHandle)id, &status);
|
||||
CheckStatusRange(env, status, 0, HAL_GetNumAnalogOutputs(),
|
||||
hal::getPortHandleChannel((HAL_PortHandle)id));
|
||||
auto stack = wpi::java::GetJavaStackTrace(env, "edu.wpi.first");
|
||||
HAL_AnalogOutputHandle analog = HAL_InitializeAnalogOutputPort(
|
||||
(HAL_PortHandle)id, stack.c_str(), &status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return (jlong)analog;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user