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
|
|
|
*/
|
2014-06-09 11:12:44 -04:00
|
|
|
class Compressor: public SensorBase, public LiveWindowSendable, public ITableListener {
|
2013-12-15 18:30:16 -05:00
|
|
|
public:
|
2014-06-13 17:45:10 -04:00
|
|
|
explicit Compressor(uint8_t pcmID);
|
2014-06-09 11:12:44 -04:00
|
|
|
Compressor();
|
2014-06-13 17:45:10 -04:00
|
|
|
virtual ~Compressor();
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
void Start();
|
|
|
|
|
void Stop();
|
2015-06-19 17:23:54 -07:00
|
|
|
bool Enabled() const;
|
2014-06-09 11:12:44 -04:00
|
|
|
|
2015-06-19 17:23:54 -07:00
|
|
|
bool GetPressureSwitchValue() const;
|
2014-06-13 17:45:10 -04:00
|
|
|
|
2015-06-19 17:23:54 -07:00
|
|
|
float GetCompressorCurrent() const;
|
2014-06-09 11:12:44 -04:00
|
|
|
|
|
|
|
|
void SetClosedLoopControl(bool on);
|
2015-06-19 17:23:54 -07:00
|
|
|
bool GetClosedLoopControl() const;
|
|
|
|
|
|
|
|
|
|
bool GetCompressorCurrentTooHighFault() const;
|
|
|
|
|
bool GetCompressorCurrentTooHighStickyFault() const;
|
|
|
|
|
bool GetCompressorShortedStickyFault() const;
|
|
|
|
|
bool GetCompressorShortedFault() const;
|
|
|
|
|
bool GetCompressorNotConnectedStickyFault() const;
|
|
|
|
|
bool GetCompressorNotConnectedFault() const;
|
2014-12-26 19:40:39 -05:00
|
|
|
void ClearAllPCMStickyFaults();
|
|
|
|
|
|
2015-06-19 17:23:54 -07:00
|
|
|
void UpdateTable() override;
|
|
|
|
|
void StartLiveWindowMode() override;
|
|
|
|
|
void StopLiveWindowMode() override;
|
|
|
|
|
std::string GetSmartDashboardType() const override;
|
|
|
|
|
void InitTable(ITable *subTable) override;
|
|
|
|
|
ITable *GetTable() const override;
|
2014-06-09 11:12:44 -04:00
|
|
|
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2014-06-09 11:12:44 -04:00
|
|
|
protected:
|
|
|
|
|
void *m_pcm_pointer;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2014-06-09 11:12:44 -04:00
|
|
|
private:
|
|
|
|
|
void InitCompressor(uint8_t module);
|
|
|
|
|
void SetCompressor(bool on);
|
2014-05-02 17:54:01 -04:00
|
|
|
|
2013-12-15 18:30:16 -05:00
|
|
|
ITable *m_table;
|
|
|
|
|
};
|
2014-06-09 11:12:44 -04:00
|
|
|
|
|
|
|
|
#endif /* Compressor_H_ */
|