mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Optimize Solenoid Gets. Fixes artf4730.
Implement GetAllSolenoids in the HAL so that SolenoidBase doesn't have to read each solenoid individually. Change-Id: I85559565949f7a7119ead410187235636a63f0ed
This commit is contained in:
committed by
Brad Miller (WPI)
parent
84ca2ab0f5
commit
906fe65e39
@@ -65,11 +65,7 @@ public abstract class SolenoidBase extends SensorBase {
|
||||
* @return The current value of all 8 solenoids on this module.
|
||||
*/
|
||||
public byte getAll() {
|
||||
byte value = 0;
|
||||
for (int i = 0; i < SensorBase.kSolenoidChannels; i++) {
|
||||
value |= (SolenoidJNI.getSolenoid(m_ports[i]) ? 1 : 0) << i;
|
||||
}
|
||||
return value;
|
||||
return SolenoidJNI.getAllSolenoids(m_ports[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,8 @@ public class SolenoidJNI extends JNIWrapper {
|
||||
|
||||
public static native boolean getSolenoid(long port);
|
||||
|
||||
public static native byte getAllSolenoids(long port);
|
||||
|
||||
public static native int getPCMSolenoidBlackList(long pcm_pointer);
|
||||
|
||||
public static native boolean getPCMSolenoidVoltageStickyFault(long pcm_pointer);
|
||||
|
||||
Reference in New Issue
Block a user