2021-02-07 18:12:08 -05:00
|
|
|
#ifndef __Rig_h__
|
|
|
|
#define __Rig_h__
|
|
|
|
|
|
|
|
#include "RigState.h"
|
|
|
|
|
|
|
|
enum UpdateSource {
|
|
|
|
NoSource,
|
|
|
|
RaduinoSource,
|
|
|
|
CATSource
|
|
|
|
};
|
|
|
|
|
|
|
|
class UBitxRig {
|
|
|
|
public:
|
2021-02-09 23:58:07 -05:00
|
|
|
inline void begin() {}
|
|
|
|
inline void update() {}
|
2021-02-15 00:04:29 -05:00
|
|
|
inline unsigned getFreqA() const { return catState.getFreqA(); }
|
|
|
|
inline unsigned getFreqB() const { return catState.getFreqB(); }
|
|
|
|
inline int getRIT() const { return catState.getRIT(); }
|
|
|
|
inline int getXIT() const { return catState.getXIT(); }
|
|
|
|
inline bool isVFOA() const { return catState.isVFOA(); }
|
|
|
|
inline bool isVFOB() const { return catState.isVFOB(); }
|
|
|
|
inline bool isSplit() const { return catState.isSplit(); }
|
|
|
|
inline bool isRITOn() const { return catState.isRITOn(); }
|
|
|
|
inline bool isXITOn() const { return catState.isXITOn(); }
|
|
|
|
inline bool isModeCW() const { return catState.isCW() && catState.isUSB(); }
|
|
|
|
inline bool isModeCWR() const { return catState.isCW() && catState.isLSB(); }
|
|
|
|
inline bool isModeUSB() const { return catState.isUSB() && !catState.isCW(); }
|
|
|
|
inline bool isModeLSB() const { return catState.isLSB() && !catState.isCW(); }
|
|
|
|
inline bool isAI() const { return autoInfo; }
|
|
|
|
//inline bool updatedByCAT() const { return lastUpdatedBy == CATSource; }
|
|
|
|
//inline bool updatedByRaduino() const { return lastUpdatedBy == RaduinoSource; }
|
|
|
|
|
|
|
|
//inline void clearUpdate() { lastUpdatedBy = NoSource; }
|
|
|
|
//inline void setRaduinoUpdate() { lastUpdatedBy = RaduinoSource; }
|
|
|
|
//inline void setCATUpdate() { lastUpdatedBy = CATSource; }
|
|
|
|
|
|
|
|
inline void setFreqA(unsigned freq) { catState.setFreqA(freq); }
|
|
|
|
inline void setFreqB(unsigned freq) { catState.setFreqB(freq); }
|
|
|
|
inline void setRIT(int freq) { catState.setRIT(freq); }
|
|
|
|
inline void setXIT(int freq) { catState.setXIT(freq); }
|
|
|
|
inline void selectVFOA() { catState.selectVFOA(); }
|
|
|
|
inline void selectVFOB() { catState.selectVFOA(); }
|
|
|
|
inline void toggleVFO() { catState.toggleVFO(); }
|
|
|
|
inline void setSplitOn() { catState.setSplitOn(); }
|
|
|
|
inline void setSplitOff() { catState.setSplitOff(); }
|
|
|
|
inline void setRITOn() { catState.setRITOn(); }
|
|
|
|
inline void setRITOff() { catState.setRITOff(); }
|
|
|
|
inline void setXITOn() { catState.setXITOn(); }
|
|
|
|
inline void setXITOff() { catState.setXITOff(); }
|
|
|
|
inline void setModeCW() { catState.setUSB(); catState.setCW(); }
|
|
|
|
inline void setModeCWR() { catState.setLSB(); catState.setCW(); }
|
|
|
|
inline void setModeUSB() { catState.setUSB(); catState.setCW(); }
|
|
|
|
inline void setModeLSB() { catState.setLSB(); catState.setCW(); }
|
2021-02-07 18:12:08 -05:00
|
|
|
|
|
|
|
inline void aiOn() { autoInfo = true; }
|
|
|
|
inline void aiOff() { autoInfo = false; }
|
|
|
|
|
2021-02-10 01:10:24 -05:00
|
|
|
inline void updateState(UBitxRigState& r, bool isCAT = false) {
|
|
|
|
if ((r.vfo[0] == state.vfo[0]) &&
|
|
|
|
(r.vfo[1] == state.vfo[1]) &&
|
|
|
|
(r.rit == state.rit) &&
|
|
|
|
(r.xit == state.xit) &&
|
|
|
|
(r.flags == state.flags)) {
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
state = r;
|
|
|
|
lastUpdatedBy = isCAT ? CATSource : RaduinoSource;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-12 23:19:14 -05:00
|
|
|
/********************************************************************/
|
|
|
|
// New functional/mode-based Rig methods
|
|
|
|
|
|
|
|
// AG
|
|
|
|
//void setVolOut(uint8_t level);
|
|
|
|
//uint8_t getVolOut();
|
|
|
|
|
|
|
|
// BD/BU
|
|
|
|
//void setBand();
|
|
|
|
//void getBand();
|
|
|
|
|
2021-02-07 18:12:08 -05:00
|
|
|
private:
|
|
|
|
bool autoInfo = false;
|
|
|
|
UpdateSource lastUpdatedBy = NoSource;
|
2021-02-15 00:04:29 -05:00
|
|
|
UBitxRigState catState;
|
|
|
|
UBitxRigState radState;
|
2021-02-07 18:12:08 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
extern UBitxRig Rig;
|
|
|
|
|
|
|
|
#endif
|