2014-06-13 17:45:10 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
|
2014-06-13 17:45:10 -04:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2014-06-13 17:45:10 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-05-25 22:40:15 -07:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-05-25 22:38:11 -07:00
|
|
|
#include <memory>
|
2016-09-05 13:55:31 -07:00
|
|
|
#include <string>
|
2016-05-25 22:38:11 -07:00
|
|
|
|
2016-07-12 10:45:14 -07:00
|
|
|
#include "HAL/Types.h"
|
2016-05-20 17:30:37 -07:00
|
|
|
#include "LiveWindow/LiveWindowSendable.h"
|
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
|
|
|
|
|
|
|
|
/**
|
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
|
2016-09-06 00:01:45 -07:00
|
|
|
explicit Compressor(int pcmID = GetDefaultSolenoidModule());
|
2015-06-24 01:06:29 -07:00
|
|
|
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;
|
2015-07-29 16:48:04 -04:00
|
|
|
void InitTable(std::shared_ptr<ITable> subTable) override;
|
|
|
|
|
std::shared_ptr<ITable> GetTable() const override;
|
2015-08-13 23:17:19 -07:00
|
|
|
void ValueChanged(ITable* source, llvm::StringRef key,
|
|
|
|
|
std::shared_ptr<nt::Value> value, bool isNew) override;
|
2015-06-25 15:07:55 -04:00
|
|
|
|
|
|
|
|
protected:
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_CompressorHandle m_compressorHandle;
|
2015-06-25 15:07:55 -04:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void SetCompressor(bool on);
|
2016-09-06 00:01:45 -07:00
|
|
|
int m_module;
|
2015-06-25 15:07:55 -04:00
|
|
|
|
2015-11-23 00:46:05 -08:00
|
|
|
std::shared_ptr<ITable> m_table;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|