2014-06-13 17:45:10 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) FIRST 2014. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2014-06-09 11:12:44 -04:00
|
|
|
#ifndef Compressor_H_
|
|
|
|
|
#define Compressor_H_
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2014-06-09 11:12:44 -04:00
|
|
|
#include "HAL/HAL.hpp"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "SensorBase.h"
|
2014-06-09 11:12:44 -04:00
|
|
|
#include "tables/ITableListener.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "LiveWindow/LiveWindowSendable.h"
|
|
|
|
|
|
|
|
|
|
/**
|
2014-06-13 17:45:10 -04:00
|
|
|
* PCM compressor
|
2014-05-02 17:54:01 -04:00
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
class Compressor : public SensorBase,
|
|
|
|
|
public LiveWindowSendable,
|
|
|
|
|
public ITableListener {
|
|
|
|
|
public:
|
2015-06-24 01:06:29 -07:00
|
|
|
// Default PCM ID is 0
|
|
|
|
|
explicit Compressor(uint8_t pcmID = GetDefaultSolenoidModule());
|
|
|
|
|
virtual ~Compressor() = default;
|
2015-06-25 15:07:55 -04:00
|
|
|
|
|
|
|
|
void Start();
|
|
|
|
|
void Stop();
|
|
|
|
|
bool Enabled() const;
|
|
|
|
|
|
|
|
|
|
bool GetPressureSwitchValue() const;
|
|
|
|
|
|
|
|
|
|
float GetCompressorCurrent() const;
|
|
|
|
|
|
|
|
|
|
void SetClosedLoopControl(bool on);
|
|
|
|
|
bool GetClosedLoopControl() const;
|
|
|
|
|
|
|
|
|
|
bool GetCompressorCurrentTooHighFault() const;
|
|
|
|
|
bool GetCompressorCurrentTooHighStickyFault() const;
|
|
|
|
|
bool GetCompressorShortedStickyFault() const;
|
|
|
|
|
bool GetCompressorShortedFault() const;
|
|
|
|
|
bool GetCompressorNotConnectedStickyFault() const;
|
|
|
|
|
bool GetCompressorNotConnectedFault() const;
|
|
|
|
|
void ClearAllPCMStickyFaults();
|
|
|
|
|
|
|
|
|
|
void UpdateTable() override;
|
|
|
|
|
void StartLiveWindowMode() override;
|
|
|
|
|
void StopLiveWindowMode() override;
|
|
|
|
|
std::string GetSmartDashboardType() const override;
|
|
|
|
|
void InitTable(ITable *subTable) override;
|
|
|
|
|
ITable *GetTable() const override;
|
|
|
|
|
void ValueChanged(ITable *source, const std::string &key, EntryValue value,
|
2015-06-23 04:49:51 -07:00
|
|
|
bool isNew) override;
|
2015-06-25 15:07:55 -04:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void *m_pcm_pointer;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void SetCompressor(bool on);
|
|
|
|
|
|
2015-06-24 01:06:29 -07:00
|
|
|
ITable *m_table = nullptr;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|
2014-06-09 11:12:44 -04:00
|
|
|
|
|
|
|
|
#endif /* Compressor_H_ */
|