mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Merge "Fix status buffer allocation in SolenoidBase"
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