mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Changes HAL to return -1 to 1 for joysticks (#35)
First part of the HAL changes. Returns -1 to 1 for joysticks instead of -128 to 127. Implemented by replacing the old structure with a new structure that uses floats instead of shorts.
This commit is contained in:
committed by
Peter Johnson
parent
a4f0c4fbe0
commit
54092378e9
@@ -146,7 +146,7 @@ Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_NativeH
|
||||
*/
|
||||
JNIEXPORT jbyte JNICALL
|
||||
Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_HALGetJoystickAxes(
|
||||
JNIEnv * env, jclass, jbyte joystickNum, jshortArray axesArray) {
|
||||
JNIEnv * env, jclass, jbyte joystickNum, jfloatArray axesArray) {
|
||||
NETCOMM_LOG(logDEBUG) << "Calling HALJoystickAxes";
|
||||
HALJoystickAxes axes;
|
||||
HALGetJoystickAxes(joystickNum, &axes);
|
||||
@@ -157,7 +157,7 @@ Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_HALGetJ
|
||||
ThrowIllegalArgumentException(env, "Native array size larger then passed in java array size");
|
||||
}
|
||||
|
||||
env->SetShortArrayRegion(axesArray, 0, axes.count, axes.axes);
|
||||
env->SetFloatArrayRegion(axesArray, 0, axes.count, axes.axes);
|
||||
|
||||
return axes.count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user