Artifact artf3925 : PCM : Can't find any user facing java/C++ API for getting/clearing PCM faults

Change-Id: If5cb5b08f685158c5317233c4d9bc8e688138df7
This commit is contained in:
Omar Zrien
2014-12-26 19:40:39 -05:00
parent 3c4a1d9a1a
commit 548941dd99
20 changed files with 671 additions and 3 deletions

View File

@@ -139,6 +139,103 @@ public class Compressor extends SensorBase implements LiveWindowSendable {
return on;
}
/**
* @return true if PCM is in fault state : Compressor Drive is
* disabled due to compressor current being too high.
*/
public boolean getCompressorCurrentTooHighFault() {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
boolean retval = CompressorJNI.getCompressorCurrentTooHighFault(m_pcm, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return retval;
}
/**
* @return true if PCM sticky fault is set : Compressor Drive is
* disabled due to compressor current being too high.
*/
public boolean getCompressorCurrentTooHighStickyFault() {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
boolean retval = CompressorJNI.getCompressorCurrentTooHighStickyFault(m_pcm, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return retval;
}
/**
* @return true if PCM sticky fault is set : Compressor output
* appears to be shorted.
*/
public boolean getCompressorShortedStickyFault() {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
boolean retval = CompressorJNI.getCompressorShortedStickyFault(m_pcm, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return retval;
}
/**
* @return true if PCM is in fault state : Compressor output
* appears to be shorted.
*/
public boolean getCompressorShortedFault() {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
boolean retval = CompressorJNI.getCompressorShortedFault(m_pcm, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return retval;
}
/**
* @return true if PCM sticky fault is set : Compressor does not
* appear to be wired, i.e. compressor is
* not drawing enough current.
*/
public boolean getCompressorNotConnectedStickyFault() {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
boolean retval = CompressorJNI.getCompressorNotConnectedStickyFault(m_pcm, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return retval;
}
/**
* @return true if PCM is in fault state : Compressor does not
* appear to be wired, i.e. compressor is
* not drawing enough current.
*/
public boolean getCompressorNotConnectedFault() {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
boolean retval = CompressorJNI.getCompressorNotConnectedFault(m_pcm, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return retval;
}
/**
* Clear ALL sticky faults inside PCM that Compressor is wired to.
*
* If a sticky fault is set, then it will be persistently cleared. Compressor drive
* maybe momentarily disable while flags are being cleared. Care should be
* taken to not call this too frequently, otherwise normal compressor
* functionality may be prevented.
*
* If no sticky faults are set then this call will have no effect.
*/
public void clearAllPCMStickyFaults() {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
CompressorJNI.clearAllPCMStickyFaults(m_pcm, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
}
@Override
public void startLiveWindowMode() {
}

View File

@@ -143,6 +143,30 @@ public class DoubleSolenoid extends SolenoidBase implements LiveWindowSendable {
if ((value & m_reverseMask) != 0) return Value.kReverse;
return Value.kOff;
}
/**
* Check if the forward solenoid is blacklisted.
* If a solenoid is shorted, it is added to the blacklist and
* disabled until power cycle, or until faults are cleared.
* @see clearAllPCMStickyFaults()
*
* @return If solenoid is disabled due to short.
*/
public boolean isFwdSolenoidBlackListed() {
int blackList = getPCMSolenoidBlackList();
return ((blackList & m_forwardMask) != 0);
}
/**
* Check if the reverse solenoid is blacklisted.
* If a solenoid is shorted, it is added to the blacklist and
* disabled until power cycle, or until faults are cleared.
* @see clearAllPCMStickyFaults()
*
* @return If solenoid is disabled due to short.
*/
public boolean isRevSolenoidBlackListed() {
int blackList = getPCMSolenoidBlackList();
return ((blackList & m_reverseMask) != 0);
}
/*
* Live Window code, only does anything if live window is activated.

View File

@@ -101,7 +101,18 @@ public class Solenoid extends SolenoidBase implements LiveWindowSendable {
int value = getAll() & ( 1 << m_channel);
return (value != 0);
}
/**
* Check if solenoid is blacklisted.
* If a solenoid is shorted, it is added to the blacklist and
* disabled until power cycle, or until faults are cleared.
* @see clearAllPCMStickyFaults()
*
* @return If solenoid is disabled due to short.
*/
public boolean isBlackListed() {
int value = getPCMSolenoidBlackList() & ( 1 << m_channel);
return (value != 0);
}
/*
* Live Window code, only does anything if live window is activated.
*/

View File

@@ -69,4 +69,63 @@ public abstract class SolenoidBase extends SensorBase {
HALUtil.checkStatus(status);
return value;
}
/**
* Reads complete solenoid blacklist for all 8 solenoids as a single byte.
*
* If a solenoid is shorted, it is added to the blacklist and
* disabled until power cycle, or until faults are cleared.
* @see clearAllPCMStickyFaults()
*
* @return The solenoid blacklist of all 8 solenoids on the module.
*/
public byte getPCMSolenoidBlackList() {
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
byte retval = SolenoidJNI.getPCMSolenoidBlackList(m_ports[0], status);
HALUtil.checkStatus(status);
return retval;
}
/**
* @return true if PCM sticky fault is set : The common
* highside solenoid voltage rail is too low,
* most likely a solenoid channel is shorted.
*/
public boolean getPCMSolenoidVoltageStickyFault() {
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
boolean retval = SolenoidJNI.getPCMSolenoidVoltageStickyFault(m_ports[0], status);
HALUtil.checkStatus(status);
return retval;
}
/**
* @return true if PCM is in fault state : The common
* highside solenoid voltage rail is too low,
* most likely a solenoid channel is shorted.
*/
public boolean getPCMSolenoidVoltageFault() {
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
boolean retval = SolenoidJNI.getPCMSolenoidVoltageFault(m_ports[0], status);
HALUtil.checkStatus(status);
return retval;
}
/**
* Clear ALL sticky faults inside PCM that Compressor is wired to.
*
* If a sticky fault is set, then it will be persistently cleared. Compressor drive
* maybe momentarily disable while flags are being cleared. Care should be
* taken to not call this too frequently, otherwise normal compressor
* functionality may be prevented.
*
* If no sticky faults are set then this call will have no effect.
*/
public void clearAllPCMStickyFaults() {
IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
SolenoidJNI.clearAllPCMStickyFaults(m_ports[0], status);
HALUtil.checkStatus(status);
}
}

View File

@@ -14,4 +14,12 @@ public class CompressorJNI extends JNIWrapper {
public static native boolean getPressureSwitch(ByteBuffer pcm_pointer, IntBuffer status);
public static native float getCompressorCurrent(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getCompressorCurrentTooHighFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getCompressorCurrentTooHighStickyFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getCompressorShortedStickyFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getCompressorShortedFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getCompressorNotConnectedStickyFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getCompressorNotConnectedFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native void clearAllPCMStickyFaults(ByteBuffer pcm_pointer, IntBuffer status);
}

View File

@@ -7,4 +7,9 @@ public class SolenoidJNI extends JNIWrapper {
public static native ByteBuffer getPortWithModule(byte module, byte channel);
public static native void setSolenoid(ByteBuffer port, byte on, IntBuffer status);
public static native byte getSolenoid(ByteBuffer port, IntBuffer status);
public static native byte getPCMSolenoidBlackList(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getPCMSolenoidVoltageStickyFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native boolean getPCMSolenoidVoltageFault(ByteBuffer pcm_pointer, IntBuffer status);
public static native void clearAllPCMStickyFaults(ByteBuffer pcm_pointer, IntBuffer status);
}