Fix status buffer allocation in SolenoidBase

This fixes [artf3488] and [artf3506]

Change-Id: I6e89fc7bfc8d6c38a4bbf364a0fad412ab54e225
This commit is contained in:
Thomas Clark
2014-09-10 11:36:50 -04:00
parent 2144b853d1
commit 15abbb36c2

View File

@@ -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;
}