Major formatting changes (breaks diffs). No code changes.

The changes made in this commit do not affect any actual code,
    they are purely aesthetic. I ran clang-format with google style
    over all .h/.cpp files in wpilibc that weren't in wpilibC++Sim
    or gtest, and the eclipse formatter over all of the Java files
    using the Google eclipse formatting configuration.

Change-Id: I9627bca0bc103c398ecc1c5ba17467193291ae63
This commit is contained in:
James Kuszmaul
2015-06-25 15:07:55 -04:00
parent bd64d9a7ef
commit 7eb8550bdb
470 changed files with 89798 additions and 77287 deletions

View File

@@ -6,10 +6,10 @@
#include "WPIErrors.h"
void Compressor::InitCompressor(uint8_t pcmID) {
m_table = 0;
m_pcm_pointer = initializeCompressor(pcmID);
m_table = 0;
m_pcm_pointer = initializeCompressor(pcmID);
SetClosedLoopControl(true);
SetClosedLoopControl(true);
}
/**
@@ -17,52 +17,44 @@ void Compressor::InitCompressor(uint8_t pcmID) {
*
* Uses the default PCM ID (0)
*/
Compressor::Compressor() {
InitCompressor(GetDefaultSolenoidModule());
}
Compressor::Compressor() { InitCompressor(GetDefaultSolenoidModule()); }
/**
* Constructor
*
* @param module The PCM ID to use (0-62)
*/
Compressor::Compressor(uint8_t pcmID) {
InitCompressor(pcmID);
}
Compressor::Compressor(uint8_t pcmID) { InitCompressor(pcmID); }
Compressor::~Compressor() {
}
Compressor::~Compressor() {}
/**
* Starts closed-loop control. Note that closed loop control is enabled by default.
* Starts closed-loop control. Note that closed loop control is enabled by
* default.
*/
void Compressor::Start() {
SetClosedLoopControl(true);
}
void Compressor::Start() { SetClosedLoopControl(true); }
/**
* Stops closed-loop control. Note that closed loop control is enabled by default.
* Stops closed-loop control. Note that closed loop control is enabled by
* default.
*/
void Compressor::Stop() {
SetClosedLoopControl(false);
}
void Compressor::Stop() { SetClosedLoopControl(false); }
/**
* Check if compressor output is active
* @return true if the compressor is on
*/
bool Compressor::Enabled() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getCompressor(m_pcm_pointer, &status);
value = getCompressor(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
@@ -70,224 +62,228 @@ bool Compressor::Enabled() const {
* @return true if pressure is low
*/
bool Compressor::GetPressureSwitchValue() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getPressureSwitch(m_pcm_pointer, &status);
value = getPressureSwitch(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Query how much current the compressor is drawing
* @return The current through the compressor, in amps
*/
float Compressor::GetCompressorCurrent() const {
int32_t status = 0;
float value;
int32_t status = 0;
float value;
value = getCompressorCurrent(m_pcm_pointer, &status);
value = getCompressorCurrent(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Enables or disables automatically turning the compressor on when the
* pressure is low.
* @param on Set to true to enable closed loop control of the compressor. False to disable.
* @param on Set to true to enable closed loop control of the compressor. False
* to disable.
*/
void Compressor::SetClosedLoopControl(bool on) {
int32_t status = 0;
int32_t status = 0;
setClosedLoopControl(m_pcm_pointer, on, &status);
setClosedLoopControl(m_pcm_pointer, on, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
}
/**
* Returns true if the compressor will automatically turn on when the
* pressure is low.
* @return True if closed loop control of the compressor is enabled. False if disabled.
* @return True if closed loop control of the compressor is enabled. False if
* disabled.
*/
bool Compressor::GetClosedLoopControl() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getClosedLoopControl(m_pcm_pointer, &status);
value = getClosedLoopControl(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Query if the compressor output has been disabled due to high current draw.
* @return true if PCM is in fault state : Compressor Drive is
* disabled due to compressor current being too high.
* @return true if PCM is in fault state : Compressor Drive is
* disabled due to compressor current being too high.
*/
bool Compressor::GetCompressorCurrentTooHighFault() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getCompressorCurrentTooHighFault(m_pcm_pointer, &status);
value = getCompressorCurrentTooHighFault(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Query if the compressor output has been disabled due to high current draw (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through code or the webdash.
* @return true if PCM sticky fault is set : Compressor Drive is
* disabled due to compressor current being too high.
* Query if the compressor output has been disabled due to high current draw
* (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through
* code or the webdash.
* @return true if PCM sticky fault is set : Compressor Drive is
* disabled due to compressor current being too high.
*/
bool Compressor::GetCompressorCurrentTooHighStickyFault() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getCompressorCurrentTooHighStickyFault(m_pcm_pointer, &status);
value = getCompressorCurrentTooHighStickyFault(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Query if the compressor output has been disabled due to a short circuit (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through code or the webdash.
* @return true if PCM sticky fault is set : Compressor output
* appears to be shorted.
* Query if the compressor output has been disabled due to a short circuit
* (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through
* code or the webdash.
* @return true if PCM sticky fault is set : Compressor output
* appears to be shorted.
*/
bool Compressor::GetCompressorShortedStickyFault() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getCompressorShortedStickyFault(m_pcm_pointer, &status);
value = getCompressorShortedStickyFault(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Query if the compressor output has been disabled due to a short circuit.
* @return true if PCM is in fault state : Compressor output
* appears to be shorted.
* @return true if PCM is in fault state : Compressor output
* appears to be shorted.
*/
bool Compressor::GetCompressorShortedFault() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getCompressorShortedFault(m_pcm_pointer, &status);
value = getCompressorShortedFault(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Query if the compressor output does not appear to be wired (sticky).
* A sticky fault will not clear on device reboot, it must be cleared through code or the webdash.
* @return true if PCM sticky fault is set : Compressor does not
* appear to be wired, i.e. compressor is
* A sticky fault will not clear on device reboot, it must be cleared through
* code or the webdash.
* @return true if PCM sticky fault is set : Compressor does not
* appear to be wired, i.e. compressor is
* not drawing enough current.
*/
bool Compressor::GetCompressorNotConnectedStickyFault() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getCompressorNotConnectedStickyFault(m_pcm_pointer, &status);
value = getCompressorNotConnectedStickyFault(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* Query if the compressor output does not appear to be wired.
* @return true if PCM is in fault state : Compressor does not
* appear to be wired, i.e. compressor is
* @return true if PCM is in fault state : Compressor does not
* appear to be wired, i.e. compressor is
* not drawing enough current.
*/
bool Compressor::GetCompressorNotConnectedFault() const {
int32_t status = 0;
bool value;
int32_t status = 0;
bool value;
value = getCompressorNotConnectedFault(m_pcm_pointer, &status);
value = getCompressorNotConnectedFault(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
return value;
return value;
}
/**
* 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 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.
*/
void Compressor::ClearAllPCMStickyFaults() {
int32_t status = 0;
int32_t status = 0;
clearAllPCMStickyFaults(m_pcm_pointer, &status);
clearAllPCMStickyFaults(m_pcm_pointer, &status);
if(status) {
wpi_setWPIError(Timeout);
}
if (status) {
wpi_setWPIError(Timeout);
}
}
void Compressor::UpdateTable() {
if(m_table) {
m_table->PutBoolean("Enabled", Enabled());
m_table->PutBoolean("Pressure switch", GetPressureSwitchValue());
}
if (m_table) {
m_table->PutBoolean("Enabled", Enabled());
m_table->PutBoolean("Pressure switch", GetPressureSwitchValue());
}
}
void Compressor::StartLiveWindowMode() {
void Compressor::StartLiveWindowMode() {}
void Compressor::StopLiveWindowMode() {}
std::string Compressor::GetSmartDashboardType() const { return "Compressor"; }
void Compressor::InitTable(ITable* subTable) {
m_table = subTable;
UpdateTable();
}
void Compressor::StopLiveWindowMode() {
}
std::string Compressor::GetSmartDashboardType() const {
return "Compressor";
}
void Compressor::InitTable(ITable *subTable) {
m_table = subTable;
UpdateTable();
}
ITable *Compressor::GetTable() const {
return m_table;
}
void Compressor::ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) {
if(value.b) Start();
else Stop();
ITable* Compressor::GetTable() const { return m_table; }
void Compressor::ValueChanged(ITable* source, const std::string& key,
EntryValue value, bool isNew) {
if (value.b)
Start();
else
Stop();
}