mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Fix status buffer allocation in SolenoidBase
This fixes [artf3488] and [artf3506] Change-Id: I6e89fc7bfc8d6c38a4bbf364a0fad412ab54e225
This commit is contained in:
@@ -46,7 +46,7 @@ public abstract class SolenoidBase extends SensorBase {
|
||||
* @param mask The channels you want to be affected.
|
||||
*/
|
||||
protected synchronized void set(int value, int mask) {
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
for (int i = 0; i < SensorBase.kSolenoidChannels; i++) {
|
||||
int local_mask = 1 << i;
|
||||
if ((mask & local_mask) != 0)
|
||||
@@ -62,7 +62,7 @@ public abstract class SolenoidBase extends SensorBase {
|
||||
*/
|
||||
public byte getAll() {
|
||||
byte value = 0;
|
||||
IntBuffer status = IntBuffer.allocate(1);
|
||||
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
|
||||
for (int i = 0; i < SensorBase.kSolenoidChannels; i++) {
|
||||
value |= SolenoidJNI.getSolenoid(m_ports[i], status) << i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user