feat(cpn): add support for surface radios inc Radiomaster MT12 (#5381)

This commit is contained in:
Neil Horne
2024-09-26 20:39:51 +10:00
committed by GitHub
parent 2bd62c95c8
commit 149e1a2df0
90 changed files with 3746 additions and 2387 deletions
+25 -2
View File
@@ -76,6 +76,19 @@ class BoardJson
typedef std::vector<SwitchDefn> SwitchesTable;
struct KeyDefn {
std::string tag = "";
std::string name = "";
std::string key = "";
std::string label = "";
Board::LookupValueType cfgYaml = Board::LVT_TAG;
Board::LookupValueType refYaml = Board::LVT_NAME;
KeyDefn() = default;
};
typedef std::vector<KeyDefn> KeysTable;
struct TrimDefn {
std::string tag = "";
std::string name = "";
@@ -106,6 +119,7 @@ class BoardJson
const int getInputSliderIndex(int index);
const QString getInputTag(int index) const;
const int getInputTagOffset(QString tag);
const int getInputThrottleIndex();
const int getInputTypeOffset(Board::AnalogInputType type);
const int getInputYamlIndex(const QString val, YamlLookupType ylt) const;
const QString getInputYamlName(int index, YamlLookupType ylt) const;
@@ -119,6 +133,9 @@ class BoardJson
const bool isInputStick(int index) const;
const bool isInputSwitch(int index) const;
const Board::KeyInfo getKeyInfo(int index) const;
const int getKeyIndex(const QString key) const;
const int getSwitchIndex(const QString val, Board::LookupValueType lvt) const;
const Board::SwitchInfo getSwitchInfo(int index) const;
const QString getSwitchName(int index) const;
@@ -144,6 +161,7 @@ private:
InputsTable *m_inputs;
SwitchesTable *m_switches;
TrimsTable *m_trims;
KeysTable *m_keys;
struct InputCounts {
unsigned int flexGyroAxes;
@@ -167,8 +185,10 @@ private:
SwitchCounts m_switchCnt;
static bool loadFile(Board::Type board, QString hwdefn, InputsTable * inputs, SwitchesTable * switches, TrimsTable * trims);
static void afterLoadFixups(Board::Type board, InputsTable * inputs, SwitchesTable * switches);
static bool loadFile(Board::Type board, QString hwdefn, InputsTable * inputs, SwitchesTable * switches,
KeysTable * keys, TrimsTable * trims);
static void afterLoadFixups(Board::Type board, InputsTable * inputs, SwitchesTable * switches,
KeysTable * keys, TrimsTable * trims);
static int getInputsCalibrated(const InputsTable * inputs);
@@ -179,6 +199,9 @@ private:
static int getInputTagOffset(const InputsTable * inputs, QString tag);
static int getInputTypeOffset(const InputsTable * inputs, Board::AnalogInputType type);
static int getKeyIndex(const KeysTable * keys, QString key);
static Board::KeyInfo getKeyInfo(const KeysTable * keys, int index);
static int getSwitchIndex(const SwitchesTable * switches, QString val, Board::LookupValueType lvt);
static Board::SwitchInfo getSwitchInfo(const SwitchesTable * switches, int index);
static QString getSwitchName(const SwitchesTable * switches, int index);