feat(radio): refactor of switch handling to better support customisable switches (#6095)
Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: 3djc <3djc@gh.com> Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
co-authored by
philmoz
3djc
elecpower
parent
28833f42e6
commit
0c8c39b134
@@ -40,7 +40,7 @@
|
|||||||
#define CPN_MAX_TRIMS Board::TRIM_AXIS_COUNT
|
#define CPN_MAX_TRIMS Board::TRIM_AXIS_COUNT
|
||||||
#define CPN_MAX_CYC 3
|
#define CPN_MAX_CYC 3
|
||||||
#define CPN_MAX_SWITCHES_FLEX 4 // v2.10 cmake parameter FLEXSW
|
#define CPN_MAX_SWITCHES_FLEX 4 // v2.10 cmake parameter FLEXSW
|
||||||
#define CPN_MAX_SWITCHES_FUNCTION 6
|
#define CPN_MAX_SWITCHES_FUNCTION 8
|
||||||
#define CPN_MAX_SWITCHES_STD 20
|
#define CPN_MAX_SWITCHES_STD 20
|
||||||
#define CPN_MAX_SWITCHES (CPN_MAX_SWITCHES_STD + CPN_MAX_SWITCHES_FLEX + CPN_MAX_SWITCHES_FUNCTION)
|
#define CPN_MAX_SWITCHES (CPN_MAX_SWITCHES_STD + CPN_MAX_SWITCHES_FLEX + CPN_MAX_SWITCHES_FUNCTION)
|
||||||
#define CPN_MAX_SENSORS 60
|
#define CPN_MAX_SENSORS 60
|
||||||
@@ -48,7 +48,6 @@
|
|||||||
#define CPN_MAX_SCRIPT_INPUTS 10
|
#define CPN_MAX_SCRIPT_INPUTS 10
|
||||||
#define CPN_MAX_SPACEMOUSE 6
|
#define CPN_MAX_SPACEMOUSE 6
|
||||||
#define CPN_MAX_INPUTS 32 // v2.10 replaces CPN_MAX_ANALOGS - the value is abitary as radio ADC refactor is still a WIP
|
#define CPN_MAX_INPUTS 32 // v2.10 replaces CPN_MAX_ANALOGS - the value is abitary as radio ADC refactor is still a WIP
|
||||||
#define CPN_MAX_FUNCTIONSWITCH_GROUP 3
|
|
||||||
|
|
||||||
// pre v2.10
|
// pre v2.10
|
||||||
#define CPN_MAX_POTS 8
|
#define CPN_MAX_POTS 8
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ RawSourceItemModel::RawSourceItemModel(const GeneralSettings * const generalSett
|
|||||||
setId(IMID_RawSource);
|
setId(IMID_RawSource);
|
||||||
setUpdateMask(IMUE_All &~ (IMUE_Curves | IMUE_Scripts));
|
setUpdateMask(IMUE_All &~ (IMUE_Curves | IMUE_Scripts));
|
||||||
|
|
||||||
|
int groups = board->getCapability(Board::FunctionSwitchGroups);
|
||||||
|
|
||||||
// Descending source direction: inverted (!) sources
|
// Descending source direction: inverted (!) sources
|
||||||
addItems(SOURCE_TYPE_TELEMETRY, RawSource::TelemGroup, -firmware->getCapability(Sensors) * 3);
|
addItems(SOURCE_TYPE_TELEMETRY, RawSource::TelemGroup, -firmware->getCapability(Sensors) * 3);
|
||||||
addItems(SOURCE_TYPE_TIMER, RawSource::TelemGroup, -firmware->getCapability(Timers));
|
addItems(SOURCE_TYPE_TIMER, RawSource::TelemGroup, -firmware->getCapability(Timers));
|
||||||
@@ -116,8 +118,8 @@ RawSourceItemModel::RawSourceItemModel(const GeneralSettings * const generalSett
|
|||||||
addItems(SOURCE_TYPE_PPM, RawSource::SourcesGroup, -firmware->getCapability(TrainerInputs));
|
addItems(SOURCE_TYPE_PPM, RawSource::SourcesGroup, -firmware->getCapability(TrainerInputs));
|
||||||
addItems(SOURCE_TYPE_CYC, RawSource::SourcesGroup, -CPN_MAX_CYC);
|
addItems(SOURCE_TYPE_CYC, RawSource::SourcesGroup, -CPN_MAX_CYC);
|
||||||
addItems(SOURCE_TYPE_CUSTOM_SWITCH, RawSource::SwitchesGroup, -firmware->getCapability(LogicalSwitches));
|
addItems(SOURCE_TYPE_CUSTOM_SWITCH, RawSource::SwitchesGroup, -firmware->getCapability(LogicalSwitches));
|
||||||
if (modelData)
|
if (modelData && groups > 0)
|
||||||
addItems(SOURCE_TYPE_FUNCTIONSWITCH_GROUP, RawSource::SourcesGroup, -CPN_MAX_FUNCTIONSWITCH_GROUP);
|
addItems(SOURCE_TYPE_FUNCTIONSWITCH_GROUP, RawSource::SourcesGroup, -groups);
|
||||||
addItems(SOURCE_TYPE_SWITCH, RawSource::SwitchesGroup, -board->getCapability(Board::Switches));
|
addItems(SOURCE_TYPE_SWITCH, RawSource::SwitchesGroup, -board->getCapability(Board::Switches));
|
||||||
addItems(SOURCE_TYPE_MAX, RawSource::SourcesGroup, -1);
|
addItems(SOURCE_TYPE_MAX, RawSource::SourcesGroup, -1);
|
||||||
addItems(SOURCE_TYPE_MIN, RawSource::SourcesGroup, -1);
|
addItems(SOURCE_TYPE_MIN, RawSource::SourcesGroup, -1);
|
||||||
@@ -139,8 +141,8 @@ RawSourceItemModel::RawSourceItemModel(const GeneralSettings * const generalSett
|
|||||||
addItems(SOURCE_TYPE_MIN, RawSource::SourcesGroup, 1);
|
addItems(SOURCE_TYPE_MIN, RawSource::SourcesGroup, 1);
|
||||||
addItems(SOURCE_TYPE_MAX, RawSource::SourcesGroup, 1);
|
addItems(SOURCE_TYPE_MAX, RawSource::SourcesGroup, 1);
|
||||||
addItems(SOURCE_TYPE_SWITCH, RawSource::SwitchesGroup, board->getCapability(Board::Switches));
|
addItems(SOURCE_TYPE_SWITCH, RawSource::SwitchesGroup, board->getCapability(Board::Switches));
|
||||||
if (modelData)
|
if (modelData && groups > 0)
|
||||||
addItems(SOURCE_TYPE_FUNCTIONSWITCH_GROUP, RawSource::SourcesGroup, CPN_MAX_FUNCTIONSWITCH_GROUP);
|
addItems(SOURCE_TYPE_FUNCTIONSWITCH_GROUP, RawSource::SourcesGroup, groups);
|
||||||
addItems(SOURCE_TYPE_CUSTOM_SWITCH, RawSource::SwitchesGroup, firmware->getCapability(LogicalSwitches));
|
addItems(SOURCE_TYPE_CUSTOM_SWITCH, RawSource::SwitchesGroup, firmware->getCapability(LogicalSwitches));
|
||||||
addItems(SOURCE_TYPE_CYC, RawSource::SourcesGroup, CPN_MAX_CYC);
|
addItems(SOURCE_TYPE_CYC, RawSource::SourcesGroup, CPN_MAX_CYC);
|
||||||
addItems(SOURCE_TYPE_PPM, RawSource::SourcesGroup, firmware->getCapability(TrainerInputs));
|
addItems(SOURCE_TYPE_PPM, RawSource::SourcesGroup, firmware->getCapability(TrainerInputs));
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ static const StringTagMappingTable switchTypesLookupTable = {
|
|||||||
{std::to_string(Board::SWITCH_TOGGLE), "TOGGLE"},
|
{std::to_string(Board::SWITCH_TOGGLE), "TOGGLE"},
|
||||||
{std::to_string(Board::SWITCH_2POS), "2POS"},
|
{std::to_string(Board::SWITCH_2POS), "2POS"},
|
||||||
{std::to_string(Board::SWITCH_3POS), "3POS"},
|
{std::to_string(Board::SWITCH_3POS), "3POS"},
|
||||||
{std::to_string(Board::SWITCH_FUNC), "FSWITCH"},
|
|
||||||
{std::to_string(Board::SWITCH_ADC), "ADC"},
|
{std::to_string(Board::SWITCH_ADC), "ADC"},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -443,6 +442,24 @@ const int BoardJson::getSwitchIndex(const QString val, Board::LookupValueType lv
|
|||||||
return getSwitchIndex(m_switches, val, lvt);
|
return getSwitchIndex(m_switches, val, lvt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int BoardJson::getCFSIndexForSwitch(int sw) const
|
||||||
|
{
|
||||||
|
if (sw < (int)m_switches->size() && m_switches->at(sw).isCustomSwitch)
|
||||||
|
return m_switches->at(sw).customSwitchIdx;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int BoardJson::getSwitchIndexForCFS(int cfsIdx) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (int)m_switches->size(); i++) {
|
||||||
|
if (m_switches->at(i).isCustomSwitch && m_switches->at(i).customSwitchIdx == cfsIdx)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
int BoardJson::getSwitchIndex(const SwitchesTable * switches, QString val, Board::LookupValueType lvt)
|
int BoardJson::getSwitchIndex(const SwitchesTable * switches, QString val, Board::LookupValueType lvt)
|
||||||
{
|
{
|
||||||
@@ -772,7 +789,7 @@ const bool BoardJson::isSwitchConfigurable(int index) const
|
|||||||
{
|
{
|
||||||
if (index >= 0 && index < getCapability(Board::Switches)) {
|
if (index >= 0 && index < getCapability(Board::Switches)) {
|
||||||
SwitchDefn &defn = m_switches->at(index);
|
SwitchDefn &defn = m_switches->at(index);
|
||||||
if (isSwitchStd(defn))
|
if (isSwitchStd(defn) || isSwitchFunc(defn))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (isSwitchFlex(defn)) {
|
if (isSwitchFlex(defn)) {
|
||||||
@@ -813,7 +830,7 @@ const bool BoardJson::isSwitchFunc(int index) const
|
|||||||
// static
|
// static
|
||||||
bool BoardJson::isSwitchFunc(const SwitchDefn & defn)
|
bool BoardJson::isSwitchFunc(const SwitchDefn & defn)
|
||||||
{
|
{
|
||||||
return defn.type == Board::SWITCH_FUNC;
|
return defn.customSwitchIdx >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BoardJson::loadDefinition()
|
bool BoardJson::loadDefinition()
|
||||||
@@ -996,6 +1013,12 @@ bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs
|
|||||||
sw.display.y = (unsigned int)d.at(1).toInt(0);
|
sw.display.y = (unsigned int)d.at(1).toInt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!o.value("is_cfs").isUndefined())
|
||||||
|
sw.isCustomSwitch = o.value("is_cfs").toBool();
|
||||||
|
|
||||||
|
if (!o.value("cfs_idx").isUndefined())
|
||||||
|
sw.customSwitchIdx = o.value("cfs_idx").toInt();
|
||||||
|
|
||||||
// special handing for ADC
|
// special handing for ADC
|
||||||
if (sw.type == Board::SWITCH_ADC) {
|
if (sw.type == Board::SWITCH_ADC) {
|
||||||
if (sw.dflt == Board::SWITCH_TOGGLE) {
|
if (sw.dflt == Board::SWITCH_TOGGLE) {
|
||||||
|
|||||||
@@ -61,13 +61,15 @@ class BoardJson
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SwitchDefn {
|
struct SwitchDefn {
|
||||||
Board::SwitchType type = Board::SWITCH_NOT_AVAILABLE;
|
|
||||||
std::string tag = "";
|
std::string tag = "";
|
||||||
|
Board::SwitchType type = Board::SWITCH_NOT_AVAILABLE;
|
||||||
std::string name = "";
|
std::string name = "";
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
bool inverted = false;
|
bool inverted = false;
|
||||||
Board::SwitchType dflt = Board::SWITCH_NOT_AVAILABLE;
|
Board::SwitchType dflt = Board::SWITCH_NOT_AVAILABLE;
|
||||||
Display display;
|
Display display;
|
||||||
|
bool isCustomSwitch = false;
|
||||||
|
int customSwitchIdx = -1;
|
||||||
Board::LookupValueType cfgYaml = Board::LVT_TAG;
|
Board::LookupValueType cfgYaml = Board::LVT_TAG;
|
||||||
Board::LookupValueType refYaml = Board::LVT_NAME;
|
Board::LookupValueType refYaml = Board::LVT_NAME;
|
||||||
|
|
||||||
@@ -137,6 +139,8 @@ class BoardJson
|
|||||||
const int getKeyIndex(const QString key) const;
|
const int getKeyIndex(const QString key) const;
|
||||||
|
|
||||||
const int getSwitchIndex(const QString val, Board::LookupValueType lvt) const;
|
const int getSwitchIndex(const QString val, Board::LookupValueType lvt) const;
|
||||||
|
const int getCFSIndexForSwitch(int sw) const;
|
||||||
|
const int getSwitchIndexForCFS(int customSwitchIdx) const;
|
||||||
const Board::SwitchInfo getSwitchInfo(int index) const;
|
const Board::SwitchInfo getSwitchInfo(int index) const;
|
||||||
const QString getSwitchName(int index) const;
|
const QString getSwitchName(int index) const;
|
||||||
const QString getSwitchTag(int index) const;
|
const QString getSwitchTag(int index) const;
|
||||||
|
|||||||
@@ -315,6 +315,12 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
|||||||
else
|
else
|
||||||
return getCapability(board, Board::Switches);
|
return getCapability(board, Board::Switches);
|
||||||
|
|
||||||
|
case FunctionSwitchGroups:
|
||||||
|
if (getCapability(board, FunctionSwitches)) {
|
||||||
|
return IS_RADIOMASTER_GX12(board) ? 4 : 3;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
case HasAudioMuteGPIO:
|
case HasAudioMuteGPIO:
|
||||||
// All color lcd (including NV14 and EL18) except Horus X12S
|
// All color lcd (including NV14 and EL18) except Horus X12S
|
||||||
// TX12, TX12MK2, ZORRO, BOXER, T8, TLITE, TPRO, LR3PRO, COMMANDO8
|
// TX12, TX12MK2, ZORRO, BOXER, T8, TLITE, TPRO, LR3PRO, COMMANDO8
|
||||||
@@ -406,7 +412,7 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
|||||||
return IS_RADIOMASTER_MT12(board);
|
return IS_RADIOMASTER_MT12(board);
|
||||||
|
|
||||||
case FunctionSwitchColors:
|
case FunctionSwitchColors:
|
||||||
return IS_RADIOMASTER_GX12(board);
|
return IS_RADIOMASTER_GX12(board) || IS_FLYSKY_ST16(board);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return getBoardJson(board)->getCapability(capability);
|
return getBoardJson(board)->getCapability(capability);
|
||||||
@@ -679,6 +685,8 @@ QString Boards::switchTypeToString(int value)
|
|||||||
return tr("2 Positions");
|
return tr("2 Positions");
|
||||||
case SWITCH_3POS:
|
case SWITCH_3POS:
|
||||||
return tr("3 Positions");
|
return tr("3 Positions");
|
||||||
|
case SWITCH_GLOBAL:
|
||||||
|
return tr("Global");
|
||||||
case SWITCH_FUNC:
|
case SWITCH_FUNC:
|
||||||
return tr("Function");
|
return tr("Function");
|
||||||
default:
|
default:
|
||||||
@@ -692,7 +700,7 @@ AbstractStaticItemModel * Boards::switchTypeItemModel()
|
|||||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
mdl->setName(AIM_BOARDS_SWITCH_TYPE);
|
mdl->setName(AIM_BOARDS_SWITCH_TYPE);
|
||||||
|
|
||||||
for (int i = 0; i < SWITCH_FUNC; i++) { // Function not required in lists
|
for (int i = 0; i < SWITCH_GLOBAL; i++) { // Function not required in lists
|
||||||
mdl->appendToItemList(switchTypeToString(i), i, true, 0,
|
mdl->appendToItemList(switchTypeToString(i), i, true, 0,
|
||||||
(i == SWITCH_NOT_AVAILABLE ? SwitchTypeFlagNone : (i < SWITCH_3POS ? SwitchTypeFlag2Pos : SwitchTypeFlag3Pos)));
|
(i == SWITCH_NOT_AVAILABLE ? SwitchTypeFlagNone : (i < SWITCH_3POS ? SwitchTypeFlag2Pos : SwitchTypeFlag3Pos)));
|
||||||
}
|
}
|
||||||
@@ -1046,6 +1054,16 @@ int Boards::getSwitchIndex(QString val, Board::LookupValueType lvt, Board::Type
|
|||||||
return getBoardJson(board)->getSwitchIndex(val, lvt);
|
return getBoardJson(board)->getSwitchIndex(val, lvt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Boards::getCFSIndexForSwitch(int swIdx, Board::Type board)
|
||||||
|
{
|
||||||
|
return getBoardJson(board)->getCFSIndexForSwitch(swIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Boards::getSwitchIndexForCFS(int cfsIdx, Board::Type board)
|
||||||
|
{
|
||||||
|
return getBoardJson(board)->getSwitchIndexForCFS(cfsIdx);
|
||||||
|
}
|
||||||
|
|
||||||
QString Boards::getSwitchName(int index, Board::Type board)
|
QString Boards::getSwitchName(int index, Board::Type board)
|
||||||
{
|
{
|
||||||
return getBoardJson(board)->getSwitchName(index);
|
return getBoardJson(board)->getSwitchName(index);
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ namespace Board {
|
|||||||
SWITCH_TOGGLE,
|
SWITCH_TOGGLE,
|
||||||
SWITCH_2POS,
|
SWITCH_2POS,
|
||||||
SWITCH_3POS,
|
SWITCH_3POS,
|
||||||
|
SWITCH_GLOBAL,
|
||||||
SWITCH_FUNC,
|
SWITCH_FUNC,
|
||||||
SWITCH_ADC,
|
SWITCH_ADC,
|
||||||
SWITCH_TYPE_COUNT
|
SWITCH_TYPE_COUNT
|
||||||
@@ -212,6 +213,7 @@ namespace Board {
|
|||||||
FlexSwitches,
|
FlexSwitches,
|
||||||
FunctionSwitches,
|
FunctionSwitches,
|
||||||
FunctionSwitchColors,
|
FunctionSwitchColors,
|
||||||
|
FunctionSwitchGroups,
|
||||||
Gyros,
|
Gyros,
|
||||||
GyroAxes,
|
GyroAxes,
|
||||||
HasAudioMuteGPIO,
|
HasAudioMuteGPIO,
|
||||||
@@ -426,6 +428,8 @@ class Boards
|
|||||||
|
|
||||||
static Board::SwitchInfo getSwitchInfo(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static Board::SwitchInfo getSwitchInfo(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static int getSwitchIndex(QString val, Board::LookupValueType lvt, Board::Type board = Board::BOARD_UNKNOWN);
|
static int getSwitchIndex(QString val, Board::LookupValueType lvt, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
static int getCFSIndexForSwitch(int swIdx, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
static int getSwitchIndexForCFS(int cfsIdx, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static QString getSwitchName(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static QString getSwitchName(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static QString getSwitchTag(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static QString getSwitchTag(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
static int getSwitchTagNum(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
static int getSwitchTagNum(int index, Board::Type board = Board::BOARD_UNKNOWN);
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ bool CustomFunctionData::isFuncAvailable(const int index, const ModelData * mode
|
|||||||
((index >= FuncAdjustGV1 && index <= FuncAdjustGVLast) && !fw->getCapability(Gvars)) ||
|
((index >= FuncAdjustGV1 && index <= FuncAdjustGVLast) && !fw->getCapability(Gvars)) ||
|
||||||
((index == FuncDisableTouch) && !IS_HORUS_OR_TARANIS(fw->getBoard())) ||
|
((index == FuncDisableTouch) && !IS_HORUS_OR_TARANIS(fw->getBoard())) ||
|
||||||
((index == FuncDisableAudioAmp && !Boards::getCapability(fw->getBoard(), Board::HasAudioMuteGPIO))) ||
|
((index == FuncDisableAudioAmp && !Boards::getCapability(fw->getBoard(), Board::HasAudioMuteGPIO))) ||
|
||||||
((index == FuncRGBLed && !Boards::getCapability(fw->getBoard(), Board::HasLedStripGPIO))) ||
|
((index == FuncRGBLed && !(Boards::getCapability(fw->getBoard(), Board::HasLedStripGPIO) || Boards::getCapability(fw->getBoard(), Board::FunctionSwitchColors)))) ||
|
||||||
((index == FuncLCDtoVideo && !IS_FATFISH_F16(fw->getBoard()))) ||
|
((index == FuncLCDtoVideo && !IS_FATFISH_F16(fw->getBoard()))) ||
|
||||||
((index >= FuncPushCustomSwitch1 && index <= FuncPushCustomSwitchLast) && !Boards::getCapability(fw->getBoard(), Board::FunctionSwitches))
|
((index >= FuncPushCustomSwitch1 && index <= FuncPushCustomSwitchLast) && !Boards::getCapability(fw->getBoard(), Board::FunctionSwitches))
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -602,7 +602,8 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
|
|||||||
// however when parsing saved settings set all switches to None and override with parsed values
|
// however when parsing saved settings set all switches to None and override with parsed values
|
||||||
// thus any switches not parsed will be None rather than the default
|
// thus any switches not parsed will be None rather than the default
|
||||||
for (int i = 0; i < CPN_MAX_SWITCHES; i++) {
|
for (int i = 0; i < CPN_MAX_SWITCHES; i++) {
|
||||||
rhs.switchConfig[i].type = Board::SWITCH_NOT_AVAILABLE;
|
if (Boards::getCFSIndexForSwitch(i) < 0)
|
||||||
|
rhs.switchConfig[i].type = Board::SWITCH_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node["switchConfig"]) {
|
if (node["switchConfig"]) {
|
||||||
|
|||||||
@@ -31,7 +31,9 @@
|
|||||||
#include "yaml_sensordata.h"
|
#include "yaml_sensordata.h"
|
||||||
#include "yaml_screendata.h"
|
#include "yaml_screendata.h"
|
||||||
#include "yaml_usbjoystickdata.h"
|
#include "yaml_usbjoystickdata.h"
|
||||||
|
#include "yaml_switchconfig.h"
|
||||||
|
|
||||||
|
#include "boardjson.h"
|
||||||
#include "modeldata.h"
|
#include "modeldata.h"
|
||||||
#include "output_data.h"
|
#include "output_data.h"
|
||||||
#include "eeprominterface.h"
|
#include "eeprominterface.h"
|
||||||
@@ -73,7 +75,7 @@ void YamlValidateLabelsNames(ModelData& model, Board::Type board)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < CPN_MAX_SWITCHES_FUNCTION; i++) {
|
for (int i = 0; i < CPN_MAX_SWITCHES_FUNCTION; i++) {
|
||||||
YamlValidateName(model.functionSwitchNames[i], board);
|
YamlValidateName(model.customSwitches[i].name, board);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < CPN_MAX_INPUTS; i++) {
|
for (int i = 0; i < CPN_MAX_INPUTS; i++) {
|
||||||
@@ -149,6 +151,25 @@ static const YamlLookupTable hatsModeLut = {
|
|||||||
{ GeneralSettings::HATSMODE_GLOBAL, "GLOBAL" },
|
{ GeneralSettings::HATSMODE_GLOBAL, "GLOBAL" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const YamlLookupTable cfsSwitchConfig = {
|
||||||
|
{ 0, "NONE" },
|
||||||
|
{ 1, "TOGGLE" },
|
||||||
|
{ 2, "2POS" },
|
||||||
|
{ 3, "3POS" },
|
||||||
|
{ 4, "GLOBAL" },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const YamlLookupTable cfsSwitchStart = {
|
||||||
|
{ 0, "START_OFF" },
|
||||||
|
{ 1, "START_ON" },
|
||||||
|
{ 2, "START_PREVIOUS" },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const YamlLookupTable cfsSwitchLuaOverride = {
|
||||||
|
{ 0, "OFF" },
|
||||||
|
{ 1, "ON" },
|
||||||
|
};
|
||||||
|
|
||||||
struct YamlTrim {
|
struct YamlTrim {
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
int ref = 0;
|
int ref = 0;
|
||||||
@@ -283,27 +304,24 @@ struct YamlSwitchWarning {
|
|||||||
static constexpr size_t MASK_LEN = 2;
|
static constexpr size_t MASK_LEN = 2;
|
||||||
static constexpr size_t MASK = (1 << MASK_LEN) - 1;
|
static constexpr size_t MASK = (1 << MASK_LEN) - 1;
|
||||||
|
|
||||||
unsigned int enabled;
|
|
||||||
|
|
||||||
YamlSwitchWarning() = default;
|
YamlSwitchWarning() = default;
|
||||||
|
|
||||||
YamlSwitchWarning(YAML::Node& node, uint64_t cpn_value, unsigned int switchWarningEnable)
|
YamlSwitchWarning(YAML::Node& node, uint64_t cpn_value)
|
||||||
: enabled(~switchWarningEnable)
|
|
||||||
{
|
{
|
||||||
uint64_t states = cpn_value;
|
uint64_t states = cpn_value;
|
||||||
|
|
||||||
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Switches); i++) {
|
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Switches); i++) {
|
||||||
if (!Boards::isSwitchFunc(i) && (enabled & (1 << i))) {
|
if (states & MASK) {
|
||||||
std::string posn;
|
std::string posn;
|
||||||
|
|
||||||
switch(states & MASK) {
|
switch(states & MASK) {
|
||||||
case 0:
|
case 1:
|
||||||
posn = "up";
|
posn = "up";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
posn = "mid";
|
posn = "mid";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
posn = "down";
|
posn = "down";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -318,7 +336,6 @@ struct YamlSwitchWarning {
|
|||||||
uint64_t toCpn(const YAML::Node &warn)
|
uint64_t toCpn(const YAML::Node &warn)
|
||||||
{
|
{
|
||||||
uint64_t states = 0;
|
uint64_t states = 0;
|
||||||
enabled = 0;
|
|
||||||
|
|
||||||
if (warn.IsMap()) {
|
if (warn.IsMap()) {
|
||||||
for (const auto& sw : warn) {
|
for (const auto& sw : warn) {
|
||||||
@@ -336,14 +353,13 @@ struct YamlSwitchWarning {
|
|||||||
int value = 0;
|
int value = 0;
|
||||||
|
|
||||||
if (posn == "up")
|
if (posn == "up")
|
||||||
value = 0;
|
|
||||||
else if (posn == "mid")
|
|
||||||
value = 1;
|
value = 1;
|
||||||
else if (posn == "down")
|
else if (posn == "mid")
|
||||||
value = 2;
|
value = 2;
|
||||||
|
else if (posn == "down")
|
||||||
|
value = 3;
|
||||||
|
|
||||||
states |= ((uint64_t)value << (index * MASK_LEN));
|
states |= ((uint64_t)value << (index * MASK_LEN));
|
||||||
enabled |= (1 << index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,32 +376,30 @@ struct YamlSwitchWarningState {
|
|||||||
static constexpr size_t MASK = (1 << MASK_LEN) - 1;
|
static constexpr size_t MASK = (1 << MASK_LEN) - 1;
|
||||||
|
|
||||||
std::string src_str;
|
std::string src_str;
|
||||||
unsigned int enabled;
|
|
||||||
|
|
||||||
YamlSwitchWarningState() = default;
|
YamlSwitchWarningState() = default;
|
||||||
|
|
||||||
YamlSwitchWarningState(uint64_t cpn_value, unsigned int switchWarningEnable)
|
YamlSwitchWarningState(uint64_t cpn_value)
|
||||||
: enabled(~switchWarningEnable)
|
|
||||||
{
|
{
|
||||||
uint64_t states = cpn_value;
|
uint64_t states = cpn_value;
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Switches); i++) {
|
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Switches); i++) {
|
||||||
//TODO: exclude 2-pos toggle from switch warnings
|
//TODO: exclude 2-pos toggle from switch warnings
|
||||||
if (enabled & (1 << i)) {
|
if (states & MASK) {
|
||||||
std::string tag = Boards::getSwitchTag(i).toStdString();
|
std::string tag = Boards::getSwitchTag(i).toStdString();
|
||||||
const char *sw = tag.data();
|
const char *sw = tag.data();
|
||||||
|
|
||||||
if (tag.size() >= 2 && sw[0] == 'S') {
|
if (tag.size() >= 2 && sw[0] == 'S') {
|
||||||
ss << sw[1];
|
ss << sw[1];
|
||||||
switch(states & MASK) {
|
switch(states & MASK) {
|
||||||
case 0:
|
case 1:
|
||||||
ss << 'u';
|
ss << 'u';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
ss << '-';
|
ss << '-';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
ss << 'd';
|
ss << 'd';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -400,7 +414,6 @@ struct YamlSwitchWarningState {
|
|||||||
uint64_t toCpn()
|
uint64_t toCpn()
|
||||||
{
|
{
|
||||||
uint64_t states = 0;
|
uint64_t states = 0;
|
||||||
enabled = 0;
|
|
||||||
|
|
||||||
std::stringstream ss(src_str);
|
std::stringstream ss(src_str);
|
||||||
while (!ss.eof()) {
|
while (!ss.eof()) {
|
||||||
@@ -422,20 +435,19 @@ struct YamlSwitchWarningState {
|
|||||||
int value = 0;
|
int value = 0;
|
||||||
switch(s) {
|
switch(s) {
|
||||||
case 'u':
|
case 'u':
|
||||||
value = 0;
|
|
||||||
break;
|
|
||||||
case '-':
|
|
||||||
value = 1;
|
value = 1;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case '-':
|
||||||
value = 2;
|
value = 2;
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
value = 3;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
states |= ((uint64_t)value << (index * MASK_LEN));
|
states |= ((uint64_t)value << (index * MASK_LEN));
|
||||||
enabled |= (1 << index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return states;
|
return states;
|
||||||
@@ -955,6 +967,47 @@ struct convert<FrSkyScreenData> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct convert<customSwitch> {
|
||||||
|
static Node encode(const customSwitch& rhs);
|
||||||
|
static bool decode(const Node& node, customSwitch& rhs);
|
||||||
|
};
|
||||||
|
|
||||||
|
Node convert<customSwitch>::encode(const customSwitch& rhs)
|
||||||
|
{
|
||||||
|
Node node;
|
||||||
|
node["type"] = cfsSwitchConfig << rhs.type;
|
||||||
|
node["group"] = rhs.group;
|
||||||
|
node["start"] = cfsSwitchStart << rhs.start;
|
||||||
|
node["state"] = rhs.state;
|
||||||
|
node["name"] = rhs.name;
|
||||||
|
if (Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchColors)) {
|
||||||
|
node["onColorLuaOverride"] = cfsSwitchLuaOverride << rhs.onColorLuaOverride;
|
||||||
|
node["offColorLuaOverride"] = cfsSwitchLuaOverride << rhs.offColorLuaOverride;
|
||||||
|
node["onColor"] = rhs.onColor;
|
||||||
|
node["offColor"] = rhs.offColor;
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool convert<customSwitch>::decode(const Node& node, customSwitch& rhs)
|
||||||
|
{
|
||||||
|
if (!node.IsMap()) return false;
|
||||||
|
|
||||||
|
unsigned type;
|
||||||
|
node["type"] >> cfsSwitchConfig >> type;
|
||||||
|
rhs.type = (Board::SwitchType)type;
|
||||||
|
node["group"] >> rhs.group;
|
||||||
|
node["start"] >> cfsSwitchStart >> rhs.start;
|
||||||
|
node["state"] >> rhs.state;
|
||||||
|
node["name"] >> rhs.name;
|
||||||
|
node["onColorLuaOverride"] >> cfsSwitchLuaOverride >> rhs.onColorLuaOverride;
|
||||||
|
node["offColorLuaOverride"] >> cfsSwitchLuaOverride >> rhs.offColorLuaOverride;
|
||||||
|
node["onColor"] >> rhs.onColor;
|
||||||
|
node["offColor"] >> rhs.offColor;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Node convert<ModelData>::encode(const ModelData& rhs)
|
Node convert<ModelData>::encode(const ModelData& rhs)
|
||||||
{
|
{
|
||||||
modelSettingsVersion = SemanticVersion(VERSION);
|
modelSettingsVersion = SemanticVersion(VERSION);
|
||||||
@@ -1076,7 +1129,7 @@ Node convert<ModelData>::encode(const ModelData& rhs)
|
|||||||
node["thrTraceSrc"] = thrTrace.src;
|
node["thrTraceSrc"] = thrTrace.src;
|
||||||
|
|
||||||
Node sw_warn;
|
Node sw_warn;
|
||||||
YamlSwitchWarning switchWarning(sw_warn, rhs.switchWarningStates, rhs.switchWarningEnable);
|
YamlSwitchWarning switchWarning(sw_warn, rhs.switchWarningStates);
|
||||||
if (sw_warn && sw_warn.IsMap()) {
|
if (sw_warn && sw_warn.IsMap()) {
|
||||||
node["switchWarning"] = sw_warn;
|
node["switchWarning"] = sw_warn;
|
||||||
}
|
}
|
||||||
@@ -1194,29 +1247,16 @@ Node convert<ModelData>::encode(const ModelData& rhs)
|
|||||||
node["modelRegistrationID"] = rhs.registrationId;
|
node["modelRegistrationID"] = rhs.registrationId;
|
||||||
node["hatsMode"] = hatsModeLut << rhs.hatsMode;
|
node["hatsMode"] = hatsModeLut << rhs.hatsMode;
|
||||||
|
|
||||||
if (Boards::getCapability(board, Board::FunctionSwitches)) {
|
int funcSwCnt = Boards::getCapability(board, Board::FunctionSwitches);
|
||||||
node["functionSwitchConfig"] = rhs.functionSwitchConfig;
|
if (funcSwCnt) {
|
||||||
node["functionSwitchGroup"] = rhs.functionSwitchGroup;
|
for (int i = 0; i < funcSwCnt; i += 1) {
|
||||||
node["functionSwitchStartConfig"] = rhs.functionSwitchStartConfig;
|
int sw = Boards::getSwitchIndexForCFS(i);
|
||||||
node["functionSwitchLogicalState"] = rhs.functionSwitchLogicalState;
|
std::string tag = Boards::getSwitchYamlName(sw, BoardJson::YLT_CONFIG).toStdString();
|
||||||
|
node["customSwitches"][tag] = rhs.customSwitches[i];
|
||||||
for (int i = 0; i < CPN_MAX_SWITCHES_FUNCTION; i++) {
|
|
||||||
if (strlen(rhs.functionSwitchNames[i]) > 0) {
|
|
||||||
node["switchNames"][std::to_string(i)]["val"] = rhs.functionSwitchNames[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Boards::getCapability(board, Board::FunctionSwitchColors)) {
|
for (int i = 1; i < 4; i += 1) {
|
||||||
for (int i = 0; i < CPN_MAX_SWITCHES_FUNCTION; i += 1) {
|
node["cfsGroupOn"][std::to_string(i)]["v"] = rhs.cfsGroupOn[i];
|
||||||
node["functionSwitchLedONColor"][std::to_string(i)]["r"] = rhs.functionSwitchLedONColor[i].r;
|
|
||||||
node["functionSwitchLedONColor"][std::to_string(i)]["g"] = rhs.functionSwitchLedONColor[i].g;
|
|
||||||
node["functionSwitchLedONColor"][std::to_string(i)]["b"] = rhs.functionSwitchLedONColor[i].b;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < CPN_MAX_SWITCHES_FUNCTION; i += 1) {
|
|
||||||
node["functionSwitchLedOFFColor"][std::to_string(i)]["r"] = rhs.functionSwitchLedOFFColor[i].r;
|
|
||||||
node["functionSwitchLedOFFColor"][std::to_string(i)]["g"] = rhs.functionSwitchLedOFFColor[i].g;
|
|
||||||
node["functionSwitchLedOFFColor"][std::to_string(i)]["b"] = rhs.functionSwitchLedOFFColor[i].b;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1351,16 +1391,13 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
|
|||||||
if (node["switchWarning"]) {
|
if (node["switchWarning"]) {
|
||||||
YamlSwitchWarning switchWarning;
|
YamlSwitchWarning switchWarning;
|
||||||
rhs.switchWarningStates = switchWarning.toCpn(node["switchWarning"]);
|
rhs.switchWarningStates = switchWarning.toCpn(node["switchWarning"]);
|
||||||
rhs.switchWarningEnable = ~switchWarning.enabled;
|
|
||||||
}
|
}
|
||||||
else if (node["switchWarningState"]) { // depreciated
|
else if (node["switchWarningState"]) { // depreciated
|
||||||
YamlSwitchWarningState switchWarningState;
|
YamlSwitchWarningState switchWarningState;
|
||||||
node["switchWarningState"] >> switchWarningState.src_str;
|
node["switchWarningState"] >> switchWarningState.src_str;
|
||||||
rhs.switchWarningStates = switchWarningState.toCpn();
|
rhs.switchWarningStates = switchWarningState.toCpn();
|
||||||
rhs.switchWarningEnable = ~switchWarningState.enabled;
|
|
||||||
} else {
|
} else {
|
||||||
rhs.switchWarningStates = 0;
|
rhs.switchWarningStates = 0;
|
||||||
rhs.switchWarningEnable = ~0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node["thrTrimSw"] >> rhs.thrTrimSwitch;
|
node["thrTrimSw"] >> rhs.thrTrimSwitch;
|
||||||
@@ -1481,26 +1518,77 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
|
|||||||
node["modelRegistrationID"] >> rhs.registrationId;
|
node["modelRegistrationID"] >> rhs.registrationId;
|
||||||
node["hatsMode"] >> hatsModeLut >> rhs.hatsMode;
|
node["hatsMode"] >> hatsModeLut >> rhs.hatsMode;
|
||||||
|
|
||||||
node["functionSwitchConfig"] >> rhs.functionSwitchConfig;
|
rhs.setDefaultFunctionSwitches(Boards::getCapability(board, Board::FunctionSwitches));
|
||||||
node["functionSwitchGroup"] >> rhs.functionSwitchGroup;
|
|
||||||
node["functionSwitchStartConfig"] >> rhs.functionSwitchStartConfig;
|
if (node["functionSwitchConfig"]) {
|
||||||
node["functionSwitchLogicalState"] >> rhs.functionSwitchLogicalState;
|
uint16_t v;
|
||||||
node["switchNames"] >> rhs.functionSwitchNames;
|
node["functionSwitchConfig"] >> v;
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
rhs.customSwitches[i].type = (Board::SwitchType)(v & 3);
|
||||||
|
v >>= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (node["functionSwitchGroup"]) {
|
||||||
|
uint16_t v;
|
||||||
|
node["functionSwitchGroup"] >> v;
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
rhs.customSwitches[i].group = v & 3;
|
||||||
|
v >>= 2;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 4; i += 1) {
|
||||||
|
rhs.cfsGroupOn[i] = v & 1;
|
||||||
|
v >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (node["functionSwitchStartConfig"]) {
|
||||||
|
uint16_t v;
|
||||||
|
node["functionSwitchStartConfig"] >> v;
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
rhs.customSwitches[i].start = v & 3;
|
||||||
|
v >>= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (node["functionSwitchLogicalState"]) {
|
||||||
|
uint16_t v;
|
||||||
|
node["functionSwitchLogicalState"] >> v;
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
rhs.customSwitches[i].state = v & 1;
|
||||||
|
v >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (node["switchNames"]) {
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
if (node["switchNames"][std::to_string(i)]) {
|
||||||
|
node["switchNames"][std::to_string(i)]["val"] >> rhs.customSwitches[i].name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (node["functionSwitchLedONColor"]) {
|
if (node["functionSwitchLedONColor"]) {
|
||||||
for (int i = 0; i < CPN_MAX_SWITCHES_FUNCTION; i += 1) {
|
for (int i = 0; i < 6; i += 1) {
|
||||||
if (node["functionSwitchLedONColor"][std::to_string(i)]) {
|
if (node["functionSwitchLedONColor"][std::to_string(i)]) {
|
||||||
node["functionSwitchLedONColor"][std::to_string(i)]["r"] >> rhs.functionSwitchLedONColor[i].r;
|
node["functionSwitchLedONColor"][std::to_string(i)] >> rhs.customSwitches[i].onColor;
|
||||||
node["functionSwitchLedONColor"][std::to_string(i)]["g"] >> rhs.functionSwitchLedONColor[i].g;
|
|
||||||
node["functionSwitchLedONColor"][std::to_string(i)]["b"] >> rhs.functionSwitchLedONColor[i].b;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node["functionSwitchLedOFFColor"]) {
|
if (node["functionSwitchLedOFFColor"]) {
|
||||||
for (int i = 0; i < CPN_MAX_SWITCHES_FUNCTION; i += 1) {
|
for (int i = 0; i < 6; i += 1) {
|
||||||
if (node["functionSwitchLedOFFColor"][std::to_string(i)]) {
|
if (node["functionSwitchLedOFFColor"][std::to_string(i)]) {
|
||||||
node["functionSwitchLedOFFColor"][std::to_string(i)]["r"] >> rhs.functionSwitchLedOFFColor[i].r;
|
node["functionSwitchLedOFFColor"][std::to_string(i)] >> rhs.customSwitches[i].offColor;
|
||||||
node["functionSwitchLedOFFColor"][std::to_string(i)]["g"] >> rhs.functionSwitchLedOFFColor[i].g;
|
}
|
||||||
node["functionSwitchLedOFFColor"][std::to_string(i)]["b"] >> rhs.functionSwitchLedOFFColor[i].b;
|
}
|
||||||
|
}
|
||||||
|
int funcSwCnt = Boards::getCapability(board, Board::FunctionSwitches);
|
||||||
|
if (node["customSwitches"]) {
|
||||||
|
for (int i = 0; i < funcSwCnt; i += 1) {
|
||||||
|
int sw = Boards::getSwitchIndexForCFS(i);
|
||||||
|
std::string tag = Boards::getSwitchYamlName(sw, BoardJson::YLT_CONFIG).toStdString();
|
||||||
|
node["customSwitches"][tag] >> rhs.customSwitches[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (node["cfsGroupOn"]) {
|
||||||
|
for (int i = 1; i < 4; i += 1) {
|
||||||
|
if (node["cfsGroupOn"][std::to_string(i)]) {
|
||||||
|
node["cfsGroupOn"][std::to_string(i)]["v"] >> rhs.cfsGroupOn[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,11 @@
|
|||||||
#include "boardjson.h"
|
#include "boardjson.h"
|
||||||
|
|
||||||
const YamlLookupTable switchConfigLut = {
|
const YamlLookupTable switchConfigLut = {
|
||||||
|
{Board::SWITCH_NOT_AVAILABLE, "NONE"},
|
||||||
|
{Board::SWITCH_TOGGLE, "TOGGLE"},
|
||||||
|
{Board::SWITCH_2POS, "2POS"},
|
||||||
|
{Board::SWITCH_3POS, "3POS"},
|
||||||
|
{Board::SWITCH_GLOBAL, "GLOBAL"},
|
||||||
{Board::SWITCH_NOT_AVAILABLE, "none"},
|
{Board::SWITCH_NOT_AVAILABLE, "none"},
|
||||||
{Board::SWITCH_TOGGLE, "toggle"},
|
{Board::SWITCH_TOGGLE, "toggle"},
|
||||||
{Board::SWITCH_2POS, "2pos"},
|
{Board::SWITCH_2POS, "2pos"},
|
||||||
@@ -117,8 +122,13 @@ YamlSwitchConfig::YamlSwitchConfig(const GeneralSettings::SwitchConfig* rhs)
|
|||||||
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Switches); i++) {
|
for (int i = 0; i < Boards::getCapability(getCurrentBoard(), Board::Switches); i++) {
|
||||||
config[i].tag = Boards::getSwitchYamlName(i, BoardJson::YLT_CONFIG).toStdString();
|
config[i].tag = Boards::getSwitchYamlName(i, BoardJson::YLT_CONFIG).toStdString();
|
||||||
config[i].type = rhs[i].type;
|
config[i].type = rhs[i].type;
|
||||||
|
config[i].start = rhs[i].start;
|
||||||
memcpy(config[i].name, rhs[i].name, sizeof(HARDWARE_NAME_LEN));
|
memcpy(config[i].name, rhs[i].name, sizeof(HARDWARE_NAME_LEN));
|
||||||
// config[i].inverted = rhs[i].inverted;
|
// config[i].inverted = rhs[i].inverted;
|
||||||
|
config[i].onColorLuaOverride = rhs[i].onColorLuaOverride;
|
||||||
|
config[i].offColorLuaOverride = rhs[i].offColorLuaOverride;
|
||||||
|
config[i].onColor = rhs[i].onColor;
|
||||||
|
config[i].offColor = rhs[i].offColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +138,12 @@ void YamlSwitchConfig::copy(GeneralSettings::SwitchConfig* rhs) const
|
|||||||
if (config[i].type != (unsigned int)Board::SWITCH_NOT_AVAILABLE) {
|
if (config[i].type != (unsigned int)Board::SWITCH_NOT_AVAILABLE) {
|
||||||
memcpy(rhs[i].name, config[i].name, sizeof(HARDWARE_NAME_LEN));
|
memcpy(rhs[i].name, config[i].name, sizeof(HARDWARE_NAME_LEN));
|
||||||
rhs[i].type = (Board::SwitchType)config[i].type;
|
rhs[i].type = (Board::SwitchType)config[i].type;
|
||||||
|
rhs[i].start = config[i].start;
|
||||||
// rhs[i].inverted = config[i].inverted;
|
// rhs[i].inverted = config[i].inverted;
|
||||||
|
rhs[i].onColorLuaOverride = config[i].onColorLuaOverride;
|
||||||
|
rhs[i].offColorLuaOverride = config[i].offColorLuaOverride;
|
||||||
|
rhs[i].onColor = config[i].onColor;
|
||||||
|
rhs[i].offColor = config[i].offColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,11 +206,32 @@ bool convert<InputConfig>::decode(const Node& node, InputConfig& rhs)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const YamlLookupTable cfsSwitchStart = {
|
||||||
|
{ 0, "START_OFF" },
|
||||||
|
{ 1, "START_ON" },
|
||||||
|
{ 2, "START_PREVIOUS" },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const YamlLookupTable cfsSwitchLuaOverride = {
|
||||||
|
{ 0, "OFF" },
|
||||||
|
{ 1, "ON" },
|
||||||
|
};
|
||||||
|
|
||||||
Node convert<SwitchConfig>::encode(const SwitchConfig& rhs)
|
Node convert<SwitchConfig>::encode(const SwitchConfig& rhs)
|
||||||
{
|
{
|
||||||
Node node;
|
Node node;
|
||||||
node["type"] = switchConfigLut << rhs.type;
|
node["type"] = switchConfigLut << rhs.type;
|
||||||
node["name"] = rhs.name;
|
node["name"] = rhs.name;
|
||||||
|
if (Boards::getCapability(getCurrentBoard(), Board::FunctionSwitches)) {
|
||||||
|
int idx = Boards::getSwitchYamlIndex(rhs.tag.c_str(), BoardJson::YLT_REF);
|
||||||
|
if (Boards::isSwitchFunc(idx, getCurrentBoard())) {
|
||||||
|
node["start"] = cfsSwitchStart << rhs.start;
|
||||||
|
node["onColorLuaOverride"] = cfsSwitchLuaOverride << rhs.onColorLuaOverride;
|
||||||
|
node["offColorLuaOverride"] = cfsSwitchLuaOverride << rhs.offColorLuaOverride;
|
||||||
|
node["onColor"] = rhs.onColor;
|
||||||
|
node["offColor"] = rhs.offColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
// node["inv"] = (int)rhs.inverted; in hwdef json but not implemented in radio yaml
|
// node["inv"] = (int)rhs.inverted; in hwdef json but not implemented in radio yaml
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@@ -206,7 +242,12 @@ bool convert<SwitchConfig>::decode(const Node& node, SwitchConfig& rhs)
|
|||||||
|
|
||||||
node["type"] >> switchConfigLut >> rhs.type;
|
node["type"] >> switchConfigLut >> rhs.type;
|
||||||
node["name"] >> rhs.name;
|
node["name"] >> rhs.name;
|
||||||
|
node["start"] >> cfsSwitchStart >> rhs.start;
|
||||||
// node["inv"] >> rhs.inverted; in hwdef json but not implemented in radio yaml
|
// node["inv"] >> rhs.inverted; in hwdef json but not implemented in radio yaml
|
||||||
|
node["onColorLuaOverride"] >> cfsSwitchLuaOverride >> rhs.onColorLuaOverride;
|
||||||
|
node["offColorLuaOverride"] >> cfsSwitchLuaOverride >> rhs.offColorLuaOverride;
|
||||||
|
node["onColor"] >> rhs.onColor;
|
||||||
|
node["offColor"] >> rhs.offColor;
|
||||||
|
|
||||||
if (radioSettingsVersion < SemanticVersion(QString(CPN_ADC_REFACTOR_VERSION))) {
|
if (radioSettingsVersion < SemanticVersion(QString(CPN_ADC_REFACTOR_VERSION))) {
|
||||||
int idx = Boards::getSwitchYamlIndex(rhs.tag.c_str(), BoardJson::YLT_CONFIG);
|
int idx = Boards::getSwitchYamlIndex(rhs.tag.c_str(), BoardJson::YLT_CONFIG);
|
||||||
@@ -420,4 +461,21 @@ bool convert<YamlSwitchesFlex>::decode(const Node& node, YamlSwitchesFlex& rhs)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Node convert<RGBLedColor>::encode(const RGBLedColor& rhs)
|
||||||
|
{
|
||||||
|
Node node;
|
||||||
|
node["r"] = rhs.r;
|
||||||
|
node["g"] = rhs.g;
|
||||||
|
node["b"] = rhs.b;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool convert<RGBLedColor>::decode(const Node& node, RGBLedColor& rhs)
|
||||||
|
{
|
||||||
|
node["r"] >> rhs.r;
|
||||||
|
node["g"] >> rhs.g;
|
||||||
|
node["b"] >> rhs.b;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace YAML
|
} // namespace YAML
|
||||||
|
|||||||
@@ -69,7 +69,12 @@ struct SwitchConfig {
|
|||||||
std::string tag = std::string();
|
std::string tag = std::string();
|
||||||
char name[HARDWARE_NAME_LEN + 1] = {'\0'};
|
char name[HARDWARE_NAME_LEN + 1] = {'\0'};
|
||||||
unsigned int type = 0;
|
unsigned int type = 0;
|
||||||
|
int start = 0;
|
||||||
bool inverted = false;
|
bool inverted = false;
|
||||||
|
unsigned int onColorLuaOverride = false;
|
||||||
|
unsigned int offColorLuaOverride = false;
|
||||||
|
RGBLedColor onColor;
|
||||||
|
RGBLedColor offColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
ENCODE_DECODE_CONFIG(SwitchConfig)
|
ENCODE_DECODE_CONFIG(SwitchConfig)
|
||||||
@@ -87,3 +92,12 @@ INPUT_SWITCH_CONFIG(YamlSliderConfig, CPN_MAX_INPUTS, InputConfig, InputConfig)
|
|||||||
INPUT_SWITCH_CONFIG(YamlStickConfig, CPN_MAX_INPUTS, InputConfig, InputConfig)
|
INPUT_SWITCH_CONFIG(YamlStickConfig, CPN_MAX_INPUTS, InputConfig, InputConfig)
|
||||||
INPUT_SWITCH_CONFIG(YamlSwitchConfig, CPN_MAX_SWITCHES, SwitchConfig, SwitchConfig)
|
INPUT_SWITCH_CONFIG(YamlSwitchConfig, CPN_MAX_SWITCHES, SwitchConfig, SwitchConfig)
|
||||||
INPUT_SWITCH_CONFIG(YamlSwitchesFlex, CPN_MAX_SWITCHES_FLEX, SwitchFlex, SwitchConfig)
|
INPUT_SWITCH_CONFIG(YamlSwitchesFlex, CPN_MAX_SWITCHES_FLEX, SwitchFlex, SwitchConfig)
|
||||||
|
|
||||||
|
namespace YAML
|
||||||
|
{
|
||||||
|
template <>
|
||||||
|
struct convert<RGBLedColor> {
|
||||||
|
static Node encode(const RGBLedColor& rhs);
|
||||||
|
static bool decode(const Node& node, RGBLedColor& rhs);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -170,6 +170,11 @@ bool GeneralSettings::isSwitchFlex(int index) const
|
|||||||
return Boards::isSwitchFlex(index);
|
return Boards::isSwitchFlex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GeneralSettings::isSwitchFunc(int index) const
|
||||||
|
{
|
||||||
|
return Boards::isSwitchFunc(index);
|
||||||
|
}
|
||||||
|
|
||||||
bool GeneralSettings::unassignedInputFlexSwitches() const
|
bool GeneralSettings::unassignedInputFlexSwitches() const
|
||||||
{
|
{
|
||||||
Board::Type board = getCurrentBoard();
|
Board::Type board = getCurrentBoard();
|
||||||
@@ -372,6 +377,10 @@ void GeneralSettings::setDefaultControlTypes(Board::Type board)
|
|||||||
switchConfig[i].type = info.dflt;
|
switchConfig[i].type = info.dflt;
|
||||||
switchConfig[i].inverted = info.inverted;
|
switchConfig[i].inverted = info.inverted;
|
||||||
switchConfig[i].inputIdx = SWITCH_INPUTINDEX_NONE;
|
switchConfig[i].inputIdx = SWITCH_INPUTINDEX_NONE;
|
||||||
|
if (Boards::isSwitchFunc(i)) {
|
||||||
|
switchConfig[i].start = ModelData::FUNC_SWITCH_START_PREVIOUS;
|
||||||
|
switchConfig[i].onColor.setColor(255, 255, 255);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 4; i++) {
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
|
|||||||
@@ -61,6 +61,17 @@ enum UartModes {
|
|||||||
UART_MODE_DEBUG
|
UART_MODE_DEBUG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RGBLedColor {
|
||||||
|
public:
|
||||||
|
RGBLedColor() { clear(); }
|
||||||
|
int r;
|
||||||
|
int g;
|
||||||
|
int b;
|
||||||
|
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(RGBLedColor)); }
|
||||||
|
void setColor(int red, int green, int blue) { r = red; g = green; b = blue; }
|
||||||
|
QColor getQColor() { return QColor(r, g, b); }
|
||||||
|
};
|
||||||
|
|
||||||
class TrainerMix {
|
class TrainerMix {
|
||||||
Q_DECLARE_TR_FUNCTIONS(TrainerMix)
|
Q_DECLARE_TR_FUNCTIONS(TrainerMix)
|
||||||
|
|
||||||
@@ -362,6 +373,12 @@ class GeneralSettings {
|
|||||||
Board::SwitchType type;
|
Board::SwitchType type;
|
||||||
bool inverted;
|
bool inverted;
|
||||||
int inputIdx; // used if switch tag = FLn, value -1 = none selected
|
int inputIdx; // used if switch tag = FLn, value -1 = none selected
|
||||||
|
// CFS settings
|
||||||
|
unsigned int start;
|
||||||
|
unsigned int onColorLuaOverride;
|
||||||
|
unsigned int offColorLuaOverride;
|
||||||
|
RGBLedColor onColor;
|
||||||
|
RGBLedColor offColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
SwitchConfig switchConfig[CPN_MAX_SWITCHES];
|
SwitchConfig switchConfig[CPN_MAX_SWITCHES];
|
||||||
@@ -377,6 +394,7 @@ class GeneralSettings {
|
|||||||
bool isInputFlexSwitchAvailable(int index) const;
|
bool isInputFlexSwitchAvailable(int index) const;
|
||||||
bool isSwitchAvailable(int index) const;
|
bool isSwitchAvailable(int index) const;
|
||||||
bool isSwitchFlex(int index) const;
|
bool isSwitchFlex(int index) const;
|
||||||
|
bool isSwitchFunc(int index) const;
|
||||||
bool unassignedInputFlexSwitches() const;
|
bool unassignedInputFlexSwitches() const;
|
||||||
|
|
||||||
QString antennaModeToString() const;
|
QString antennaModeToString() const;
|
||||||
|
|||||||
@@ -223,8 +223,13 @@ void ModelData::setDefaultFunctionSwitches(int functionSwitchCount)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < functionSwitchCount; i++) {
|
for (int i = 0; i < functionSwitchCount; i++) {
|
||||||
setFuncSwitchConfig(i, Board::SWITCH_2POS);
|
customSwitches[i].type = Board::SWITCH_GLOBAL;
|
||||||
setFuncSwitchGroup(i, 1);
|
customSwitches[i].group = 0;
|
||||||
|
customSwitches[i].start = ModelData::FUNC_SWITCH_START_PREVIOUS;
|
||||||
|
customSwitches[i].state = 0;
|
||||||
|
customSwitches[i].name[0] = 0;
|
||||||
|
customSwitches[i].onColor.setColor(255, 255, 255);
|
||||||
|
customSwitches[i].offColor.setColor(0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,20 +394,18 @@ int ModelData::getChannelsMax(bool forceExtendedLimits) const
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelData::isFunctionSwitchPositionAvailable(int index) const
|
bool ModelData::isFunctionSwitchPositionAvailable(int swIndex, int swPos, const GeneralSettings * const gs) const
|
||||||
{
|
{
|
||||||
if (index == 0)
|
if (swPos == 1)
|
||||||
return true;
|
|
||||||
|
|
||||||
div_t qr = div(abs(index) - 1, 3);
|
|
||||||
int fs = getFuncSwitchConfig(qr.quot);
|
|
||||||
|
|
||||||
if (qr.rem == 1) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
else {
|
int fsindex = Boards::getCFSIndexForSwitch(swIndex);
|
||||||
return fs != Board::SWITCH_NOT_AVAILABLE;
|
int fs = getFuncSwitchConfig(fsindex);
|
||||||
}
|
|
||||||
|
if (fs == Board::SWITCH_GLOBAL)
|
||||||
|
return gs->switchConfig[swIndex].type != Board::SWITCH_NOT_AVAILABLE;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelData::isFunctionSwitchSourceAllowed(int index) const
|
bool ModelData::isFunctionSwitchSourceAllowed(int index) const
|
||||||
@@ -1747,30 +1750,32 @@ AbstractStaticItemModel * ModelData::trainerModeItemModel(const GeneralSettings
|
|||||||
return mdl;
|
return mdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ModelData::getFuncSwitchConfig(unsigned int index) const
|
Board::SwitchType ModelData::getFuncSwitchConfig(unsigned int index) const
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
return Helpers::getBitmappedValue(functionSwitchConfig, index, 2);
|
return customSwitches[index].type;
|
||||||
else
|
else
|
||||||
return FUNC_SWITCH_CONFIG_NONE;
|
return Board::SWITCH_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelData::setFuncSwitchConfig(unsigned int index, unsigned int value)
|
void ModelData::setFuncSwitchConfig(unsigned int index, Board::SwitchType value)
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
Helpers::setBitmappedValue(functionSwitchConfig, value, index, 2);
|
customSwitches[index].type = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString ModelData::funcSwitchConfigToString(unsigned int value)
|
QString ModelData::funcSwitchConfigToString(unsigned int value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case FUNC_SWITCH_CONFIG_NONE:
|
case Board::SWITCH_NOT_AVAILABLE:
|
||||||
return tr("NONE");
|
return tr("NONE");
|
||||||
case FUNC_SWITCH_CONFIG_TOGGLE:
|
case Board::SWITCH_TOGGLE:
|
||||||
return tr("TOGGLE");
|
return tr("TOGGLE");
|
||||||
case FUNC_SWITCH_CONFIG_2POS:
|
case Board::SWITCH_2POS:
|
||||||
return tr("2POS");
|
return tr("2POS");
|
||||||
|
case Board::SWITCH_GLOBAL:
|
||||||
|
return tr("Global");
|
||||||
default:
|
default:
|
||||||
return CPN_STR_UNKNOWN_ITEM;
|
return CPN_STR_UNKNOWN_ITEM;
|
||||||
}
|
}
|
||||||
@@ -1781,7 +1786,7 @@ AbstractStaticItemModel * ModelData::funcSwitchConfigItemModel()
|
|||||||
{
|
{
|
||||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
mdl->setName(AIM_MODELDATA_FUNCSWITCHCONFIG);
|
mdl->setName(AIM_MODELDATA_FUNCSWITCHCONFIG);
|
||||||
for (unsigned int i = FUNC_SWITCH_CONFIG_FIRST; i <= FUNC_SWITCH_CONFIG_LAST; i++) {
|
for (unsigned int i = Board::SWITCH_NOT_AVAILABLE; i <= Board::SWITCH_GLOBAL; i++) {
|
||||||
mdl->appendToItemList(funcSwitchConfigToString(i), i);
|
mdl->appendToItemList(funcSwitchConfigToString(i), i);
|
||||||
}
|
}
|
||||||
mdl->loadItemList();
|
mdl->loadItemList();
|
||||||
@@ -1809,7 +1814,7 @@ AbstractStaticItemModel * ModelData::funcSwitchGroupsModel()
|
|||||||
mdl->setName(AIM_MODELDATA_FUNCSWITCHGROUPS);
|
mdl->setName(AIM_MODELDATA_FUNCSWITCHGROUPS);
|
||||||
|
|
||||||
mdl->appendToItemList(tr("---"), 0);
|
mdl->appendToItemList(tr("---"), 0);
|
||||||
for (unsigned int i = 1; i <= 3; i += 1) {
|
for (unsigned int i = 1; i <= Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups); i += 1) {
|
||||||
mdl->appendToItemList(tr("Group ") + QString::number(i), i);
|
mdl->appendToItemList(tr("Group ") + QString::number(i), i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1820,7 +1825,7 @@ AbstractStaticItemModel * ModelData::funcSwitchGroupsModel()
|
|||||||
unsigned int ModelData::getFuncSwitchGroup(unsigned int index) const
|
unsigned int ModelData::getFuncSwitchGroup(unsigned int index) const
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
return Helpers::getBitmappedValue(functionSwitchGroup, index, 2);
|
return customSwitches[index].group;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1828,14 +1833,13 @@ unsigned int ModelData::getFuncSwitchGroup(unsigned int index) const
|
|||||||
void ModelData::setFuncSwitchGroup(unsigned int index, unsigned int value)
|
void ModelData::setFuncSwitchGroup(unsigned int index, unsigned int value)
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
Helpers::setBitmappedValue(functionSwitchGroup, value, index, 2);
|
customSwitches[index].group = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ModelData::getFuncSwitchAlwaysOnGroup(unsigned int group) const
|
unsigned int ModelData::getFuncSwitchAlwaysOnGroup(unsigned int group) const
|
||||||
{
|
{
|
||||||
if (group > 0 && group < 4) {
|
if (group > 0 && group <= Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups)) {
|
||||||
unsigned int switchcnt = Boards::getCapability(getCurrentFirmware()->getBoard(), Board::FunctionSwitches);
|
return cfsGroupOn[group];
|
||||||
return Helpers::getBitmappedValue(functionSwitchGroup, group, 1, 2 * switchcnt);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1851,16 +1855,15 @@ unsigned int ModelData::getFuncSwitchAlwaysOnGroupForSwitch(unsigned int index)
|
|||||||
|
|
||||||
void ModelData::setFuncSwitchAlwaysOnGroup(unsigned int group, unsigned int value)
|
void ModelData::setFuncSwitchAlwaysOnGroup(unsigned int group, unsigned int value)
|
||||||
{
|
{
|
||||||
if (group > 0 && group < 4) {
|
if (group > 0 && group <= Boards::getCapability(getCurrentBoard(), Board::FunctionSwitchGroups)) {
|
||||||
unsigned int switchcnt = Boards::getCapability(getCurrentFirmware()->getBoard(), Board::FunctionSwitches);
|
cfsGroupOn[group] = value;
|
||||||
Helpers::setBitmappedValue(functionSwitchGroup, value, group, 1, 2 * switchcnt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ModelData::getFuncSwitchStart(unsigned int index) const
|
unsigned int ModelData::getFuncSwitchStart(unsigned int index) const
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
return Helpers::getBitmappedValue(functionSwitchStartConfig, index, 2);
|
return customSwitches[index].start;
|
||||||
else
|
else
|
||||||
return FUNC_SWITCH_START_OFF;
|
return FUNC_SWITCH_START_OFF;
|
||||||
}
|
}
|
||||||
@@ -1868,7 +1871,7 @@ unsigned int ModelData::getFuncSwitchStart(unsigned int index) const
|
|||||||
void ModelData::setFuncSwitchStart(unsigned int index, unsigned int value)
|
void ModelData::setFuncSwitchStart(unsigned int index, unsigned int value)
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
Helpers::setBitmappedValue(functionSwitchStartConfig, value, index, 2);
|
customSwitches[index].start = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ModelData::getFuncGroupSwitchCount(unsigned int group, int switchcnt) const
|
int ModelData::getFuncGroupSwitchCount(unsigned int group, int switchcnt) const
|
||||||
@@ -1916,7 +1919,7 @@ void ModelData::setGroupSwitchState(uint8_t group, int switchcnt)
|
|||||||
if (getFuncSwitchAlwaysOnGroup(group)) {
|
if (getFuncSwitchAlwaysOnGroup(group)) {
|
||||||
for (int j = 0; j < switchcnt; j += 1) {
|
for (int j = 0; j < switchcnt; j += 1) {
|
||||||
if (getFuncSwitchGroup(j) == group) {
|
if (getFuncSwitchGroup(j) == group) {
|
||||||
setFuncSwitchConfig(j, FUNC_SWITCH_CONFIG_2POS); // Toggle not valid
|
setFuncSwitchConfig(j, Board::SWITCH_2POS); // Toggle not valid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getFuncGroupSwitchStart(group, switchcnt) == (unsigned int)switchcnt + 1) {
|
if (getFuncGroupSwitchStart(group, switchcnt) == (unsigned int)switchcnt + 1) {
|
||||||
@@ -2026,3 +2029,16 @@ int ModelData::getInputLine(int index) const
|
|||||||
|
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Board::SwitchType ModelData::getSwitchType(int sw, const GeneralSettings & gs) const
|
||||||
|
{
|
||||||
|
if (sw < 0 || sw >= Boards::getCapability(getCurrentBoard(), Board::Switches))
|
||||||
|
return Board::SWITCH_NOT_AVAILABLE;
|
||||||
|
|
||||||
|
if (Boards::isSwitchFunc(sw)) {
|
||||||
|
int fsIndex = Boards::getCFSIndexForSwitch(sw);
|
||||||
|
if (customSwitches[fsIndex].type != Board::SWITCH_GLOBAL)
|
||||||
|
return customSwitches[fsIndex].type;
|
||||||
|
}
|
||||||
|
return gs.switchConfig[sw].type;
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,13 +104,19 @@ class USBJoystickChData {
|
|||||||
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(USBJoystickChData)); }
|
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(USBJoystickChData)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class RGBLedColor {
|
class customSwitch {
|
||||||
public:
|
public:
|
||||||
RGBLedColor() { clear(); }
|
customSwitch() { clear(); }
|
||||||
int r;
|
Board::SwitchType type;
|
||||||
int g;
|
unsigned int group;
|
||||||
int b;
|
unsigned int start;
|
||||||
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(RGBLedColor)); }
|
unsigned int state;
|
||||||
|
char name[HARDWARE_NAME_LEN + 1];
|
||||||
|
unsigned int onColorLuaOverride;
|
||||||
|
unsigned int offColorLuaOverride;
|
||||||
|
RGBLedColor onColor;
|
||||||
|
RGBLedColor offColor;
|
||||||
|
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(customSwitch)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModelData {
|
class ModelData {
|
||||||
@@ -171,7 +177,6 @@ class ModelData {
|
|||||||
SwashRingData swashRingData;
|
SwashRingData swashRingData;
|
||||||
unsigned int thrTraceSrc;
|
unsigned int thrTraceSrc;
|
||||||
uint64_t switchWarningStates;
|
uint64_t switchWarningStates;
|
||||||
unsigned int switchWarningEnable;
|
|
||||||
unsigned int thrTrimSwitch;
|
unsigned int thrTrimSwitch;
|
||||||
unsigned int potsWarningMode;
|
unsigned int potsWarningMode;
|
||||||
bool potsWarnEnabled[CPN_MAX_INPUTS];
|
bool potsWarnEnabled[CPN_MAX_INPUTS];
|
||||||
@@ -220,30 +225,17 @@ class ModelData {
|
|||||||
unsigned int modelCustomScriptsDisabled;
|
unsigned int modelCustomScriptsDisabled;
|
||||||
unsigned int modelTelemetryDisabled;
|
unsigned int modelTelemetryDisabled;
|
||||||
|
|
||||||
enum FunctionSwitchConfig {
|
|
||||||
FUNC_SWITCH_CONFIG_NONE,
|
|
||||||
FUNC_SWITCH_CONFIG_FIRST = FUNC_SWITCH_CONFIG_NONE,
|
|
||||||
FUNC_SWITCH_CONFIG_TOGGLE,
|
|
||||||
FUNC_SWITCH_CONFIG_2POS,
|
|
||||||
FUNC_SWITCH_CONFIG_LAST = FUNC_SWITCH_CONFIG_2POS
|
|
||||||
};
|
|
||||||
|
|
||||||
enum FunctionSwitchStart {
|
enum FunctionSwitchStart {
|
||||||
FUNC_SWITCH_START_ON,
|
|
||||||
FUNC_SWITCH_START_FIRST = FUNC_SWITCH_START_ON,
|
|
||||||
FUNC_SWITCH_START_OFF,
|
FUNC_SWITCH_START_OFF,
|
||||||
|
FUNC_SWITCH_START_FIRST = FUNC_SWITCH_START_OFF,
|
||||||
|
FUNC_SWITCH_START_ON,
|
||||||
FUNC_SWITCH_START_PREVIOUS,
|
FUNC_SWITCH_START_PREVIOUS,
|
||||||
FUNC_SWITCH_START_LAST = FUNC_SWITCH_START_PREVIOUS
|
FUNC_SWITCH_START_LAST = FUNC_SWITCH_START_PREVIOUS
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function switches
|
// Function switches
|
||||||
unsigned int functionSwitchConfig;
|
customSwitch customSwitches[CPN_MAX_SWITCHES_FUNCTION];
|
||||||
unsigned int functionSwitchGroup;
|
unsigned int cfsGroupOn[4];
|
||||||
unsigned int functionSwitchStartConfig;
|
|
||||||
unsigned int functionSwitchLogicalState;
|
|
||||||
char functionSwitchNames[CPN_MAX_SWITCHES_FUNCTION][HARDWARE_NAME_LEN + 1];
|
|
||||||
RGBLedColor functionSwitchLedONColor[CPN_MAX_SWITCHES_FUNCTION];
|
|
||||||
RGBLedColor functionSwitchLedOFFColor[CPN_MAX_SWITCHES_FUNCTION];
|
|
||||||
|
|
||||||
// Custom USB joytsick mapping
|
// Custom USB joytsick mapping
|
||||||
unsigned int usbJoystickExtMode;
|
unsigned int usbJoystickExtMode;
|
||||||
@@ -287,9 +279,11 @@ class ModelData {
|
|||||||
int getChannelsMax(bool forceExtendedLimits=false) const;
|
int getChannelsMax(bool forceExtendedLimits=false) const;
|
||||||
|
|
||||||
bool isAvailable(const RawSwitch & swtch) const;
|
bool isAvailable(const RawSwitch & swtch) const;
|
||||||
bool isFunctionSwitchPositionAvailable(int index) const;
|
bool isFunctionSwitchPositionAvailable(int swIndex, int swPos, const GeneralSettings * const gs) const;
|
||||||
bool isFunctionSwitchSourceAllowed(int index) const;
|
bool isFunctionSwitchSourceAllowed(int index) const;
|
||||||
|
|
||||||
|
const Board::SwitchType getSwitchType(int sw, const GeneralSettings & gs) const;
|
||||||
|
|
||||||
enum ReferenceUpdateAction {
|
enum ReferenceUpdateAction {
|
||||||
REF_UPD_ACT_CLEAR,
|
REF_UPD_ACT_CLEAR,
|
||||||
REF_UPD_ACT_SHIFT,
|
REF_UPD_ACT_SHIFT,
|
||||||
@@ -344,8 +338,8 @@ class ModelData {
|
|||||||
static QString trainerModeToString(const int value);
|
static QString trainerModeToString(const int value);
|
||||||
bool isTrainerModeAvailable(const GeneralSettings & generalSettings, const Firmware * firmware, const int value);
|
bool isTrainerModeAvailable(const GeneralSettings & generalSettings, const Firmware * firmware, const int value);
|
||||||
AbstractStaticItemModel * trainerModeItemModel(const GeneralSettings & generalSettings, const Firmware * firmware);
|
AbstractStaticItemModel * trainerModeItemModel(const GeneralSettings & generalSettings, const Firmware * firmware);
|
||||||
unsigned int getFuncSwitchConfig(unsigned int index) const;
|
Board::SwitchType getFuncSwitchConfig(unsigned int index) const;
|
||||||
void setFuncSwitchConfig(unsigned int index, unsigned int value);
|
void setFuncSwitchConfig(unsigned int index, Board::SwitchType value);
|
||||||
static QString funcSwitchConfigToString(unsigned int value);
|
static QString funcSwitchConfigToString(unsigned int value);
|
||||||
static AbstractStaticItemModel * funcSwitchConfigItemModel();
|
static AbstractStaticItemModel * funcSwitchConfigItemModel();
|
||||||
static AbstractStaticItemModel * funcSwitchGroupStartSwitchModel(int switchcnt);
|
static AbstractStaticItemModel * funcSwitchGroupStartSwitchModel(int switchcnt);
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
|||||||
if (model) {
|
if (model) {
|
||||||
int fsindex = Boards::getSwitchTagNum(index - 1, board) - 1;
|
int fsindex = Boards::getSwitchTagNum(index - 1, board) - 1;
|
||||||
if (fsindex >= 0 && fsindex < CPN_MAX_SWITCHES_FUNCTION)
|
if (fsindex >= 0 && fsindex < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
custName = QString(model->functionSwitchNames[fsindex]).trimmed();
|
custName = QString(model->customSwitches[fsindex].name).trimmed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
|||||||
if (Boards::isSwitchFunc(qr.quot, board)) {
|
if (Boards::isSwitchFunc(qr.quot, board)) {
|
||||||
if (modelData) {
|
if (modelData) {
|
||||||
int fsindex = Boards::getSwitchTagNum(qr.quot, board) - 1;
|
int fsindex = Boards::getSwitchTagNum(qr.quot, board) - 1;
|
||||||
custName = QString(modelData->functionSwitchNames[fsindex]).trimmed();
|
custName = QString(modelData->customSwitches[fsindex].name).trimmed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -205,8 +205,7 @@ bool RawSwitch::isAvailable(const ModelData * const model, const GeneralSettings
|
|||||||
|
|
||||||
if (model) {
|
if (model) {
|
||||||
if (type == SWITCH_TYPE_SWITCH && b.isSwitchFunc(sw.quot, board)) {
|
if (type == SWITCH_TYPE_SWITCH && b.isSwitchFunc(sw.quot, board)) {
|
||||||
int fsindex = (((Boards::getSwitchTagNum(sw.quot, board) - 1) * 3) + sw.rem + 1) * ( index < 0 ? -1 : 1);
|
return model->isFunctionSwitchPositionAvailable(sw.quot, sw.rem, gs);
|
||||||
return model->isFunctionSwitchPositionAvailable(fsindex);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return model->isAvailable(*this);
|
return model->isAvailable(*this);
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
|||||||
|
|
||||||
count = Boards::getCapability(board, Board::Sticks);
|
count = Boards::getCapability(board, Board::Sticks);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
addLabel("");
|
||||||
|
addLabel(tr("Name"));
|
||||||
|
addParams();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
addStick(i);
|
addStick(i);
|
||||||
}
|
}
|
||||||
@@ -158,22 +161,46 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
|||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
addSection(tr("Pots"));
|
addSection(tr("Pots"));
|
||||||
|
addLabel("");
|
||||||
|
addLabel(tr("Name"));
|
||||||
|
addLabel(tr("Type"));
|
||||||
|
addLabel(tr("Invert"));
|
||||||
|
addParams();
|
||||||
for (int i = Boards::getCapability(board, Board::Sticks); i < count; i++) {
|
for (int i = Boards::getCapability(board, Board::Sticks); i < count; i++) {
|
||||||
if (Boards::isInputConfigurable(i, board))
|
if (Boards::isInputConfigurable(i, board))
|
||||||
addFlex(i);
|
addFlex(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
count = Boards::getCapability(board, Board::Switches);
|
if (Boards::getCapability(board, Board::Switches)) {
|
||||||
|
addSection(tr("Switches"));
|
||||||
|
|
||||||
if (count) {
|
addLabel("");
|
||||||
|
addLabel(tr("Name"));
|
||||||
|
addLabel(tr("Type"));
|
||||||
|
addParams();
|
||||||
|
|
||||||
|
for (int i = 0; i < CPN_MAX_SWITCHES; i++) {
|
||||||
|
if (Boards::isSwitchConfigurable(i, board) && !generalSettings.isSwitchFunc(i) && !generalSettings.isSwitchFlex(i))
|
||||||
|
addSwitch(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Boards::getCapability(board, Board::FlexSwitches)) {
|
||||||
// All values except -1 (None) are mutually exclusive
|
// All values except -1 (None) are mutually exclusive
|
||||||
exclFlexSwitchesGroup = new ExclusiveComboGroup(
|
exclFlexSwitchesGroup = new ExclusiveComboGroup(
|
||||||
this, [=](const QVariant &value) { return value == -1; });
|
this, [=](const QVariant &value) { return value == -1; });
|
||||||
|
|
||||||
addSection(tr("Switches"));
|
addSection(tr("Flex Switches"));
|
||||||
for (int i = 0; i < count && i < CPN_MAX_SWITCHES; i++) {
|
|
||||||
if (Boards::isSwitchConfigurable(i, board))
|
addLabel("");
|
||||||
|
addLabel(tr("Name"));
|
||||||
|
addLabel(tr("Source"));
|
||||||
|
addLabel(tr("Type"));
|
||||||
|
addParams();
|
||||||
|
|
||||||
|
for (int i = 0; i < CPN_MAX_SWITCHES; i++) {
|
||||||
|
if (Boards::isSwitchConfigurable(i, board) && generalSettings.isSwitchFlex(i))
|
||||||
addSwitch(i);
|
addSwitch(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +211,27 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Boards::getCapability(board, Board::FunctionSwitches)) {
|
||||||
|
addSection(tr("Customisable Switches"));
|
||||||
|
|
||||||
|
addLabel("");
|
||||||
|
addLabel(tr("Name"));
|
||||||
|
addLabel(tr("Type"));
|
||||||
|
addLabel(tr("Start"));
|
||||||
|
if (Boards::getCapability(board, Board::FunctionSwitchColors)) {
|
||||||
|
addLabel(tr("Off color"));
|
||||||
|
addLabel(tr("Lua override"));
|
||||||
|
addLabel(tr("On color"));
|
||||||
|
addLabel(tr("Lua override"));
|
||||||
|
}
|
||||||
|
addParams();
|
||||||
|
|
||||||
|
for (int i = 0; i < CPN_MAX_SWITCHES; i++) {
|
||||||
|
if (Boards::isSwitchConfigurable(i, board) && generalSettings.isSwitchFunc(i))
|
||||||
|
addSwitch(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addLine();
|
addLine();
|
||||||
|
|
||||||
if (Boards::getCapability(board, Board::HasRTC)) {
|
if (Boards::getCapability(board, Board::HasRTC)) {
|
||||||
@@ -502,7 +550,9 @@ void HardwarePanel::addSwitch(int index)
|
|||||||
GeneralSettings::SwitchConfig &config = generalSettings.switchConfig[index];
|
GeneralSettings::SwitchConfig &config = generalSettings.switchConfig[index];
|
||||||
Board::SwitchInfo info = Boards::getSwitchInfo(index);
|
Board::SwitchInfo info = Boards::getSwitchInfo(index);
|
||||||
|
|
||||||
addLabel(Boards::getSwitchName(index));
|
QLabel *label = new QLabel(this);
|
||||||
|
label->setText(Boards::getSwitchName(index));
|
||||||
|
params->append(label);
|
||||||
|
|
||||||
AutoLineEdit *name = new AutoLineEdit(this);
|
AutoLineEdit *name = new AutoLineEdit(this);
|
||||||
name->setValidator(new NameValidator(board, this));
|
name->setValidator(new NameValidator(board, this));
|
||||||
@@ -550,6 +600,76 @@ void HardwarePanel::addSwitch(int index)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (generalSettings.isSwitchFunc(index)) {
|
||||||
|
AutoComboBox *start = new AutoComboBox(this);
|
||||||
|
start->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
AbstractStaticItemModel *fsStart = ModelData::funcSwitchStartItemModel();
|
||||||
|
start->setModel(fsStart);
|
||||||
|
int & swstart = (int &)config.start;
|
||||||
|
start->setField(swstart, this);
|
||||||
|
start->setEnabled(config.type == Board::SWITCH_2POS);
|
||||||
|
params->append(start);
|
||||||
|
|
||||||
|
connect(type, &AutoComboBox::currentDataChanged, [=] (int val) {
|
||||||
|
start->setEnabled(val == Board::SWITCH_2POS);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Boards::getCapability(board, Board::FunctionSwitchColors)) {
|
||||||
|
const QString qss = QString("border-style: outset; border-width: 2px; border-radius: 5px; border-color: darkgrey; padding: 2px; background-color: %1;");
|
||||||
|
QPushButton * btnOffColor = new QPushButton();
|
||||||
|
QColor off = generalSettings.switchConfig[index].offColor.getQColor();
|
||||||
|
btnOffColor->setStyleSheet(QString(qss).arg(off.name()));
|
||||||
|
connect(btnOffColor, &QPushButton::clicked, [=]() {
|
||||||
|
QColorDialog *dlg = new QColorDialog();
|
||||||
|
QColor color = dlg->getColor(generalSettings.switchConfig[index].offColor.getQColor());
|
||||||
|
if (color.isValid()) {
|
||||||
|
generalSettings.switchConfig[index].offColor.setColor(color.red(), color.green(), color.blue());
|
||||||
|
btnOffColor->setStyleSheet(QString(qss).arg(color.name()));
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
params->append(btnOffColor);
|
||||||
|
connect(type, &AutoComboBox::currentDataChanged, [=] (int val) {
|
||||||
|
btnOffColor->setEnabled(val != Board::SWITCH_NOT_AVAILABLE); });
|
||||||
|
|
||||||
|
QCheckBox * cbOffLuaOverride = new QCheckBox(this);
|
||||||
|
cbOffLuaOverride->setChecked(generalSettings.switchConfig[index].offColorLuaOverride);
|
||||||
|
connect(cbOffLuaOverride, &QCheckBox::toggled, [=](int value) {
|
||||||
|
generalSettings.switchConfig[index].offColorLuaOverride = value;
|
||||||
|
emit modified();
|
||||||
|
});
|
||||||
|
params->append(cbOffLuaOverride);
|
||||||
|
connect(type, &AutoComboBox::currentDataChanged, [=] (int val) {
|
||||||
|
cbOffLuaOverride->setEnabled(val != Board::SWITCH_NOT_AVAILABLE); });
|
||||||
|
|
||||||
|
QPushButton * btnOnColor = new QPushButton(tr(""));
|
||||||
|
QColor on = generalSettings.switchConfig[index].onColor.getQColor();
|
||||||
|
btnOnColor->setStyleSheet(QString(qss).arg(on.name()));
|
||||||
|
connect(btnOnColor, &QPushButton::clicked, [=]() {
|
||||||
|
QColorDialog *dlg = new QColorDialog();
|
||||||
|
QColor color = dlg->getColor(generalSettings.switchConfig[index].onColor.getQColor());
|
||||||
|
if (color.isValid()) {
|
||||||
|
generalSettings.switchConfig[index].onColor.setColor(color.red(), color.green(), color.blue());
|
||||||
|
btnOnColor->setStyleSheet(QString(qss).arg(color.name()));
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
params->append(btnOnColor);
|
||||||
|
connect(type, &AutoComboBox::currentDataChanged, [=] (int val) {
|
||||||
|
btnOnColor->setEnabled(val != Board::SWITCH_NOT_AVAILABLE); });
|
||||||
|
|
||||||
|
QCheckBox * cbOnLuaOverride = new QCheckBox(this);
|
||||||
|
cbOnLuaOverride->setChecked(generalSettings.switchConfig[index].onColorLuaOverride);
|
||||||
|
connect(cbOnLuaOverride, &QCheckBox::toggled, [=](int value) {
|
||||||
|
generalSettings.switchConfig[index].onColorLuaOverride = value;
|
||||||
|
emit modified();
|
||||||
|
});
|
||||||
|
params->append(cbOnLuaOverride);
|
||||||
|
connect(type, &AutoComboBox::currentDataChanged, [=] (int val) {
|
||||||
|
cbOnLuaOverride->setEnabled(val != Board::SWITCH_NOT_AVAILABLE); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addParams();
|
addParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,7 +677,7 @@ void HardwarePanel::addLabel(QString text)
|
|||||||
{
|
{
|
||||||
QLabel *label = new QLabel(this);
|
QLabel *label = new QLabel(this);
|
||||||
label->setText(text);
|
label->setText(text);
|
||||||
grid->addWidget(label, row, 0);
|
params->append(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwarePanel::addLine()
|
void HardwarePanel::addLine()
|
||||||
@@ -572,22 +692,18 @@ void HardwarePanel::addLine()
|
|||||||
|
|
||||||
void HardwarePanel::addParams()
|
void HardwarePanel::addParams()
|
||||||
{
|
{
|
||||||
int col = 0;
|
|
||||||
QGridLayout *subgrid = new QGridLayout();
|
|
||||||
|
|
||||||
for (int i = 0; i < params->size(); i++) {
|
for (int i = 0; i < params->size(); i++) {
|
||||||
subgrid->addWidget(params->at(i), 0, col++);
|
grid->addWidget(params->at(i), row, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
addHSpring(subgrid, col, 0);
|
row += 1;
|
||||||
grid->addLayout(subgrid, row++, 1);
|
|
||||||
params->clear();
|
params->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwarePanel::addSection(QString text)
|
void HardwarePanel::addSection(QString text)
|
||||||
{
|
{
|
||||||
addLabel(QString("<b>%1</b>").arg(text));
|
addLabel(QString("<b>%1</b>").arg(text));
|
||||||
row++;
|
addParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwarePanel::updateSerialPortUSBVCP()
|
void HardwarePanel::updateSerialPortUSBVCP()
|
||||||
|
|||||||
@@ -219,12 +219,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||||||
|
|
||||||
// Startup switches warnings
|
// Startup switches warnings
|
||||||
for (int i = 0; i < Boards::getBoardCapability(board, Board::Switches); i++) {
|
for (int i = 0; i < Boards::getBoardCapability(board, Board::Switches); i++) {
|
||||||
GeneralSettings::SwitchConfig &swcfg = generalSettings.switchConfig[i];
|
Board::SwitchType swType = model.getSwitchType(i, generalSettings);
|
||||||
|
|
||||||
if (Boards::isSwitchFunc(i, board) || !generalSettings.isSwitchAvailable(i) || swcfg.type == Board::SWITCH_TOGGLE) {
|
|
||||||
model.switchWarningEnable |= (1 << i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
RawSource src(RawSourceType::SOURCE_TYPE_SWITCH, i + 1);
|
RawSource src(RawSourceType::SOURCE_TYPE_SWITCH, i + 1);
|
||||||
QLabel * label = new QLabel(this);
|
QLabel * label = new QLabel(this);
|
||||||
@@ -242,7 +237,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||||||
slider->setPageStep(1);
|
slider->setPageStep(1);
|
||||||
slider->setTickInterval(1);
|
slider->setTickInterval(1);
|
||||||
label->setText(src.toString(&model, &generalSettings));
|
label->setText(src.toString(&model, &generalSettings));
|
||||||
slider->setMaximum(swcfg.type == Board::SWITCH_3POS ? 2 : 1);
|
slider->setMaximum(swType == Board::SWITCH_3POS ? 2 : 1);
|
||||||
cb->setProperty("index", i);
|
cb->setProperty("index", i);
|
||||||
ui->switchesStartupLayout->addWidget(label, 0, i + 1);
|
ui->switchesStartupLayout->addWidget(label, 0, i + 1);
|
||||||
ui->switchesStartupLayout->setAlignment(label, Qt::AlignCenter);
|
ui->switchesStartupLayout->setAlignment(label, Qt::AlignCenter);
|
||||||
@@ -252,6 +247,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||||||
ui->switchesStartupLayout->setAlignment(cb, Qt::AlignCenter);
|
ui->switchesStartupLayout->setAlignment(cb, Qt::AlignCenter);
|
||||||
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(startupSwitchEdited(int)));
|
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(startupSwitchEdited(int)));
|
||||||
connect(cb, SIGNAL(toggled(bool)), this, SLOT(startupSwitchToggled(bool)));
|
connect(cb, SIGNAL(toggled(bool)), this, SLOT(startupSwitchToggled(bool)));
|
||||||
|
startupSwitchesLabels << label;
|
||||||
startupSwitchesSliders << slider;
|
startupSwitchesSliders << slider;
|
||||||
startupSwitchesCheckboxes << cb;
|
startupSwitchesCheckboxes << cb;
|
||||||
QWidget::setTabOrder(prevFocus, slider);
|
QWidget::setTabOrder(prevFocus, slider);
|
||||||
@@ -338,6 +334,12 @@ SetupPanel::~SetupPanel()
|
|||||||
delete panelItemModels;
|
delete panelItemModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SetupPanel::canSwitchHaveWarning(int sw)
|
||||||
|
{
|
||||||
|
Board::SwitchType type = model->getSwitchType(sw, generalSettings);
|
||||||
|
return (type == Board::SWITCH_2POS) || (type == Board::SWITCH_3POS);
|
||||||
|
}
|
||||||
|
|
||||||
void SetupPanel::on_extendedLimits_toggled(bool checked)
|
void SetupPanel::on_extendedLimits_toggled(bool checked)
|
||||||
{
|
{
|
||||||
model->extendedLimits = checked;
|
model->extendedLimits = checked;
|
||||||
@@ -510,23 +512,20 @@ void SetupPanel::updateStartupSwitches()
|
|||||||
uint64_t value;
|
uint64_t value;
|
||||||
|
|
||||||
for (int i = 0; i < startupSwitchesSliders.size(); i++) {
|
for (int i = 0; i < startupSwitchesSliders.size(); i++) {
|
||||||
|
QLabel * label = startupSwitchesLabels[i];
|
||||||
QSlider * slider = startupSwitchesSliders[i];
|
QSlider * slider = startupSwitchesSliders[i];
|
||||||
QCheckBox * cb = startupSwitchesCheckboxes[i];
|
QCheckBox * cb = startupSwitchesCheckboxes[i];
|
||||||
int index = slider->property("index").toInt();
|
int index = slider->property("index").toInt();
|
||||||
bool enabled = !(model->switchWarningEnable & (1 << index));
|
value = (switchStates >> (2 * index)) & 0x03;
|
||||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
bool enabled = value != 0;
|
||||||
value = (switchStates >> (2 * index)) & 0x03;
|
if (model->getSwitchType(i, generalSettings) == Board::SWITCH_2POS && value == 3) value = 2;
|
||||||
if (generalSettings.switchConfig[index].type != Board::SWITCH_3POS && value == 2) {
|
slider->setValue((value > 0) ? value - 1 : 0);
|
||||||
value = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = (i == 0 ? switchStates & 0x3 : switchStates & 0x1);
|
|
||||||
switchStates >>= (i == 0 ? 2 : 1);
|
|
||||||
}
|
|
||||||
slider->setValue(value);
|
|
||||||
slider->setEnabled(enabled);
|
slider->setEnabled(enabled);
|
||||||
cb->setChecked(enabled);
|
cb->setChecked(enabled);
|
||||||
|
bool vis = canSwitchHaveWarning(i);
|
||||||
|
label->setVisible(vis);
|
||||||
|
slider->setVisible(vis);
|
||||||
|
cb->setVisible(vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
@@ -539,31 +538,14 @@ void SetupPanel::startupSwitchEdited(int value)
|
|||||||
uint64_t mask;
|
uint64_t mask;
|
||||||
int index = sender()->property("index").toInt();
|
int index = sender()->property("index").toInt();
|
||||||
|
|
||||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
shift = index * 2;
|
||||||
shift = index * 2;
|
mask = 0x03ull << shift;
|
||||||
mask = 0x03ull << shift;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (index == 0) {
|
|
||||||
mask = 0x03;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
shift = index + 1;
|
|
||||||
mask = 0x01ull << shift;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model->switchWarningStates &= ~mask;
|
model->switchWarningStates &= ~mask;
|
||||||
|
|
||||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard()) && generalSettings.switchConfig[index].type != Board::SWITCH_3POS) {
|
if (model->getSwitchType(index, generalSettings) == Board::SWITCH_2POS && value == 1) value = 2;
|
||||||
if (value == 1) {
|
|
||||||
value = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value) {
|
model->switchWarningStates |= ((uint64_t)(value + 1) << shift);
|
||||||
model->switchWarningStates |= ((uint64_t)value << shift);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateStartupSwitches();
|
updateStartupSwitches();
|
||||||
emit modified();
|
emit modified();
|
||||||
@@ -576,9 +558,9 @@ void SetupPanel::startupSwitchToggled(bool checked)
|
|||||||
int index = sender()->property("index").toInt();
|
int index = sender()->property("index").toInt();
|
||||||
|
|
||||||
if (checked)
|
if (checked)
|
||||||
model->switchWarningEnable &= ~(1 << index);
|
model->switchWarningStates |= (1 << (index * 2));
|
||||||
else
|
else
|
||||||
model->switchWarningEnable |= (1 << index);
|
model->switchWarningStates &= ~(3 << (index * 2));
|
||||||
|
|
||||||
updateStartupSwitches();
|
updateStartupSwitches();
|
||||||
emit modified();
|
emit modified();
|
||||||
@@ -866,5 +848,6 @@ void SetupPanel::onModuleUpdateItemModels()
|
|||||||
|
|
||||||
void SetupPanel::onFunctionSwitchesUpdateItemModels()
|
void SetupPanel::onFunctionSwitchesUpdateItemModels()
|
||||||
{
|
{
|
||||||
|
updateStartupSwitches();
|
||||||
sharedItemModels->update(AbstractItemModel::IMUE_FunctionSwitches);
|
sharedItemModels->update(AbstractItemModel::IMUE_FunctionSwitches);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ class SetupPanel : public ModelPanel
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Setup *ui;
|
Ui::Setup *ui;
|
||||||
|
QVector<QLabel *> startupSwitchesLabels;
|
||||||
QVector<QSlider *> startupSwitchesSliders;
|
QVector<QSlider *> startupSwitchesSliders;
|
||||||
QVector<QCheckBox *> startupSwitchesCheckboxes;
|
QVector<QCheckBox *> startupSwitchesCheckboxes;
|
||||||
QVector<QCheckBox *> potWarningCheckboxes;
|
QVector<QCheckBox *> potWarningCheckboxes;
|
||||||
@@ -97,6 +98,7 @@ class SetupPanel : public ModelPanel
|
|||||||
TimerPanel * timers[CPN_MAX_TIMERS];
|
TimerPanel * timers[CPN_MAX_TIMERS];
|
||||||
FunctionSwitchesPanel * funcswitches;
|
FunctionSwitchesPanel * funcswitches;
|
||||||
|
|
||||||
|
bool canSwitchHaveWarning(int sw);
|
||||||
void updateStartupSwitches();
|
void updateStartupSwitches();
|
||||||
void updatePotWarnings();
|
void updatePotWarnings();
|
||||||
void updateBeepCenter();
|
void updateBeepCenter();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "ui_setup_function_switches.h"
|
#include "ui_setup_function_switches.h"
|
||||||
#include "namevalidator.h"
|
#include "namevalidator.h"
|
||||||
#include "autolineedit.h"
|
#include "autolineedit.h"
|
||||||
|
#include <QColorDialog>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
@@ -42,13 +43,16 @@ bool FilteredGroupSwitchesModel::filterAcceptsRow(int sourceRow, const QModelInd
|
|||||||
bool FilteredSwitchGroupsModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
bool FilteredSwitchGroupsModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
||||||
{
|
{
|
||||||
if (sourceRow == 0) return true;
|
if (sourceRow == 0) return true;
|
||||||
if (m_model->getFuncSwitchConfig(m_switch) == ModelData::FUNC_SWITCH_CONFIG_NONE) return false;
|
if (m_model->getFuncSwitchConfig(m_switch) == Board::SWITCH_NOT_AVAILABLE) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilteredSwitchConfigsModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
bool FilteredSwitchConfigsModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
||||||
{
|
{
|
||||||
if (sourceRow == ModelData::FUNC_SWITCH_CONFIG_NONE || sourceRow == ModelData::FUNC_SWITCH_CONFIG_2POS) return true;
|
if (sourceRow == Board::SWITCH_3POS)
|
||||||
|
return false;
|
||||||
|
if (sourceRow == Board::SWITCH_NOT_AVAILABLE || sourceRow == Board::SWITCH_2POS || sourceRow == Board::SWITCH_GLOBAL)
|
||||||
|
return true;
|
||||||
return !m_model->getFuncSwitchAlwaysOnGroupForSwitch(m_switch);
|
return !m_model->getFuncSwitchAlwaysOnGroupForSwitch(m_switch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,51 +74,122 @@ FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model
|
|||||||
|
|
||||||
fsGroupStart = ModelData::funcSwitchGroupStartSwitchModel(switchcnt);
|
fsGroupStart = ModelData::funcSwitchGroupStartSwitchModel(switchcnt);
|
||||||
|
|
||||||
for (int i = 0; i < switchcnt; i++) {
|
if (Boards::getCapability(board, Board::FunctionSwitchColors)) {
|
||||||
QLabel * lblSwitchId = new QLabel(this);
|
QLabel * lblOffColor = new QLabel(this);
|
||||||
lblSwitchId->setText(tr("SW%1").arg(i + 1));
|
lblOffColor->setText(tr("Off color"));
|
||||||
|
ui->gridSwitches->addWidget(lblOffColor, 5, 0);
|
||||||
AutoLineEdit * aleName = new AutoLineEdit(this);
|
QLabel * lblOffLua = new QLabel(this);
|
||||||
aleName->setProperty("index", i);
|
lblOffLua->setText(tr(" Allow Lua override"));
|
||||||
aleName->setValidator(new NameValidator(board, this));
|
ui->gridSwitches->addWidget(lblOffLua, 6, 0);
|
||||||
aleName->setField((char *)model.functionSwitchNames[i], 3);
|
QLabel * lblOnColor = new QLabel(this);
|
||||||
|
lblOnColor->setText(tr("On color"));
|
||||||
QComboBox * cboConfig = new QComboBox(this);
|
ui->gridSwitches->addWidget(lblOnColor, 7, 0);
|
||||||
cboConfig->setProperty("index", i);
|
QLabel * lblOnLua = new QLabel(this);
|
||||||
auto configFilter = new FilteredSwitchConfigsModel(fsConfig, i, &model);
|
lblOnLua->setText(tr(" Allow Lua override"));
|
||||||
cboConfig->setModel(configFilter);
|
ui->gridSwitches->addWidget(lblOnLua, 8, 0);
|
||||||
filterSwitchConfigs << configFilter;
|
|
||||||
|
|
||||||
QComboBox * cboStartPosn = new QComboBox(this);
|
|
||||||
cboStartPosn->setProperty("index", i);
|
|
||||||
cboStartPosn->setModel(fsStart);
|
|
||||||
|
|
||||||
QComboBox * cboGroup = new QComboBox(this);
|
|
||||||
cboGroup->setProperty("index", i);
|
|
||||||
auto groupFilter = new FilteredSwitchGroupsModel(fsGroups, i, &model);
|
|
||||||
cboGroup->setModel(groupFilter);
|
|
||||||
filterSwitchGroups << groupFilter;
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
int coloffset = 1;
|
|
||||||
ui->gridSwitches->addWidget(lblSwitchId, row++, i + coloffset);
|
|
||||||
ui->gridSwitches->addWidget(aleName, row++, i + coloffset);
|
|
||||||
ui->gridSwitches->addWidget(cboConfig, row++, i + coloffset);
|
|
||||||
ui->gridSwitches->addWidget(cboStartPosn, row++, i + coloffset);
|
|
||||||
ui->gridSwitches->addWidget(cboGroup, row++, i + coloffset);
|
|
||||||
|
|
||||||
connect(aleName, &AutoLineEdit::currentDataChanged, this, &FunctionSwitchesPanel::on_nameEditingFinished);
|
|
||||||
connect(cboConfig, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_configCurrentIndexChanged);
|
|
||||||
connect(cboStartPosn, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_startPosnCurrentIndexChanged);
|
|
||||||
connect(cboGroup, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_groupChanged);
|
|
||||||
|
|
||||||
aleNames << aleName;
|
|
||||||
cboConfigs << cboConfig;
|
|
||||||
cboStartupPosns << cboStartPosn;
|
|
||||||
cboGroups << cboGroup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i += 1) {
|
for (int sw = 0, col = 0; sw < Boards::getCapability(board, Board::Switches); sw++) {
|
||||||
|
int i = Boards::getCFSIndexForSwitch(sw);
|
||||||
|
if (i >= 0) {
|
||||||
|
QLabel * lblSwitchId = new QLabel(this);
|
||||||
|
lblSwitchId->setText(Boards::getSwitchName(sw));
|
||||||
|
|
||||||
|
AutoLineEdit * aleName = new AutoLineEdit(this);
|
||||||
|
aleName->setProperty("index", i);
|
||||||
|
aleName->setValidator(new NameValidator(board, this));
|
||||||
|
aleName->setField((char *)model.customSwitches[i].name, 3);
|
||||||
|
|
||||||
|
QComboBox * cboConfig = new QComboBox(this);
|
||||||
|
cboConfig->setProperty("index", i);
|
||||||
|
auto configFilter = new FilteredSwitchConfigsModel(fsConfig, i, &model);
|
||||||
|
cboConfig->setModel(configFilter);
|
||||||
|
filterSwitchConfigs << configFilter;
|
||||||
|
|
||||||
|
QComboBox * cboStartPosn = new QComboBox(this);
|
||||||
|
cboStartPosn->setProperty("index", i);
|
||||||
|
cboStartPosn->setModel(fsStart);
|
||||||
|
|
||||||
|
QComboBox * cboGroup = new QComboBox(this);
|
||||||
|
cboGroup->setProperty("index", i);
|
||||||
|
auto groupFilter = new FilteredSwitchGroupsModel(fsGroups, i, &model);
|
||||||
|
cboGroup->setModel(groupFilter);
|
||||||
|
filterSwitchGroups << groupFilter;
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
int coloffset = 1;
|
||||||
|
ui->gridSwitches->addWidget(lblSwitchId, row++, col + coloffset);
|
||||||
|
ui->gridSwitches->addWidget(aleName, row++, col + coloffset);
|
||||||
|
ui->gridSwitches->addWidget(cboConfig, row++, col + coloffset);
|
||||||
|
ui->gridSwitches->addWidget(cboStartPosn, row++, col + coloffset);
|
||||||
|
ui->gridSwitches->addWidget(cboGroup, row++, col + coloffset);
|
||||||
|
|
||||||
|
if (Boards::getCapability(board, Board::FunctionSwitchColors)) {
|
||||||
|
const QString qss = QString("border-style: outset; border-width: 2px; border-radius: 5px; border-color: darkgrey; padding: 2px; background-color: %1;");
|
||||||
|
QPushButton * btnOffColor = new QPushButton(tr(""));
|
||||||
|
QColor off = this->model->customSwitches[i].offColor.getQColor();
|
||||||
|
btnOffColor->setStyleSheet(QString(qss).arg(off.name()));
|
||||||
|
connect(btnOffColor, &QPushButton::clicked, [=]() {
|
||||||
|
QColorDialog *dlg = new QColorDialog();
|
||||||
|
QColor color = dlg->getColor(this->model->customSwitches[i].offColor.getQColor());
|
||||||
|
if (color.isValid()) {
|
||||||
|
this->model->customSwitches[i].offColor.setColor(color.red(), color.green(), color.blue());
|
||||||
|
btnOffColor->setStyleSheet(QString(qss).arg(color.name()));
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ui->gridSwitches->addWidget(btnOffColor, row++, col + coloffset);
|
||||||
|
btnOffColors << btnOffColor;
|
||||||
|
|
||||||
|
QCheckBox * cbOffLuaOverride = new QCheckBox(this);
|
||||||
|
cbOffLuaOverride->setChecked(this->model->customSwitches[i].offColorLuaOverride);
|
||||||
|
connect(cbOffLuaOverride, &QCheckBox::toggled, [=](int value) {
|
||||||
|
this->model->customSwitches[i].offColorLuaOverride = value;
|
||||||
|
emit modified();
|
||||||
|
});
|
||||||
|
ui->gridSwitches->addWidget(cbOffLuaOverride, row++, col + coloffset);
|
||||||
|
cbOffLuaOverrides << cbOffLuaOverride;
|
||||||
|
|
||||||
|
QPushButton * btnOnColor = new QPushButton(tr(""));
|
||||||
|
QColor on = this->model->customSwitches[i].onColor.getQColor();
|
||||||
|
btnOnColor->setStyleSheet(QString(qss).arg(on.name()));
|
||||||
|
connect(btnOnColor, &QPushButton::clicked, [=]() {
|
||||||
|
QColorDialog *dlg = new QColorDialog();
|
||||||
|
QColor color = dlg->getColor(this->model->customSwitches[i].onColor.getQColor());
|
||||||
|
if (color.isValid()) {
|
||||||
|
this->model->customSwitches[i].onColor.setColor(color.red(), color.green(), color.blue());
|
||||||
|
btnOnColor->setStyleSheet(QString(qss).arg(color.name()));
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ui->gridSwitches->addWidget(btnOnColor, row++, col + coloffset);
|
||||||
|
btnOnColors << btnOnColor;
|
||||||
|
|
||||||
|
QCheckBox * cbOnLuaOverride = new QCheckBox(this);
|
||||||
|
cbOnLuaOverride->setChecked(this->model->customSwitches[i].onColorLuaOverride);
|
||||||
|
connect(cbOnLuaOverride, &QCheckBox::toggled, [=](int value) {
|
||||||
|
this->model->customSwitches[i].onColorLuaOverride = value;
|
||||||
|
emit modified();
|
||||||
|
});
|
||||||
|
ui->gridSwitches->addWidget(cbOnLuaOverride, row++, col + coloffset);
|
||||||
|
cbOnLuaOverrides << cbOnLuaOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(aleName, &AutoLineEdit::currentDataChanged, this, &FunctionSwitchesPanel::on_nameEditingFinished);
|
||||||
|
connect(cboConfig, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_configCurrentIndexChanged);
|
||||||
|
connect(cboStartPosn, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_startPosnCurrentIndexChanged);
|
||||||
|
connect(cboGroup, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_groupChanged);
|
||||||
|
|
||||||
|
aleNames << aleName;
|
||||||
|
cboConfigs << cboConfig;
|
||||||
|
cboStartupPosns << cboStartPosn;
|
||||||
|
cboGroups << cboGroup;
|
||||||
|
|
||||||
|
col += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < Boards::getCapability(board, Board::FunctionSwitchGroups); i += 1) {
|
||||||
QLabel * lblGroupId = new QLabel(this);
|
QLabel * lblGroupId = new QLabel(this);
|
||||||
lblGroupId->setText(tr("Group %1").arg(i + 1));
|
lblGroupId->setText(tr("Group %1").arg(i + 1));
|
||||||
|
|
||||||
@@ -154,22 +229,37 @@ void FunctionSwitchesPanel::update()
|
|||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
for (int i = 0; i < switchcnt; i++) {
|
Board::Type board = firmware->getBoard();
|
||||||
filterSwitchConfigs[i]->invalidate();
|
|
||||||
filterSwitchGroups[i]->invalidate();
|
|
||||||
|
|
||||||
aleNames[i]->update();
|
for (int sw = 0, col = 0; sw < Boards::getCapability(firmware->getBoard(), Board::Switches); sw++) {
|
||||||
cboConfigs[i]->setCurrentIndex(filterSwitchConfigs[i]->mapFromSource(fsConfig->index(model->getFuncSwitchConfig(i), 0)).row());
|
int i = Boards::getCFSIndexForSwitch(sw);
|
||||||
cboStartupPosns[i]->setCurrentIndex(model->getFuncSwitchStart(i));
|
if (i >= 0) {
|
||||||
unsigned int grp = model->getFuncSwitchGroup(i);
|
filterSwitchConfigs[col]->invalidate();
|
||||||
cboGroups[i]->setCurrentIndex(grp);
|
filterSwitchGroups[col]->invalidate();
|
||||||
|
|
||||||
cboStartupPosns[i]->setEnabled(cboConfigs[i]->currentIndex() >= ModelData::FUNC_SWITCH_CONFIG_2POS && (grp == 0));
|
unsigned int cfg = model->getFuncSwitchConfig(i);
|
||||||
|
unsigned int grp = model->getFuncSwitchGroup(i);
|
||||||
|
|
||||||
cboGroups[i]->setEnabled(cboConfigs[i]->currentIndex() >= ModelData::FUNC_SWITCH_CONFIG_TOGGLE);
|
aleNames[col]->update();
|
||||||
|
cboConfigs[col]->setCurrentIndex(filterSwitchConfigs[col]->mapFromSource(fsConfig->index(cfg, 0)).row());
|
||||||
|
cboStartupPosns[col]->setCurrentIndex(model->getFuncSwitchStart(i));
|
||||||
|
cboGroups[col]->setCurrentIndex(grp);
|
||||||
|
|
||||||
|
cboStartupPosns[col]->setEnabled(cfg == Board::SWITCH_2POS && (grp == 0));
|
||||||
|
cboGroups[col]->setEnabled(cfg >= Board::SWITCH_TOGGLE && cfg < Board::SWITCH_GLOBAL);
|
||||||
|
|
||||||
|
if (Boards::getCapability(board, Board::FunctionSwitchColors)) {
|
||||||
|
btnOffColors[col]->setEnabled(cfg != Board::SWITCH_NOT_AVAILABLE && cfg != Board::SWITCH_GLOBAL);
|
||||||
|
cbOffLuaOverrides[col]->setEnabled(cfg != Board::SWITCH_NOT_AVAILABLE && cfg != Board::SWITCH_GLOBAL);
|
||||||
|
btnOnColors[col]->setEnabled(cfg != Board::SWITCH_NOT_AVAILABLE && cfg != Board::SWITCH_GLOBAL);
|
||||||
|
cbOnLuaOverrides[col]->setEnabled(cfg != Board::SWITCH_NOT_AVAILABLE && cfg != Board::SWITCH_GLOBAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
col += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i += 1) {
|
for (int i = 0; i < Boards::getCapability(board, Board::FunctionSwitchGroups); i += 1) {
|
||||||
filterGroupSwitches[i]->invalidate();
|
filterGroupSwitches[i]->invalidate();
|
||||||
|
|
||||||
model->setGroupSwitchState(i + 1, switchcnt);
|
model->setGroupSwitchState(i + 1, switchcnt);
|
||||||
@@ -200,10 +290,10 @@ void FunctionSwitchesPanel::on_configCurrentIndexChanged(int index)
|
|||||||
unsigned int sw = sender()->property("index").toInt(&ok);
|
unsigned int sw = sender()->property("index").toInt(&ok);
|
||||||
unsigned int config = filterSwitchConfigs[sw]->mapToSource(filterSwitchConfigs[sw]->index(index, 0)).row();
|
unsigned int config = filterSwitchConfigs[sw]->mapToSource(filterSwitchConfigs[sw]->index(index, 0)).row();
|
||||||
if (ok && model->getFuncSwitchConfig(sw) != config) {
|
if (ok && model->getFuncSwitchConfig(sw) != config) {
|
||||||
model->setFuncSwitchConfig(sw, config);
|
model->setFuncSwitchConfig(sw, (Board::SwitchType)config);
|
||||||
if (config != ModelData::FUNC_SWITCH_CONFIG_2POS) {
|
if (config != Board::SWITCH_2POS && config != Board::SWITCH_GLOBAL) {
|
||||||
model->setFuncSwitchStart(sw, ModelData::FUNC_SWITCH_START_PREVIOUS);
|
model->setFuncSwitchStart(sw, ModelData::FUNC_SWITCH_START_PREVIOUS);
|
||||||
if ((config == ModelData::FUNC_SWITCH_CONFIG_NONE) || model->getFuncSwitchAlwaysOnGroupForSwitch(sw))
|
if ((config == Board::SWITCH_NOT_AVAILABLE) || model->getFuncSwitchAlwaysOnGroupForSwitch(sw))
|
||||||
model->setFuncSwitchGroup(sw, 0);
|
model->setFuncSwitchGroup(sw, 0);
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
@@ -270,8 +360,8 @@ void FunctionSwitchesPanel::on_groupChanged(int value)
|
|||||||
if (ok && model->getFuncSwitchGroup(sw) != grp) {
|
if (ok && model->getFuncSwitchGroup(sw) != grp) {
|
||||||
unsigned oldGrp = model->getFuncSwitchGroup(sw);
|
unsigned oldGrp = model->getFuncSwitchGroup(sw);
|
||||||
if (model->getFuncSwitchAlwaysOnGroup(grp)) {
|
if (model->getFuncSwitchAlwaysOnGroup(grp)) {
|
||||||
if (model->getFuncSwitchConfig(sw) == ModelData::FUNC_SWITCH_CONFIG_TOGGLE)
|
if (model->getFuncSwitchConfig(sw) == Board::SWITCH_TOGGLE)
|
||||||
model->setFuncSwitchConfig(sw, ModelData::FUNC_SWITCH_CONFIG_2POS);
|
model->setFuncSwitchConfig(sw, Board::SWITCH_2POS);
|
||||||
}
|
}
|
||||||
if ((grp == 0) || (model->getFuncGroupSwitchStart(grp, switchcnt) == 0))
|
if ((grp == 0) || (model->getFuncGroupSwitchStart(grp, switchcnt) == 0))
|
||||||
model->setFuncSwitchStart(sw, ModelData::FUNC_SWITCH_START_PREVIOUS);
|
model->setFuncSwitchStart(sw, ModelData::FUNC_SWITCH_START_PREVIOUS);
|
||||||
@@ -304,8 +394,8 @@ void FunctionSwitchesPanel::on_alwaysOnGroupChanged(int value)
|
|||||||
model->setFuncSwitchAlwaysOnGroup(grp, (unsigned int)value);
|
model->setFuncSwitchAlwaysOnGroup(grp, (unsigned int)value);
|
||||||
if (value) {
|
if (value) {
|
||||||
for (int i = 0; i < switchcnt; i += 1) {
|
for (int i = 0; i < switchcnt; i += 1) {
|
||||||
if (((int)model->getFuncSwitchGroup(i) == grp) && (model->getFuncSwitchConfig(i) == ModelData::FUNC_SWITCH_CONFIG_TOGGLE))
|
if (((int)model->getFuncSwitchGroup(i) == grp) && (model->getFuncSwitchConfig(i) == Board::SWITCH_TOGGLE))
|
||||||
model->setFuncSwitchConfig(i, ModelData::FUNC_SWITCH_CONFIG_2POS);
|
model->setFuncSwitchConfig(i, Board::SWITCH_2POS);
|
||||||
}
|
}
|
||||||
if ((int)model->getFuncGroupSwitchStart(grp, switchcnt) == switchcnt + 1) {
|
if ((int)model->getFuncGroupSwitchStart(grp, switchcnt) == switchcnt + 1) {
|
||||||
for (int i = 0; i < switchcnt; i += 1) {
|
for (int i = 0; i < switchcnt; i += 1) {
|
||||||
|
|||||||
@@ -157,6 +157,10 @@ class FunctionSwitchesPanel : public ModelPanel
|
|||||||
QVector<QComboBox *> cboGroups;
|
QVector<QComboBox *> cboGroups;
|
||||||
QVector<QCheckBox *> cbAlwaysOnGroups;
|
QVector<QCheckBox *> cbAlwaysOnGroups;
|
||||||
QVector<QComboBox *> cboGroupStartupPosns;
|
QVector<QComboBox *> cboGroupStartupPosns;
|
||||||
|
QVector<QPushButton *> btnOffColors;
|
||||||
|
QVector<QCheckBox *> cbOffLuaOverrides;
|
||||||
|
QVector<QPushButton *> btnOnColors;
|
||||||
|
QVector<QCheckBox *> cbOnLuaOverrides;
|
||||||
QVector<FilteredGroupSwitchesModel *> filterGroupSwitches;
|
QVector<FilteredGroupSwitchesModel *> filterGroupSwitches;
|
||||||
QVector<FilteredSwitchGroupsModel *> filterSwitchGroups;
|
QVector<FilteredSwitchGroupsModel *> filterSwitchGroups;
|
||||||
QVector<FilteredSwitchConfigsModel *> filterSwitchConfigs;
|
QVector<FilteredSwitchConfigsModel *> filterSwitchConfigs;
|
||||||
|
|||||||
@@ -765,20 +765,13 @@ QString ModelPrinter::printSwitchWarnings()
|
|||||||
uint64_t value;
|
uint64_t value;
|
||||||
|
|
||||||
for (int i = 0; i < Boards::getCapability(board, Board::Switches); i++) {
|
for (int i = 0; i < Boards::getCapability(board, Board::Switches); i++) {
|
||||||
Board::SwitchInfo switchInfo = Boards::getSwitchInfo(i);
|
Board::SwitchType type = model.getSwitchType(i, generalSettings);
|
||||||
if (switchInfo.type == Board::SWITCH_NOT_AVAILABLE || switchInfo.type == Board::SWITCH_TOGGLE) {
|
if (type != Board::SWITCH_2POS && type != Board::SWITCH_3POS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(model.switchWarningEnable & (1 << i))) {
|
value = (switchStates >> (2 * i)) & 0x03;
|
||||||
if (IS_HORUS_OR_TARANIS(board)) {
|
if (value > 0)
|
||||||
value = (switchStates >> (2 * i)) & 0x03;
|
str += RawSwitch(SWITCH_TYPE_SWITCH, i * 3 + value).toString(board, &generalSettings, &model);
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = (i == 0 ? switchStates & 0x3 : switchStates & 0x1);
|
|
||||||
switchStates >>= (i == 0 ? 2 : 1);
|
|
||||||
}
|
|
||||||
str += RawSwitch(SWITCH_TYPE_SWITCH, 1 + i * 3 + value).toString(board, &generalSettings, &model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (str.isEmpty() ? tr("None") : str.join(" ")) ;
|
return (str.isEmpty() ? tr("None") : str.join(" ")) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -975,7 +975,7 @@ QString MultiModelPrinter::printFunctionSwitches()
|
|||||||
columns.appendRowStart(tr("Name"), 20);
|
columns.appendRowStart(tr("Name"), 20);
|
||||||
|
|
||||||
for (int i = 0; i < numFS; i++) {
|
for (int i = 0; i < numFS; i++) {
|
||||||
COMPARECELLWIDTH(model->functionSwitchNames[i], colwidth);
|
COMPARECELLWIDTH(model->customSwitches[i].name, colwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
columns.appendRowEnd();
|
columns.appendRowEnd();
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ class SimulatorInterface : public QObject
|
|||||||
void auxSerialStart(const quint8 port_num);
|
void auxSerialStart(const quint8 port_num);
|
||||||
void auxSerialStop(const quint8 port_num);
|
void auxSerialStop(const quint8 port_num);
|
||||||
void txBatteryVoltageChanged(const int voltage);
|
void txBatteryVoltageChanged(const int voltage);
|
||||||
|
void fsColorChange(quint8 index, qint32 color);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SimulatorFactory {
|
class SimulatorFactory {
|
||||||
|
|||||||
@@ -519,6 +519,9 @@ void SimulatorWidget::setupRadioWidgets()
|
|||||||
case RadioWidget::RADIO_WIDGET_KNOB :
|
case RadioWidget::RADIO_WIDGET_KNOB :
|
||||||
ui->radioWidgetsHTLayout->removeWidget(rw);
|
ui->radioWidgetsHTLayout->removeWidget(rw);
|
||||||
break;
|
break;
|
||||||
|
case RadioWidget::RADIO_WIDGET_FUNC_SWITCH:
|
||||||
|
ui->radioWidgetsCSLayout->removeWidget(rw);
|
||||||
|
break;
|
||||||
case RadioWidget::RADIO_WIDGET_FADER :
|
case RadioWidget::RADIO_WIDGET_FADER :
|
||||||
case RadioWidget::RADIO_WIDGET_TRIM :
|
case RadioWidget::RADIO_WIDGET_TRIM :
|
||||||
ui->VCGridLayout->removeWidget(rw);
|
ui->VCGridLayout->removeWidget(rw);
|
||||||
@@ -534,22 +537,36 @@ void SimulatorWidget::setupRadioWidgets()
|
|||||||
|
|
||||||
// Now set up new widgets.
|
// Now set up new widgets.
|
||||||
|
|
||||||
// switches
|
if (!Boards::getCapability(m_board, Board::FunctionSwitches)) {
|
||||||
Board::SwitchType swcfg;
|
ui->radioWidgetsCS->hide();
|
||||||
for (i = 0; i < ttlSwitches; ++i) {
|
|
||||||
if (!radioSettings.isSwitchAvailable(i) || Boards::isSwitchFunc(i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
swcfg = Board::SwitchType(radioSettings.switchConfig[i].type);
|
|
||||||
wname = RawSource(RawSourceType::SOURCE_TYPE_SWITCH, i + 1).toString(nullptr, &radioSettings, Board::BOARD_UNKNOWN, false);
|
|
||||||
RadioSwitchWidget * sw = new RadioSwitchWidget(swcfg, wname, -1, ui->radioWidgetsHT);
|
|
||||||
sw->setIndex(i);
|
|
||||||
ui->radioWidgetsHTLayout->addWidget(sw);
|
|
||||||
|
|
||||||
m_radioWidgets.append(sw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
midpos = (int)floorf(m_radioWidgets.size() / 2.0f);
|
// switches
|
||||||
|
int swCnt = 0;
|
||||||
|
for (i = 0; i < ttlSwitches; ++i) {
|
||||||
|
if (radioSettings.isSwitchAvailable(i)) {
|
||||||
|
wname = RawSource(RawSourceType::SOURCE_TYPE_SWITCH, i + 1).toString(nullptr, &radioSettings, Board::BOARD_UNKNOWN, false);
|
||||||
|
RadioWidget * sw;
|
||||||
|
Board::SwitchType swcfg;
|
||||||
|
|
||||||
|
if (Boards::isSwitchFunc(i)) {
|
||||||
|
swcfg = Board::SWITCH_2POS; // TODO: get this from model settings
|
||||||
|
sw = new RadioFuncSwitchWidget(simulator, swcfg, wname, -1, ui->radioWidgetsCS);
|
||||||
|
ui->radioWidgetsCSLayout->addWidget(sw);
|
||||||
|
} else {
|
||||||
|
swcfg = Board::SwitchType(radioSettings.switchConfig[i].type);
|
||||||
|
sw = new RadioSwitchWidget(swcfg, wname, -1, ui->radioWidgetsHT);
|
||||||
|
ui->radioWidgetsHTLayout->addWidget(sw);
|
||||||
|
swCnt += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sw->setIndex(i);
|
||||||
|
|
||||||
|
m_radioWidgets.append(sw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
midpos = (int)floorf(swCnt / 2.0f);
|
||||||
|
|
||||||
// pots in middle of switches
|
// pots in middle of switches
|
||||||
for (i = 0; i < ttlInputs; ++i) {
|
for (i = 0; i < ttlInputs; ++i) {
|
||||||
@@ -746,7 +763,7 @@ void SimulatorWidget::onPhaseChanged(qint32 phase, const QString & name)
|
|||||||
|
|
||||||
void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetType type, int index, int value)
|
void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetType type, int index, int value)
|
||||||
{
|
{
|
||||||
//qDebug() << type << index << value;
|
// qDebug() << type << index << value;
|
||||||
if (!simulator || index < 0)
|
if (!simulator || index < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -765,6 +782,10 @@ void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetTyp
|
|||||||
inpType = SimulatorInterface::INPUT_SRC_SWITCH;
|
inpType = SimulatorInterface::INPUT_SRC_SWITCH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RadioWidget::RADIO_WIDGET_FUNC_SWITCH:
|
||||||
|
inpType = SimulatorInterface::INPUT_SRC_SWITCH;
|
||||||
|
break;
|
||||||
|
|
||||||
case RadioWidget::RADIO_WIDGET_KNOB :
|
case RadioWidget::RADIO_WIDGET_KNOB :
|
||||||
inpType = SimulatorInterface::INPUT_SRC_KNOB;
|
inpType = SimulatorInterface::INPUT_SRC_KNOB;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -114,7 +114,43 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2" alignment="Qt::AlignBottom">
|
||||||
|
<widget class="QFrame" name="radioWidgetsCS">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::Panel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<property name="midLineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="radioWidgetsCSLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QFrame" name="controlsLower">
|
<widget class="QFrame" name="controlsLower">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
|||||||
@@ -24,8 +24,10 @@
|
|||||||
#include "radiowidget.h"
|
#include "radiowidget.h"
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "simulator.h"
|
#include "simulator.h"
|
||||||
|
#include "simulatorinterface.h"
|
||||||
|
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
@@ -143,5 +145,62 @@ class RadioSwitchWidget : public RadioWidget
|
|||||||
|
|
||||||
QSlider * m_slider;
|
QSlider * m_slider;
|
||||||
quint16 m_stepSize;
|
quint16 m_stepSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RadioFuncSwitchWidget : public RadioWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit RadioFuncSwitchWidget(SimulatorInterface *simulator, Board::SwitchType type, const QString & labelText, int value, QWidget * parent, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||||
|
RadioWidget(labelText, value, parent, f)
|
||||||
|
{
|
||||||
|
init(simulator, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(SimulatorInterface *simulator, Board::SwitchType swType)
|
||||||
|
{
|
||||||
|
m_type = RADIO_WIDGET_FUNC_SWITCH;
|
||||||
|
|
||||||
|
m_button = new QPushButton("");
|
||||||
|
m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||||
|
m_button->setFixedWidth(30);
|
||||||
|
|
||||||
|
setWidget(m_button);
|
||||||
|
|
||||||
|
// TODO: connect custom function switches to model data?
|
||||||
|
|
||||||
|
connect(m_button, &QPushButton::pressed, this, &RadioFuncSwitchWidget::onPressed);
|
||||||
|
connect(m_button, &QPushButton::released, this, &RadioFuncSwitchWidget::onReleased);
|
||||||
|
connect(this, &RadioWidget::valueChanged, m_button, [=](int value) {
|
||||||
|
m_value = value;
|
||||||
|
});
|
||||||
|
connect(simulator, &SimulatorInterface::fsColorChange, this, &RadioFuncSwitchWidget::onFsColorChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onPressed()
|
||||||
|
{
|
||||||
|
setValue(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onReleased()
|
||||||
|
{
|
||||||
|
setValue(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onFsColorChange(quint8 index, qint32 color)
|
||||||
|
{
|
||||||
|
if (index == m_index && color != lastColor) {
|
||||||
|
lastColor = color;
|
||||||
|
QColor c = QColor((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF);
|
||||||
|
QString qss = QString("background-color: %1; border: none;").arg(c.name());
|
||||||
|
m_button->setStyleSheet(qss);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPushButton * m_button;
|
||||||
|
qint32 lastColor = -1;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class RadioWidget : public QWidget
|
|||||||
RADIO_WIDGET_TRIM, // trim axis, usually 2 buttons & slider
|
RADIO_WIDGET_TRIM, // trim axis, usually 2 buttons & slider
|
||||||
RADIO_WIDGET_STICK, // actually one axis of a stick
|
RADIO_WIDGET_STICK, // actually one axis of a stick
|
||||||
RADIO_WIDGET_KEY, // UI key/pushbutton
|
RADIO_WIDGET_KEY, // UI key/pushbutton
|
||||||
|
RADIO_WIDGET_FUNC_SWITCH,
|
||||||
RADIO_WIDGET_ENUM_COUNT
|
RADIO_WIDGET_ENUM_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
class OpenTxTest : public testing::Test
|
class EdgeTxTest : public testing::Test
|
||||||
{
|
{
|
||||||
protected: // You should make the members protected s.t. they can be
|
protected: // You should make the members protected s.t. they can be
|
||||||
// accessed from sub-classes.
|
// accessed from sub-classes.
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ WizMix::operator ModelData()
|
|||||||
model.used = true;
|
model.used = true;
|
||||||
model.moduleData[0].modelId = modelId;
|
model.moduleData[0].modelId = modelId;
|
||||||
model.setDefaultInputs(settings);
|
model.setDefaultInputs(settings);
|
||||||
|
model.setDefaultFunctionSwitches(Boards::getCapability(getCurrentFirmware()->getBoard(), Board::FunctionSwitches));
|
||||||
|
|
||||||
int mixIndex = 0;
|
int mixIndex = 0;
|
||||||
int timerIndex = 0;
|
int timerIndex = 0;
|
||||||
|
|||||||
@@ -411,6 +411,7 @@ endif()
|
|||||||
set(SRC
|
set(SRC
|
||||||
${SRC}
|
${SRC}
|
||||||
edgetx.cpp
|
edgetx.cpp
|
||||||
|
datastructs_private.cpp
|
||||||
functions.cpp
|
functions.cpp
|
||||||
strhelpers.cpp
|
strhelpers.cpp
|
||||||
switches.cpp
|
switches.cpp
|
||||||
|
|||||||
@@ -40,13 +40,7 @@ static timer_handle_t _refresh_timer = TIMER_INITIALIZER;
|
|||||||
|
|
||||||
void rgbSetLedColor(uint8_t led, uint8_t r, uint8_t g, uint8_t b)
|
void rgbSetLedColor(uint8_t led, uint8_t r, uint8_t g, uint8_t b)
|
||||||
{
|
{
|
||||||
#if defined(SIXPOS_SWITCH_INDEX)
|
|
||||||
ws2812_set_color(led + 6, r, g, b);
|
|
||||||
#elif defined(RGB_LED_OFFSET)
|
|
||||||
ws2812_set_color(led + RGB_LED_OFFSET, r, g, b);
|
|
||||||
#else
|
|
||||||
ws2812_set_color(led, r, g, b);
|
ws2812_set_color(led, r, g, b);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t rgbGetLedColor(uint8_t led)
|
uint32_t rgbGetLedColor(uint8_t led)
|
||||||
|
|||||||
@@ -20,10 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hal/switch_driver.h"
|
#include "hal/switch_driver.h"
|
||||||
#include "bsp_io.h"
|
|
||||||
#include "stm32_switch_driver.h"
|
#include "stm32_switch_driver.h"
|
||||||
#include "stm32_gpio_driver.h"
|
#include "stm32_gpio_driver.h"
|
||||||
|
|
||||||
|
#include "drivers/pca95xx.h"
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "myeeprom.h"
|
#include "myeeprom.h"
|
||||||
|
|
||||||
@@ -37,30 +38,33 @@ __weak void boardInitSwitches()
|
|||||||
_init_switches();
|
_init_switches();
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak SwitchHwPos boardSwitchGetPosition(SwitchCategory cat, uint8_t idx)
|
__weak SwitchHwPos boardSwitchGetPosition(uint8_t idx)
|
||||||
{
|
{
|
||||||
const stm32_switch_t* sw = &_switch_offsets[cat][idx];
|
const stm32_switch_t* sw = &_switch_defs[idx];
|
||||||
if(sw->type != SWITCH_HW_ADC && sw->GPIOx_high == nullptr)
|
|
||||||
return bsp_get_switch_position(sw, cat, idx);
|
|
||||||
|
|
||||||
return stm32_switch_get_position(sw);
|
return stm32_switch_get_position(sw);
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak const char* boardSwitchGetName(SwitchCategory cat, uint8_t idx)
|
__weak const char* boardSwitchGetName(uint8_t idx)
|
||||||
{
|
{
|
||||||
return _switch_offsets[cat][idx].name;
|
return _switch_defs[idx].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak SwitchHwType boardSwitchGetType(SwitchCategory cat, uint8_t idx)
|
__weak SwitchHwType boardSwitchGetType(uint8_t idx)
|
||||||
{
|
{
|
||||||
return _switch_offsets[cat][idx].type;
|
return _switch_defs[idx].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const stm32_switch_t* boardGetSwitchDef(uint8_t idx) { return &_switch_defs[idx]; }
|
||||||
|
|
||||||
uint8_t boardGetMaxSwitches() { return n_switches; }
|
uint8_t boardGetMaxSwitches() { return n_switches; }
|
||||||
uint8_t boardGetMaxFctSwitches() { return n_fct_switches; }
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
bool boardIsCustomSwitch(uint8_t idx) { return _switch_defs[idx].isCustomSwitch; }
|
||||||
|
uint8_t boardGetCustomSwitchIdx(uint8_t idx) { return _switch_defs[idx].customSwitchIdx; }
|
||||||
|
#endif
|
||||||
|
|
||||||
swconfig_t boardSwitchGetDefaultConfig() { return _switch_default_config; }
|
SwitchConfig boardSwitchGetDefaultConfig(uint8_t idx) { return _switch_defs[idx].defaultType; }
|
||||||
|
|
||||||
|
#if !defined(COLORLCD)
|
||||||
switch_display_pos_t switchGetDisplayPosition(uint8_t idx)
|
switch_display_pos_t switchGetDisplayPosition(uint8_t idx)
|
||||||
{
|
{
|
||||||
// TODO: find a solution for FLEX switches so they can be displayed on main view
|
// TODO: find a solution for FLEX switches so they can be displayed on main view
|
||||||
@@ -68,3 +72,4 @@ switch_display_pos_t switchGetDisplayPosition(uint8_t idx)
|
|||||||
|
|
||||||
return _switch_display[idx];
|
return _switch_display[idx];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
+2
-2
@@ -1452,11 +1452,11 @@ int cliDisplay(const char ** argv)
|
|||||||
cliSerialPrint("[Trim %s] = %s", getTrimLabel(i),
|
cliSerialPrint("[Trim %s] = %s", getTrimLabel(i),
|
||||||
keysGetTrimState(i) ? "on" : "off");
|
keysGetTrimState(i) ? "on" : "off");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
static const char * const SWITCH_POSITIONS[] = { "up", "mid", "down" };
|
static const char * const SWITCH_POSITIONS[] = { "up", "mid", "down" };
|
||||||
auto pos = switchGetPosition(i);
|
auto pos = switchGetPosition(i);
|
||||||
cliSerialPrint("[%s] = %s", switchGetName(i), SWITCH_POSITIONS[pos]);
|
cliSerialPrint("[%s] = %s", switchGetDefaultName(i), SWITCH_POSITIONS[pos]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ enum MixSources {
|
|||||||
#define INPUTSRC_LAST MIXSRC_LAST_TELEM
|
#define INPUTSRC_LAST MIXSRC_LAST_TELEM
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
#define MIXSRC_LAST_REGULAR_SWITCH (MIXSRC_FIRST_SWITCH + switchGetMaxSwitches() - 1)
|
#define MIXSRC_LAST_REGULAR_SWITCH (MIXSRC_FIRST_SWITCH + switchGetMaxAllSwitches() - 1)
|
||||||
#define MIXSRC_FIRST_FS_SWITCH (MIXSRC_LAST_REGULAR_SWITCH + 1)
|
#define MIXSRC_FIRST_FS_SWITCH (MIXSRC_LAST_REGULAR_SWITCH + 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+14
-8
@@ -83,21 +83,27 @@ static inline void check_struct()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBXLITES)
|
#if defined(PCBXLITES)
|
||||||
CHKSIZE(RadioData, 873);
|
CHKSIZE(RadioData, 945);
|
||||||
|
#elif defined(RADIO_ST16)
|
||||||
|
CHKSIZE(RadioData, 1159);
|
||||||
#elif defined(COLORLCD)
|
#elif defined(COLORLCD)
|
||||||
CHKSIZE(RadioData, 967);
|
CHKSIZE(RadioData, 1039);
|
||||||
|
#elif defined(RADIO_GX12)
|
||||||
|
CHKSIZE(RadioData, 1063);
|
||||||
|
#elif defined(RADIO_GX12)
|
||||||
|
CHKSIZE(RadioData, 1062);
|
||||||
#else
|
#else
|
||||||
CHKSIZE(RadioData, 871);
|
CHKSIZE(RadioData, 943);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RADIO_TPRO) || defined(RADIO_TPROV2) || defined(RADIO_BUMBLEBEE)
|
#if defined(RADIO_TPRO) || defined(RADIO_TPROV2) || defined(RADIO_BUMBLEBEE)
|
||||||
CHKSIZE(ModelData, 6354);
|
CHKSIZE(ModelData, 6355);
|
||||||
#elif defined(RADIO_T14) || defined(RADIO_T12MAX)
|
#elif defined(RADIO_T14) || defined(RADIO_T12MAX)
|
||||||
CHKSIZE(ModelData, 6329);
|
CHKSIZE(ModelData, 6329);
|
||||||
#elif defined(RADIO_FAMILY_T20)
|
#elif defined(RADIO_FAMILY_T20)
|
||||||
CHKSIZE(ModelData, 6390);
|
CHKSIZE(ModelData, 6391);
|
||||||
#elif defined(RADIO_GX12)
|
#elif defined(RADIO_GX12)
|
||||||
CHKSIZE(ModelData, 6390);
|
CHKSIZE(ModelData, 6419);
|
||||||
#elif defined(PCBX9E)
|
#elif defined(PCBX9E)
|
||||||
CHKSIZE(ModelData, 6771);
|
CHKSIZE(ModelData, 6771);
|
||||||
#elif defined(PCBX9D) || defined(PCBX9DP)
|
#elif defined(PCBX9D) || defined(PCBX9DP)
|
||||||
@@ -113,9 +119,9 @@ static inline void check_struct()
|
|||||||
#elif defined(PCBNV14)
|
#elif defined(PCBNV14)
|
||||||
CHKSIZE(ModelData, 27295);
|
CHKSIZE(ModelData, 27295);
|
||||||
#elif defined(PCBST16)
|
#elif defined(PCBST16)
|
||||||
CHKSIZE(ModelData, 27754);
|
CHKSIZE(ModelData, 27761);
|
||||||
#elif defined(RADIO_T15)
|
#elif defined(RADIO_T15)
|
||||||
CHKSIZE(ModelData, 27682);
|
CHKSIZE(ModelData, 27683);
|
||||||
#elif defined(PCBHORUS)
|
#elif defined(PCBHORUS)
|
||||||
CHKSIZE(ModelData, 27657);
|
CHKSIZE(ModelData, 27657);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -0,0 +1,254 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) EdgeTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* opentx - https://github.com/opentx/opentx
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "edgetx.h"
|
||||||
|
#include "hal/switch_driver.h"
|
||||||
|
|
||||||
|
SwitchConfig ModelData::getSwitchType(uint8_t n)
|
||||||
|
{
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return cfsType(n);
|
||||||
|
#endif
|
||||||
|
return g_eeGeneral.switchType(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::setSwitchType(uint8_t n, SwitchConfig v) {
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
cfsSetType(n,v);
|
||||||
|
#endif
|
||||||
|
g_eeGeneral.switchSetType(n, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* ModelData::getSwitchCustomName(uint8_t n)
|
||||||
|
{
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return g_model.cfsName(n);
|
||||||
|
#endif
|
||||||
|
return g_eeGeneral.getSwitchCustomName(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelData::switchHasCustomName(uint8_t n)
|
||||||
|
{
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return g_model.cfsName(n)[0] != 0;
|
||||||
|
#endif
|
||||||
|
return g_eeGeneral.switchHasCustomName(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ModelData::getSwitchStateForWarning(uint8_t n)
|
||||||
|
{
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
if (switchIsCustomSwitch(n)) {
|
||||||
|
return cfsState(n) ? 3 : 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
extern swarnstate_t switches_states;
|
||||||
|
return (switches_states >> (n * 2)) & 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* RadioData::getSwitchCustomName(uint8_t n)
|
||||||
|
{
|
||||||
|
return switchConfig[n].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadioData::switchHasCustomName(uint8_t n)
|
||||||
|
{
|
||||||
|
return switchConfig[n].name[0] != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SwitchConfig RadioData::switchType(uint8_t n) {
|
||||||
|
return (SwitchConfig)switchConfig[n].type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioData::switchSetType(uint8_t n, SwitchConfig v) {
|
||||||
|
switchConfig[n].type = v;
|
||||||
|
storageDirty(EE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* RadioData::switchName(uint8_t n) {
|
||||||
|
return switchConfig[n].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
uint8_t ModelData::getSwitchGroup(uint8_t n) {
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return cfsGroup(n);
|
||||||
|
return g_eeGeneral.switchGroup(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
fsStartPositionType ModelData::getSwitchStart(uint8_t n) {
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return cfsStart(n);
|
||||||
|
return g_eeGeneral.switchStart(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::setSwitchStart(uint8_t n, fsStartPositionType v) {
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
cfsSetStart(n, v);
|
||||||
|
g_eeGeneral.switchSetStart(n, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
SwitchConfig ModelData::cfsType(uint8_t n) {
|
||||||
|
return (SwitchConfig)customSwitches[switchGetCustomSwitchIdx(n)].type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsSetType(uint8_t n, SwitchConfig v) {
|
||||||
|
customSwitches[switchGetCustomSwitchIdx(n)].type = v;
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* ModelData::cfsName(uint8_t n) {
|
||||||
|
return customSwitches[switchGetCustomSwitchIdx(n)].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ModelData::cfsGroup(uint8_t n) {
|
||||||
|
return customSwitches[switchGetCustomSwitchIdx(n)].group;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsSetGroup(uint8_t n, uint8_t v) {
|
||||||
|
customSwitches[switchGetCustomSwitchIdx(n)].group = v;
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
fsStartPositionType ModelData::cfsStart(uint8_t n) {
|
||||||
|
return (fsStartPositionType)customSwitches[switchGetCustomSwitchIdx(n)].start;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsSetStart(uint8_t n, fsStartPositionType v) {
|
||||||
|
customSwitches[switchGetCustomSwitchIdx(n)].start = v;
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelData::cfsState(uint8_t n) {
|
||||||
|
return customSwitches[switchGetCustomSwitchIdx(n)].state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsSetState(uint8_t n, bool v) {
|
||||||
|
customSwitches[switchGetCustomSwitchIdx(n)].state = v;
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelData::cfsSFState(uint8_t n) {
|
||||||
|
return bfGet<uint8_t>(sfPushState, switchGetCustomSwitchIdx(n), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsSetSFState(uint8_t n, bool v) {
|
||||||
|
// Note: n = cfs index, not switch index
|
||||||
|
sfPushState = bfSet<uint8_t>(sfPushState, v, n, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsResetSFState() {
|
||||||
|
sfPushState = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
RGBLedColor& ModelData::getSwitchOnColor(uint8_t n) {
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return cfsOnColor(n);
|
||||||
|
return g_eeGeneral.switchOnColor(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
RGBLedColor& ModelData::getSwitchOffColor(uint8_t n) {
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return cfsOffColor(n);
|
||||||
|
return g_eeGeneral.switchOffColor(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelData::getSwitchOnColorLuaOverride(uint8_t n) {
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return cfsOnColorLuaOverride(n);
|
||||||
|
return g_eeGeneral.cfsOnColorLuaOverride(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelData::getSwitchOffColorLuaOverride(uint8_t n) {
|
||||||
|
if (switchIsCustomSwitch(n) && cfsType(n) != SWITCH_GLOBAL)
|
||||||
|
return cfsOffColorLuaOverride(n);
|
||||||
|
return g_eeGeneral.cfsOffColorLuaOverride(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
RGBLedColor& ModelData::cfsOnColor(uint8_t n) {
|
||||||
|
return customSwitches[switchGetCustomSwitchIdx(n)].onColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
RGBLedColor& ModelData::cfsOffColor(uint8_t n) {
|
||||||
|
return customSwitches[switchGetCustomSwitchIdx(n)].offColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelData::cfsOnColorLuaOverride(uint8_t n) {
|
||||||
|
return customSwitches[switchGetCustomSwitchIdx(n)].onColorLuaOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModelData::cfsOffColorLuaOverride(uint8_t n) {
|
||||||
|
return customSwitches[switchGetCustomSwitchIdx(n)].offColorLuaOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsSetOnColorLuaOverride(uint8_t n, bool v) {
|
||||||
|
customSwitches[switchGetCustomSwitchIdx(n)].onColorLuaOverride = v;
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::cfsSetOffColorLuaOverride(uint8_t n, bool v) {
|
||||||
|
customSwitches[switchGetCustomSwitchIdx(n)].offColorLuaOverride = v;
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fsStartPositionType RadioData::switchStart(uint8_t n) {
|
||||||
|
return (fsStartPositionType)switchConfig[n].start;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioData::switchSetStart(uint8_t n, fsStartPositionType v) {
|
||||||
|
switchConfig[n].start = v;
|
||||||
|
storageDirty(EE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
RGBLedColor& RadioData::switchOnColor(uint8_t n) {
|
||||||
|
return switchConfig[n].onColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
RGBLedColor& RadioData::switchOffColor(uint8_t n) {
|
||||||
|
return switchConfig[n].offColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadioData::cfsOnColorLuaOverride(uint8_t n) {
|
||||||
|
return switchConfig[n].onColorLuaOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadioData::cfsOffColorLuaOverride(uint8_t n) {
|
||||||
|
return switchConfig[n].offColorLuaOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioData::cfsSetOnColorLuaOverride(uint8_t n, bool v) {
|
||||||
|
switchConfig[n].onColorLuaOverride = v;
|
||||||
|
storageDirty(EE_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioData::cfsSetOffColorLuaOverride(uint8_t n, bool v) {
|
||||||
|
switchConfig[n].offColorLuaOverride = v;
|
||||||
|
storageDirty(EE_GENERAL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
+125
-11
@@ -32,6 +32,7 @@
|
|||||||
#include "usb_joystick.h"
|
#include "usb_joystick.h"
|
||||||
#include "input_mapping.h"
|
#include "input_mapping.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "bitfield.h"
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define N_TARANIS_FIELD(x)
|
#define N_TARANIS_FIELD(x)
|
||||||
@@ -643,21 +644,54 @@ struct RGBLedColor {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
PACK(struct customSwitch {
|
||||||
|
CUST_IDX(sw, cfs_idx_read, cfs_idx_write);
|
||||||
|
NOBACKUP(char name[LEN_SWITCH_NAME]);
|
||||||
|
uint8_t type:3 ENUM(SwitchConfig);
|
||||||
|
#if NUM_FUNCTIONS_GROUPS > 3
|
||||||
|
uint8_t group:3;
|
||||||
|
#else
|
||||||
|
uint8_t group:2;
|
||||||
|
#endif
|
||||||
|
uint8_t start:2 ENUM(fsStartPositionType);
|
||||||
|
uint8_t state:1;
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
NOBACKUP(uint8_t onColorLuaOverride:1 ENUM(booleanEnum));
|
||||||
|
NOBACKUP(uint8_t offColorLuaOverride:1 ENUM(booleanEnum));
|
||||||
|
#if NUM_FUNCTIONS_GROUPS > 3
|
||||||
|
NOBACKUP(uint8_t spare:5) SKIP;
|
||||||
|
#else
|
||||||
|
NOBACKUP(uint8_t spare:6) SKIP;
|
||||||
|
#endif
|
||||||
|
NOBACKUP(RGBLedColor onColor) FUNC(isAlwaysActive);
|
||||||
|
NOBACKUP(RGBLedColor offColor) FUNC(isAlwaysActive);
|
||||||
|
#else
|
||||||
|
#if NUM_FUNCTIONS_GROUPS > 3
|
||||||
|
NOBACKUP(uint8_t spare:7) SKIP;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
#define FUNCTION_SWITCHS_RGB_LEDS_FIELDS \
|
#define FUNCTION_SWITCHS_RGB_LEDS_FIELDS \
|
||||||
RGBLedColor functionSwitchLedONColor[NUM_FUNCTIONS_SWITCHES]; \
|
CUST_ARRAY(functionSwitchLedONColor, struct_cfsOnColorConfig, NUM_FUNCTIONS_SWITCHES, nullptr); \
|
||||||
RGBLedColor functionSwitchLedOFFColor[NUM_FUNCTIONS_SWITCHES];
|
CUST_ARRAY(functionSwitchLedOFFColor, struct_cfsOffColorConfig, NUM_FUNCTIONS_SWITCHES, nullptr);
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_SWITCHS_RGB_LEDS_FIELDS
|
#define FUNCTION_SWITCHS_RGB_LEDS_FIELDS
|
||||||
#endif
|
#endif
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
#define FUNCTION_SWITCHS_FIELDS \
|
#define FUNCTION_SWITCHS_FIELDS \
|
||||||
uint16_t functionSwitchConfig; \
|
CUST_ATTR(functionSwitchConfig, r_functionSwitchConfig, nullptr); \
|
||||||
uint16_t functionSwitchGroup; \
|
CUST_ATTR(functionSwitchGroup, r_functionSwitchGroup, nullptr); \
|
||||||
uint16_t functionSwitchStartConfig; \
|
CUST_ATTR(functionSwitchStartConfig, r_functionSwitchStartConfig, nullptr); \
|
||||||
uint8_t functionSwitchLogicalState; \
|
CUST_ATTR(functionSwitchLogicalState, r_functionSwitchLogicalState, nullptr); \
|
||||||
char switchNames[NUM_FUNCTIONS_SWITCHES][LEN_SWITCH_NAME]; \
|
CUST_ARRAY(switchNames, struct_cfsNameConfig, NUM_FUNCTIONS_SWITCHES, nullptr); \
|
||||||
FUNCTION_SWITCHS_RGB_LEDS_FIELDS
|
FUNCTION_SWITCHS_RGB_LEDS_FIELDS \
|
||||||
|
customSwitch customSwitches[NUM_FUNCTIONS_SWITCHES] FUNC(isAlwaysActive) NO_IDX; \
|
||||||
|
uint8_t cfsGroupOn ARRAY(1, struct_cfsGroupOn, cfsGroupIsActive); \
|
||||||
|
NOBACKUP(uint8_t sfPushState) SKIP;
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_SWITCHS_FIELDS
|
#define FUNCTION_SWITCHS_FIELDS
|
||||||
#endif
|
#endif
|
||||||
@@ -744,7 +778,7 @@ PACK(struct ModelData {
|
|||||||
|
|
||||||
NOBACKUP(uint8_t thrTraceSrc CUST(r_thrSrc,w_thrSrc));
|
NOBACKUP(uint8_t thrTraceSrc CUST(r_thrSrc,w_thrSrc));
|
||||||
CUST_ATTR(switchWarningState, r_swtchWarn, nullptr);
|
CUST_ATTR(switchWarningState, r_swtchWarn, nullptr);
|
||||||
NOBACKUP(swarnstate_t switchWarning ARRAY(3, struct_swtchWarn, nullptr));
|
NOBACKUP(swarnstate_t switchWarning ARRAY(2, struct_swtchWarn, nullptr));
|
||||||
|
|
||||||
GVarData gvars[MAX_GVARS];
|
GVarData gvars[MAX_GVARS];
|
||||||
|
|
||||||
@@ -828,6 +862,47 @@ PACK(struct ModelData {
|
|||||||
uint8_t modelSFDisabled:2 ENUM(ModelOverridableEnable);
|
uint8_t modelSFDisabled:2 ENUM(ModelOverridableEnable);
|
||||||
uint8_t modelCustomScriptsDisabled:2 ENUM(ModelOverridableEnable);
|
uint8_t modelCustomScriptsDisabled:2 ENUM(ModelOverridableEnable);
|
||||||
uint8_t modelTelemetryDisabled:2 ENUM(ModelOverridableEnable);
|
uint8_t modelTelemetryDisabled:2 ENUM(ModelOverridableEnable);
|
||||||
|
|
||||||
|
SwitchConfig getSwitchType(uint8_t n);
|
||||||
|
void setSwitchType(uint8_t n, SwitchConfig v);
|
||||||
|
char* getSwitchCustomName(uint8_t n);
|
||||||
|
bool switchHasCustomName(uint8_t n);
|
||||||
|
|
||||||
|
uint8_t getSwitchStateForWarning(uint8_t n);
|
||||||
|
NOBACKUP(uint8_t getSwitchWarning(uint8_t n) { return bfGet<swarnstate_t>(switchWarning, n * 2, 2); })
|
||||||
|
NOBACKUP(void setSwitchWarning(uint8_t n, uint8_t v) { switchWarning = bfSet<swarnstate_t>(switchWarning, v, n * 2, 2); })
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
uint8_t getSwitchGroup(uint8_t n);
|
||||||
|
fsStartPositionType getSwitchStart(uint8_t n);
|
||||||
|
void setSwitchStart(uint8_t n, fsStartPositionType v);
|
||||||
|
SwitchConfig cfsType(uint8_t n);
|
||||||
|
void cfsSetType(uint8_t n, SwitchConfig v);
|
||||||
|
char* cfsName(uint8_t n);
|
||||||
|
uint8_t cfsGroup(uint8_t n);
|
||||||
|
void cfsSetGroup(uint8_t n, uint8_t v);
|
||||||
|
fsStartPositionType cfsStart(uint8_t n);
|
||||||
|
void cfsSetStart(uint8_t n, fsStartPositionType v);
|
||||||
|
bool cfsState(uint8_t n);
|
||||||
|
void cfsSetState(uint8_t n, bool v);
|
||||||
|
bool cfsSFState(uint8_t n);
|
||||||
|
void cfsSetSFState(uint8_t n, bool v);
|
||||||
|
void cfsResetSFState();
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
RGBLedColor& getSwitchOnColor(uint8_t n);
|
||||||
|
RGBLedColor& getSwitchOffColor(uint8_t n);
|
||||||
|
bool getSwitchOnColorLuaOverride(uint8_t n);
|
||||||
|
bool getSwitchOffColorLuaOverride(uint8_t n);
|
||||||
|
RGBLedColor& cfsOnColor(uint8_t n);
|
||||||
|
RGBLedColor& cfsOffColor(uint8_t n);
|
||||||
|
bool cfsOnColorLuaOverride(uint8_t n);
|
||||||
|
bool cfsOffColorLuaOverride(uint8_t n);
|
||||||
|
void cfsSetOnColorLuaOverride(uint8_t n, bool v);
|
||||||
|
void cfsSetOffColorLuaOverride(uint8_t n, bool v);
|
||||||
|
#endif
|
||||||
|
bool cfsGroupAlwaysOn(uint8_t n) { return bfGet<uint8_t>(cfsGroupOn, n, 1); }
|
||||||
|
void cfsSetGroupAlwaysOn(uint8_t n, bool v) { cfsGroupOn = bfSet<uint8_t>(cfsGroupOn, v, n, 1); }
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -877,6 +952,26 @@ PACK(struct TrainerData {
|
|||||||
#define BUZZER_FIELD int8_t spare2:2 SKIP
|
#define BUZZER_FIELD int8_t spare2:2 SKIP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PACK(struct switchDef {
|
||||||
|
CUST_IDX(sw, sw_idx_read, sw_idx_write);
|
||||||
|
NOBACKUP(char name[LEN_SWITCH_NAME]);
|
||||||
|
uint8_t type:3 ENUM(SwitchConfig);
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
uint8_t start:2 ENUM(fsStartPositionType) FUNC(switch_is_cfs);
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
NOBACKUP(uint8_t onColorLuaOverride:1 ENUM(booleanEnum)) FUNC(switch_is_cfs);
|
||||||
|
NOBACKUP(uint8_t offColorLuaOverride:1 ENUM(booleanEnum)) FUNC(switch_is_cfs);
|
||||||
|
NOBACKUP(uint8_t spare:1) SKIP;
|
||||||
|
NOBACKUP(RGBLedColor onColor) FUNC(switch_is_cfs);
|
||||||
|
NOBACKUP(RGBLedColor offColor) FUNC(switch_is_cfs);
|
||||||
|
#else
|
||||||
|
NOBACKUP(uint8_t spare:3) SKIP;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
NOBACKUP(uint8_t spare:5) SKIP;
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
|
||||||
PACK(struct RadioData {
|
PACK(struct RadioData {
|
||||||
|
|
||||||
// Real attributes
|
// Real attributes
|
||||||
@@ -967,7 +1062,7 @@ PACK(struct RadioData {
|
|||||||
CUST_ARRAY(slidersConfig, struct_sliderConfig, MAX_POTS, nullptr);
|
CUST_ARRAY(slidersConfig, struct_sliderConfig, MAX_POTS, nullptr);
|
||||||
uint8_t stickInvert SKIP;
|
uint8_t stickInvert SKIP;
|
||||||
potconfig_t potsConfig ARRAY(4,struct_potConfig,nullptr);
|
potconfig_t potsConfig ARRAY(4,struct_potConfig,nullptr);
|
||||||
swconfig_t switchConfig ARRAY(2,struct_switchConfig,nullptr);
|
switchDef switchConfig[MAX_SWITCHES] FUNC(switchIsActive) NO_IDX; \
|
||||||
CUST_ARRAY(flexSwitches, struct_flexSwitch, MAX_FLEX_SWITCHES, flex_sw_valid);
|
CUST_ARRAY(flexSwitches, struct_flexSwitch, MAX_FLEX_SWITCHES, flex_sw_valid);
|
||||||
|
|
||||||
EXTRA_GENERAL_FIELDS
|
EXTRA_GENERAL_FIELDS
|
||||||
@@ -1035,6 +1130,25 @@ PACK(struct RadioData {
|
|||||||
return backlightBright;
|
return backlightBright;
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
char* getSwitchCustomName(uint8_t n);
|
||||||
|
bool switchHasCustomName(uint8_t n);
|
||||||
|
SwitchConfig switchType(uint8_t n);
|
||||||
|
void switchSetType(uint8_t n, SwitchConfig v);
|
||||||
|
char* switchName(uint8_t n);
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
uint8_t switchGroup(uint8_t n) { return 0; }
|
||||||
|
fsStartPositionType switchStart(uint8_t n);
|
||||||
|
void switchSetStart(uint8_t n, fsStartPositionType v);
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
RGBLedColor& switchOnColor(uint8_t n);
|
||||||
|
RGBLedColor& switchOffColor(uint8_t n);
|
||||||
|
bool cfsOnColorLuaOverride(uint8_t n);
|
||||||
|
bool cfsOffColorLuaOverride(uint8_t n);
|
||||||
|
void cfsSetOnColorLuaOverride(uint8_t n, bool v);
|
||||||
|
void cfsSetOffColorLuaOverride(uint8_t n, bool v);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
#undef SWITCHES_WARNING_DATA
|
#undef SWITCHES_WARNING_DATA
|
||||||
|
|||||||
+17
-1
@@ -293,6 +293,22 @@ void setDefaultOwnerId()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void generalDefaultSwitches()
|
||||||
|
{
|
||||||
|
for (uint8_t sw = 0; sw < switchGetMaxSwitches(); sw += 1) {
|
||||||
|
g_eeGeneral.switchConfig[sw].type = switchGetDefaultConfig(sw);
|
||||||
|
g_eeGeneral.switchConfig[sw].name[0] = 0;
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
if (switchIsCustomSwitch(sw))
|
||||||
|
g_eeGeneral.switchConfig[sw].start = FS_START_PREVIOUS;
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
g_eeGeneral.switchConfig[sw].onColor.setColor(0xFFFFFF);
|
||||||
|
g_eeGeneral.switchConfig[sw].offColor.setColor(0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void generalDefault()
|
void generalDefault()
|
||||||
{
|
{
|
||||||
memclear(&g_eeGeneral, sizeof(g_eeGeneral));
|
memclear(&g_eeGeneral, sizeof(g_eeGeneral));
|
||||||
@@ -318,7 +334,7 @@ void generalDefault()
|
|||||||
adcCalibDefaults();
|
adcCalibDefaults();
|
||||||
|
|
||||||
g_eeGeneral.potsConfig = adcGetDefaultPotsConfig();
|
g_eeGeneral.potsConfig = adcGetDefaultPotsConfig();
|
||||||
g_eeGeneral.switchConfig = switchGetDefaultConfig();
|
generalDefaultSwitches();
|
||||||
|
|
||||||
#if defined(STICK_DEAD_ZONE)
|
#if defined(STICK_DEAD_ZONE)
|
||||||
g_eeGeneral.stickDeadZone = DEFAULT_STICK_DEADZONE;
|
g_eeGeneral.stickDeadZone = DEFAULT_STICK_DEADZONE;
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ uint16_t isqrt32(uint32_t n);
|
|||||||
|
|
||||||
void setDefaultOwnerId();
|
void setDefaultOwnerId();
|
||||||
void generalDefault();
|
void generalDefault();
|
||||||
|
void generalDefaultSwitches();
|
||||||
|
|
||||||
uint32_t hash(const void * ptr, uint32_t size);
|
uint32_t hash(const void * ptr, uint32_t size);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ enum SwitchConfig {
|
|||||||
SWITCH_TOGGLE,
|
SWITCH_TOGGLE,
|
||||||
SWITCH_2POS,
|
SWITCH_2POS,
|
||||||
SWITCH_3POS,
|
SWITCH_3POS,
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
SWITCH_GLOBAL,
|
||||||
|
#endif
|
||||||
|
SWITCH_none = SWITCH_NONE,
|
||||||
|
SWITCH_toggle = SWITCH_TOGGLE,
|
||||||
|
SWITCH_2pos = SWITCH_2POS,
|
||||||
|
SWITCH_3pos = SWITCH_3POS,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FlexAnalogConfig {
|
enum FlexAnalogConfig {
|
||||||
@@ -40,11 +47,16 @@ enum FlexAnalogConfig {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum fsStartPositionType {
|
enum fsStartPositionType {
|
||||||
FS_START_ON,
|
|
||||||
FS_START_OFF,
|
FS_START_OFF,
|
||||||
|
FS_START_ON,
|
||||||
FS_START_PREVIOUS
|
FS_START_PREVIOUS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum booleanEnum {
|
||||||
|
BOOL_OFF,
|
||||||
|
BOOL_ON
|
||||||
|
};
|
||||||
|
|
||||||
enum CalibrationState {
|
enum CalibrationState {
|
||||||
CALIB_START,
|
CALIB_START,
|
||||||
CALIB_SET_MIDPOINT,
|
CALIB_SET_MIDPOINT,
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void evalFunctions(CustomFunctionData * functions, CustomFunctionsContext & func
|
|||||||
MASK_FUNC_TYPE newActiveFunctions = 0;
|
MASK_FUNC_TYPE newActiveFunctions = 0;
|
||||||
MASK_CFN_TYPE newActiveSwitches = 0;
|
MASK_CFN_TYPE newActiveSwitches = 0;
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
functionSwitchFunctionState = 0;
|
g_model.cfsResetSFState();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t playFirstIndex = (functions == g_model.customFn ? 1 : 1+MAX_SPECIAL_FUNCTIONS);
|
uint8_t playFirstIndex = (functions == g_model.customFn ? 1 : 1+MAX_SPECIAL_FUNCTIONS);
|
||||||
@@ -386,14 +386,13 @@ void evalFunctions(CustomFunctionData * functions, CustomFunctionsContext & func
|
|||||||
if (CFN_PARAM(cfn)) { // Duration is set
|
if (CFN_PARAM(cfn)) { // Duration is set
|
||||||
if (! CFN_VAL2(cfn) ) { // Duration not started yet
|
if (! CFN_VAL2(cfn) ) { // Duration not started yet
|
||||||
CFN_VAL2(cfn) = timersGetMsTick() + CFN_PARAM(cfn) * 100;
|
CFN_VAL2(cfn) = timersGetMsTick() + CFN_PARAM(cfn) * 100;
|
||||||
functionSwitchFunctionState |= 1 << CFN_CS_INDEX(cfn);
|
g_model.cfsSetSFState(CFN_CS_INDEX(cfn), 1);
|
||||||
}
|
} else if (timersGetMsTick() < (uint32_t)CFN_VAL2(cfn) ) { // Still within push duration
|
||||||
else if (timersGetMsTick() < (uint32_t)CFN_VAL2(cfn) ) { // Still within push duration
|
g_model.cfsSetSFState(CFN_CS_INDEX(cfn), 1);
|
||||||
functionSwitchFunctionState |= 1 << CFN_CS_INDEX(cfn);
|
|
||||||
}
|
}
|
||||||
|
} else { // No duration set
|
||||||
|
g_model.cfsSetSFState(CFN_CS_INDEX(cfn), 1);
|
||||||
}
|
}
|
||||||
else // No duration set
|
|
||||||
functionSwitchFunctionState |= 1 << CFN_CS_INDEX(cfn);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -473,7 +472,7 @@ void evalFunctions(CustomFunctionData * functions, CustomFunctionsContext & func
|
|||||||
if (CFN_FUNC(cfn) == FUNC_PUSH_CUST_SWITCH) {
|
if (CFN_FUNC(cfn) == FUNC_PUSH_CUST_SWITCH) {
|
||||||
// Handling duration after function is active
|
// Handling duration after function is active
|
||||||
if (timersGetMsTick() < (uint32_t)CFN_VAL2(cfn)) {
|
if (timersGetMsTick() < (uint32_t)CFN_VAL2(cfn)) {
|
||||||
functionSwitchFunctionState |= 1 << CFN_CS_INDEX(cfn);
|
g_model.cfsSetSFState(CFN_CS_INDEX(cfn), 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CFN_VAL2(cfn) = 0;
|
CFN_VAL2(cfn) = 0;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ uint8_t g_moduleIdx;
|
|||||||
uint8_t getSwitchWarningsCount()
|
uint8_t getSwitchWarningsCount()
|
||||||
{
|
{
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); ++i) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); ++i) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@@ -79,6 +79,20 @@ enum MenuModelSetupItems {
|
|||||||
ITEM_MODEL_SETUP_SW4,
|
ITEM_MODEL_SETUP_SW4,
|
||||||
ITEM_MODEL_SETUP_SW5,
|
ITEM_MODEL_SETUP_SW5,
|
||||||
ITEM_MODEL_SETUP_SW6,
|
ITEM_MODEL_SETUP_SW6,
|
||||||
|
ITEM_MODEL_SETUP_SW7,
|
||||||
|
ITEM_MODEL_SETUP_SW8,
|
||||||
|
ITEM_MODEL_SETUP_SW9,
|
||||||
|
ITEM_MODEL_SETUP_SW10,
|
||||||
|
ITEM_MODEL_SETUP_SW11,
|
||||||
|
ITEM_MODEL_SETUP_SW12,
|
||||||
|
ITEM_MODEL_SETUP_SW13,
|
||||||
|
ITEM_MODEL_SETUP_SW14,
|
||||||
|
ITEM_MODEL_SETUP_SW15,
|
||||||
|
ITEM_MODEL_SETUP_SW16,
|
||||||
|
ITEM_MODEL_SETUP_SW17,
|
||||||
|
ITEM_MODEL_SETUP_SW18,
|
||||||
|
ITEM_MODEL_SETUP_SW19,
|
||||||
|
ITEM_MODEL_SETUP_SW20,
|
||||||
ITEM_MODEL_SETUP_GROUP1_LABEL,
|
ITEM_MODEL_SETUP_GROUP1_LABEL,
|
||||||
ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON,
|
ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON,
|
||||||
ITEM_MODEL_SETUP_GROUP1_START,
|
ITEM_MODEL_SETUP_GROUP1_START,
|
||||||
@@ -88,6 +102,9 @@ enum MenuModelSetupItems {
|
|||||||
ITEM_MODEL_SETUP_GROUP3_LABEL,
|
ITEM_MODEL_SETUP_GROUP3_LABEL,
|
||||||
ITEM_MODEL_SETUP_GROUP3_ALWAYS_ON,
|
ITEM_MODEL_SETUP_GROUP3_ALWAYS_ON,
|
||||||
ITEM_MODEL_SETUP_GROUP3_START,
|
ITEM_MODEL_SETUP_GROUP3_START,
|
||||||
|
ITEM_MODEL_SETUP_GROUP4_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_GROUP4_ALWAYS_ON,
|
||||||
|
ITEM_MODEL_SETUP_GROUP4_START,
|
||||||
#endif
|
#endif
|
||||||
ITEM_MODEL_SETUP_EXTENDED_LIMITS,
|
ITEM_MODEL_SETUP_EXTENDED_LIMITS,
|
||||||
ITEM_MODEL_SETUP_EXTENDED_TRIMS,
|
ITEM_MODEL_SETUP_EXTENDED_TRIMS,
|
||||||
@@ -107,6 +124,7 @@ enum MenuModelSetupItems {
|
|||||||
ITEM_MODEL_SETUP_SWITCHES_WARNING1,
|
ITEM_MODEL_SETUP_SWITCHES_WARNING1,
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
ITEM_MODEL_SETUP_SWITCHES_WARNING2,
|
ITEM_MODEL_SETUP_SWITCHES_WARNING2,
|
||||||
|
ITEM_MODEL_SETUP_SWITCHES_WARNING3,
|
||||||
ITEM_MODEL_SETUP_POTS_WARNING,
|
ITEM_MODEL_SETUP_POTS_WARNING,
|
||||||
#endif
|
#endif
|
||||||
ITEM_MODEL_SETUP_BEEP_CENTER,
|
ITEM_MODEL_SETUP_BEEP_CENTER,
|
||||||
@@ -259,6 +277,7 @@ static uint8_t FS_ROW(uint8_t value) { return expandState.functionSwitches ? val
|
|||||||
uint8_t G1_ROW(int8_t value) { return (firstSwitchInGroup(1) >= 0) ? value : HIDDEN_ROW; }
|
uint8_t G1_ROW(int8_t value) { return (firstSwitchInGroup(1) >= 0) ? value : HIDDEN_ROW; }
|
||||||
uint8_t G2_ROW(int8_t value) { return (firstSwitchInGroup(2) >= 0) ? value : HIDDEN_ROW; }
|
uint8_t G2_ROW(int8_t value) { return (firstSwitchInGroup(2) >= 0) ? value : HIDDEN_ROW; }
|
||||||
uint8_t G3_ROW(int8_t value) { return (firstSwitchInGroup(3) >= 0) ? value : HIDDEN_ROW; }
|
uint8_t G3_ROW(int8_t value) { return (firstSwitchInGroup(3) >= 0) ? value : HIDDEN_ROW; }
|
||||||
|
uint8_t G4_ROW(int8_t value) { return (firstSwitchInGroup(4) >= 0) ? value : HIDDEN_ROW; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t VIEWOPT_ROW(uint8_t value) { return expandState.viewOpt ? value : HIDDEN_ROW; }
|
static uint8_t VIEWOPT_ROW(uint8_t value) { return expandState.viewOpt ? value : HIDDEN_ROW; }
|
||||||
@@ -304,17 +323,18 @@ static uint8_t VIEWOPT_ROW(uint8_t value) { return expandState.viewOpt ? value :
|
|||||||
#define CURRENT_RECEIVER_EDITED(k) (k - ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_1)
|
#define CURRENT_RECEIVER_EDITED(k) (k - ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_SWITCH_PER_LINE (getSwitchWarningsCount() > 5 ? 4 : 5)
|
#define MAX_SWITCH_PER_LINE 5
|
||||||
#if defined(PCBXLITE)
|
#if defined(PCBXLITE)
|
||||||
// X-Lite needs an additional column for full line selection (<])
|
// X-Lite needs an additional column for full line selection (<])
|
||||||
#define SW_WARN_ROWS \
|
#define SW_WARN_ROWS \
|
||||||
PREFLIGHT_ROW(uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsCount())), \
|
PREFLIGHT_ROW(uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsCount())), \
|
||||||
PREFLIGHT_ROW(uint8_t(getSwitchWarningsCount() > 4 ? TITLE_ROW : HIDDEN_ROW))
|
PREFLIGHT_ROW(uint8_t(getSwitchWarningsCount() > MAX_SWITCH_PER_LINE ? TITLE_ROW : HIDDEN_ROW))
|
||||||
#else
|
#else
|
||||||
// Handle special case when there is only one switch that can trigger a warning (MT12)
|
// Handle special case when there is only one switch that can trigger a warning (MT12)
|
||||||
#define SW_WARN_ROWS \
|
#define SW_WARN_ROWS \
|
||||||
PREFLIGHT_ROW(uint8_t(NAVIGATION_LINE_BY_LINE|((getSwitchWarningsCount() == 1) ? 1 : getSwitchWarningsCount()-1))), \
|
PREFLIGHT_ROW(uint8_t(NAVIGATION_LINE_BY_LINE|((getSwitchWarningsCount() == 1) ? 1 : getSwitchWarningsCount()-1))), \
|
||||||
PREFLIGHT_ROW(uint8_t(getSwitchWarningsCount() > MAX_SWITCH_PER_LINE ? TITLE_ROW : HIDDEN_ROW))
|
PREFLIGHT_ROW(uint8_t(getSwitchWarningsCount() > MAX_SWITCH_PER_LINE ? TITLE_ROW : HIDDEN_ROW)), \
|
||||||
|
PREFLIGHT_ROW(uint8_t(getSwitchWarningsCount() > (MAX_SWITCH_PER_LINE * 2) ? TITLE_ROW : HIDDEN_ROW))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline uint8_t MODULE_TYPE_ROWS(int moduleIdx)
|
inline uint8_t MODULE_TYPE_ROWS(int moduleIdx)
|
||||||
@@ -356,22 +376,23 @@ inline uint8_t TIMER_ROW(uint8_t timer, uint8_t value)
|
|||||||
#define EXTRA_MODULE_ROWS
|
#define EXTRA_MODULE_ROWS
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
#define FUNCTION_SWITCHES_ROWS 0, \
|
#define FUNCTION_SWITCHES_ROWS 0, \
|
||||||
FS_ROW(0), \
|
FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), \
|
||||||
FS_ROW(0), \
|
FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), \
|
||||||
FS_ROW(0), \
|
FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), \
|
||||||
FS_ROW(0), \
|
FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), FS_ROW(0), \
|
||||||
FS_ROW(0), \
|
FS_ROW(G1_ROW(LABEL())), \
|
||||||
FS_ROW(0), \
|
FS_ROW(G1_ROW(0)), \
|
||||||
FS_ROW(G1_ROW(LABEL())), \
|
FS_ROW(G1_ROW(0)), \
|
||||||
FS_ROW(G1_ROW(0)), \
|
FS_ROW(G2_ROW(LABEL())), \
|
||||||
FS_ROW(G1_ROW(0)), \
|
FS_ROW(G2_ROW(0)), \
|
||||||
FS_ROW(G2_ROW(LABEL())), \
|
FS_ROW(G2_ROW(0)), \
|
||||||
FS_ROW(G2_ROW(0)), \
|
FS_ROW(G3_ROW(LABEL())), \
|
||||||
FS_ROW(G2_ROW(0)), \
|
FS_ROW(G3_ROW(0)), \
|
||||||
FS_ROW(G3_ROW(LABEL())), \
|
FS_ROW(G3_ROW(0)), \
|
||||||
FS_ROW(G3_ROW(0)), \
|
FS_ROW(G4_ROW(LABEL())), \
|
||||||
FS_ROW(G3_ROW(0)),
|
FS_ROW(G4_ROW(0)), \
|
||||||
|
FS_ROW(G4_ROW(0)),
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_SWITCHES_ROWS
|
#define FUNCTION_SWITCHES_ROWS
|
||||||
#endif
|
#endif
|
||||||
@@ -561,10 +582,6 @@ inline uint8_t USB_JOYSTICK_APPLYROW()
|
|||||||
#define USB_JOYSTICK_ROWS
|
#define USB_JOYSTICK_ROWS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
static const char* _fct_sw_start[] = { STR_CHAR_DOWN, STR_CHAR_UP, "=" };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t viewOptChoice(coord_t y, const char* title, uint8_t value, uint8_t attr, event_t event)
|
uint8_t viewOptChoice(coord_t y, const char* title, uint8_t value, uint8_t attr, event_t event)
|
||||||
{
|
{
|
||||||
lcdDrawText(INDENT_WIDTH-1, y, title);
|
lcdDrawText(INDENT_WIDTH-1, y, title);
|
||||||
@@ -572,93 +589,99 @@ uint8_t viewOptChoice(coord_t y, const char* title, uint8_t value, uint8_t attr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
static int cfsIndex;
|
const char* _fct_sw_start[] = { STR_CHAR_UP, STR_CHAR_DOWN, "=" };
|
||||||
|
static int swIndex;
|
||||||
static uint8_t cfsGroup;
|
static uint8_t cfsGroup;
|
||||||
|
|
||||||
bool checkCFSTypeAvailable(int val)
|
bool checkCFSTypeAvailable(int val)
|
||||||
{
|
{
|
||||||
int group = FSWITCH_GROUP(cfsIndex);
|
if (val == SWITCH_3POS) return false;
|
||||||
if (group > 0 && IS_FSWITCH_GROUP_ON(group) && val == SWITCH_TOGGLE)
|
int group = g_model.cfsGroup(swIndex);
|
||||||
|
if (group > 0 && g_model.cfsGroupAlwaysOn(group) && val == SWITCH_TOGGLE)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkCFSGroupAvailable(int group)
|
static bool checkCFSGroupAvailable(int group)
|
||||||
{
|
{
|
||||||
if (FSWITCH_CONFIG(cfsIndex) == SWITCH_TOGGLE && group && IS_FSWITCH_GROUP_ON(group))
|
if (g_model.cfsType(swIndex) == SWITCH_TOGGLE && group && g_model.cfsGroupAlwaysOn(group))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkCFSSwitchAvailable(int sw)
|
static bool checkCFSSwitchAvailable(int sw)
|
||||||
{
|
{
|
||||||
return (sw == 0) || (sw == NUM_FUNCTIONS_SWITCHES + 1) || (FSWITCH_GROUP(sw - 1) == cfsGroup);
|
return (sw == -1) || (sw == switchGetMaxSwitches()) || (switchIsCustomSwitch(sw) && (g_model.cfsGroup(sw) == cfsGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
bool checkCFSColorAvailable(int col)
|
static bool checkCFSColorAvailable(int col)
|
||||||
{
|
{
|
||||||
return col > 0;
|
return col > 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum CFSFields {
|
enum CFSFields {
|
||||||
CFS_FIELD_NAME,
|
|
||||||
CFS_FIELD_TYPE,
|
CFS_FIELD_TYPE,
|
||||||
|
CFS_FIELD_NAME,
|
||||||
CFS_FIELD_GROUP,
|
CFS_FIELD_GROUP,
|
||||||
CFS_FIELD_START,
|
CFS_FIELD_START,
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
CFS_FIELD_COLOR_LABEL,
|
CFS_FIELD_COLOR_LABEL,
|
||||||
CFS_FIELD_ON_COLOR,
|
CFS_FIELD_ON_COLOR,
|
||||||
|
CFS_FIELD_ON_LUA_OVERRIDE,
|
||||||
CFS_FIELD_OFF_COLOR,
|
CFS_FIELD_OFF_COLOR,
|
||||||
|
CFS_FIELD_OFF_LUA_OVERRIDE,
|
||||||
#endif
|
#endif
|
||||||
CFS_FIELD_COUNT
|
CFS_FIELD_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
static void menuCFSColor(coord_t y, RGBLedColor& color, const char* title, LcdFlags attr, event_t event)
|
void menuCFSColor(coord_t y, RGBLedColor& color, const char* title, LcdFlags attr, event_t event)
|
||||||
{
|
{
|
||||||
uint8_t selectedColor = getRGBColorIndex(color.getColor());
|
uint8_t selectedColor = getRGBColorIndex(color.getColor());
|
||||||
selectedColor = editChoice(30, y, title, \
|
selectedColor = editChoice(30, y, title, \
|
||||||
STR_FS_COLOR_LIST, selectedColor, 0, DIM(colorTable), menuHorizontalPosition == 0 ? attr : 0, event, INDENT_WIDTH, checkCFSColorAvailable);
|
STR_FS_COLOR_LIST, selectedColor, 0, DIM(colorTable), menuHorizontalPosition == 0 ? attr : 0, event, INDENT_WIDTH, checkCFSColorAvailable);
|
||||||
if (attr && menuHorizontalPosition == 0 && checkIncDec_Ret) {
|
if (attr && menuHorizontalPosition == 0 && checkIncDec_Ret) {
|
||||||
color.setColor(colorTable[selectedColor - 1]);
|
color.setColor(colorTable[selectedColor - 1]);
|
||||||
storageDirty(EE_MODEL);
|
storageDirty((isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdDrawNumber(LCD_W - 6 * FW, y, color.r, (menuHorizontalPosition == 1 ? attr : 0) | RIGHT);
|
lcdDrawNumber(LCD_W - 6 * FW, y, color.r, (menuHorizontalPosition == 1 ? attr : 0) | RIGHT);
|
||||||
if (attr && menuHorizontalPosition == 1)
|
if (attr && menuHorizontalPosition == 1)
|
||||||
color.r = checkIncDecModel(event, color.r, 0, 255);
|
color.r = checkIncDec(event, color.r, 0, 255, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||||
|
|
||||||
lcdDrawNumber(LCD_W - 3 * FW, y, color.g, (menuHorizontalPosition == 2 ? attr : 0) | RIGHT);
|
lcdDrawNumber(LCD_W - 3 * FW, y, color.g, (menuHorizontalPosition == 2 ? attr : 0) | RIGHT);
|
||||||
if (attr && menuHorizontalPosition == 2)
|
if (attr && menuHorizontalPosition == 2)
|
||||||
color.g = checkIncDecModel(event, color.g, 0, 255);
|
color.g = checkIncDec(event, color.g, 0, 255, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||||
|
|
||||||
lcdDrawNumber(LCD_W, y, color.b, (menuHorizontalPosition == 3 ? attr : 0) | RIGHT);
|
lcdDrawNumber(LCD_W, y, color.b, (menuHorizontalPosition == 3 ? attr : 0) | RIGHT);
|
||||||
if (attr && menuHorizontalPosition == 3)
|
if (attr && menuHorizontalPosition == 3)
|
||||||
color.b = checkIncDecModel(event, color.b, 0, 255);
|
color.b = checkIncDec(event, color.b, 0, 255, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void menuModelCFSOne(event_t event)
|
static void menuModelCFSOne(event_t event)
|
||||||
{
|
{
|
||||||
std::string s(STR_CHAR_SWITCH);
|
std::string s(STR_CHAR_SWITCH);
|
||||||
s += switchGetName(cfsIndex + switchGetMaxSwitches());
|
s += switchGetDefaultName(swIndex);
|
||||||
|
|
||||||
int config = FSWITCH_CONFIG(cfsIndex);
|
int config = g_model.cfsType(swIndex);
|
||||||
uint8_t group = FSWITCH_GROUP(cfsIndex);
|
uint8_t group = g_model.cfsGroup(swIndex);
|
||||||
int startPos = FSWITCH_STARTUP(cfsIndex);
|
int startPos = g_model.cfsStart(swIndex);
|
||||||
|
|
||||||
SUBMENU(s.c_str(), CFS_FIELD_COUNT,
|
SUBMENU(s.c_str(), CFS_FIELD_COUNT,
|
||||||
{
|
{
|
||||||
0,
|
0,
|
||||||
0,
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 0 : HIDDEN_ROW),
|
||||||
(uint8_t)((config != SWITCH_NONE) ? 0 : HIDDEN_ROW),
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 0 : HIDDEN_ROW),
|
||||||
(uint8_t)((config != SWITCH_NONE && config != SWITCH_TOGGLE && group == 0) ? 0 : HIDDEN_ROW),
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_TOGGLE && config != SWITCH_GLOBAL && group == 0) ? 0 : HIDDEN_ROW),
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
LABEL(),
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? LABEL() : HIDDEN_ROW),
|
||||||
3,
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 3 : HIDDEN_ROW),
|
||||||
3,
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 0 : HIDDEN_ROW),
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 3 : HIDDEN_ROW),
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 0 : HIDDEN_ROW),
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -677,40 +700,42 @@ void menuModelCFSOne(event_t event)
|
|||||||
LcdFlags attr = (sub == i ? (editMode > 0 ? BLINK | INVERS : INVERS) : 0);
|
LcdFlags attr = (sub == i ? (editMode > 0 ? BLINK | INVERS : INVERS) : 0);
|
||||||
|
|
||||||
switch(i) {
|
switch(i) {
|
||||||
|
case CFS_FIELD_TYPE:
|
||||||
|
config = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_SWITCH_TYPE, STR_SWTYPES, config, SWITCH_NONE, SWITCH_GLOBAL, attr, event, 0, checkCFSTypeAvailable);
|
||||||
|
if (attr && checkIncDec_Ret) {
|
||||||
|
g_model.cfsSetType(swIndex, (SwitchConfig)config);
|
||||||
|
if (config == SWITCH_NONE) {
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
fsLedRGB(switchGetCustomSwitchIdx(swIndex), 0);
|
||||||
|
#endif
|
||||||
|
} else if (config == SWITCH_TOGGLE) {
|
||||||
|
g_model.cfsSetStart(swIndex, FS_START_PREVIOUS); // Toggle switches do not have startup position
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case CFS_FIELD_NAME:
|
case CFS_FIELD_NAME:
|
||||||
editSingleName(MODEL_SETUP_2ND_COLUMN, y, STR_NAME, g_model.switchNames[cfsIndex],
|
editSingleName(MODEL_SETUP_2ND_COLUMN, y, STR_NAME, g_model.cfsName(swIndex),
|
||||||
LEN_SWITCH_NAME, event, (attr != 0),
|
LEN_SWITCH_NAME, event, (attr != 0),
|
||||||
editMode);
|
editMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CFS_FIELD_TYPE:
|
|
||||||
config = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_SWITCH_TYPE, STR_SWTYPES, config, SWITCH_NONE, SWITCH_2POS, attr, event, 0, checkCFSTypeAvailable);
|
|
||||||
if (attr && checkIncDec_Ret) {
|
|
||||||
FSWITCH_SET_CONFIG(cfsIndex, config);
|
|
||||||
if (config == SWITCH_TOGGLE) {
|
|
||||||
FSWITCH_SET_STARTUP(cfsIndex, FS_START_PREVIOUS); // Toggle switches do not have startup position
|
|
||||||
}
|
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CFS_FIELD_GROUP:
|
case CFS_FIELD_GROUP:
|
||||||
group = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_SWITCH_GROUP, STR_FSGROUPS, group, 0, 3, attr, event, 0, checkCFSGroupAvailable);
|
group = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_SWITCH_GROUP, STR_FSGROUPS, group, 0, NUM_FUNCTIONS_GROUPS, attr, event, 0, checkCFSGroupAvailable);
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
int oldGroup = FSWITCH_GROUP(cfsIndex);
|
int oldGroup = g_model.cfsGroup(swIndex);
|
||||||
if (groupHasSwitchOn(group))
|
if (groupHasSwitchOn(group))
|
||||||
setFSLogicalState(cfsIndex, 0);
|
setFSLogicalState(swIndex, 0);
|
||||||
FSWITCH_SET_GROUP(cfsIndex, group);
|
g_model.cfsSetGroup(swIndex, group);
|
||||||
if (group > 0) {
|
if (group > 0) {
|
||||||
FSWITCH_SET_STARTUP(cfsIndex, groupDefaultSwitch(group) == -1 ? FS_START_PREVIOUS : FS_START_OFF);
|
g_model.cfsSetStart(swIndex, groupDefaultSwitch(group) == -1 ? FS_START_PREVIOUS : FS_START_OFF);
|
||||||
if (config == SWITCH_TOGGLE && IS_FSWITCH_GROUP_ON(group))
|
if (config == SWITCH_TOGGLE && g_model.cfsGroupAlwaysOn(group))
|
||||||
FSWITCH_SET_CONFIG(cfsIndex, SWITCH_2POS);
|
g_model.cfsSetType(swIndex, SWITCH_2POS);
|
||||||
setGroupSwitchState(group, cfsIndex);
|
setGroupSwitchState(group);
|
||||||
} else {
|
} else {
|
||||||
FSWITCH_SET_STARTUP(cfsIndex, FS_START_PREVIOUS);
|
g_model.cfsSetStart(swIndex, FS_START_PREVIOUS);
|
||||||
}
|
}
|
||||||
setGroupSwitchState(oldGroup);
|
setGroupSwitchState(oldGroup);
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -718,9 +743,8 @@ void menuModelCFSOne(event_t event)
|
|||||||
lcdDrawText(0, y, STR_SWITCH_STARTUP);
|
lcdDrawText(0, y, STR_SWITCH_STARTUP);
|
||||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, _fct_sw_start[startPos], attr ? (s_editMode ? INVERS + BLINK : INVERS) : 0);
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, _fct_sw_start[startPos], attr ? (s_editMode ? INVERS + BLINK : INVERS) : 0);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
startPos = checkIncDec(event, startPos, FS_START_ON, FS_START_PREVIOUS, EE_MODEL);
|
startPos = checkIncDec(event, startPos, FS_START_OFF, FS_START_PREVIOUS, EE_MODEL);
|
||||||
FSWITCH_SET_STARTUP(cfsIndex, startPos);
|
g_model.cfsSetStart(swIndex, (fsStartPositionType)startPos);
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -733,11 +757,19 @@ void menuModelCFSOne(event_t event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CFS_FIELD_ON_COLOR:
|
case CFS_FIELD_ON_COLOR:
|
||||||
menuCFSColor(y, g_model.functionSwitchLedONColor[cfsIndex], STR_OFFON[1], attr, event);
|
menuCFSColor(y, g_model.cfsOnColor(swIndex), STR_OFFON[1], attr, event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_ON_LUA_OVERRIDE:
|
||||||
|
g_model.cfsSetOnColorLuaOverride(swIndex, editCheckBox(g_model.cfsOnColorLuaOverride(swIndex), LCD_W - 2 * FW, y, STR_LUA_OVERRIDE, attr, event, INDENT_WIDTH));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CFS_FIELD_OFF_COLOR:
|
case CFS_FIELD_OFF_COLOR:
|
||||||
menuCFSColor(y, g_model.functionSwitchLedOFFColor[cfsIndex], STR_OFFON[0], attr, event);
|
menuCFSColor(y, g_model.cfsOffColor(swIndex), STR_OFFON[0], attr, event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_OFF_LUA_OVERRIDE:
|
||||||
|
g_model.cfsSetOffColorLuaOverride(swIndex, editCheckBox(g_model.cfsOffColorLuaOverride(swIndex), LCD_W - 2 * FW, y, STR_LUA_OVERRIDE, attr, event, INDENT_WIDTH));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -812,6 +844,15 @@ void menuModelSetup(event_t event)
|
|||||||
USB_JOYSTICK_ROWS
|
USB_JOYSTICK_ROWS
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
int swCnt = switchGetMaxSwitches();
|
||||||
|
uint8_t* p = (uint8_t*)mstate_tab;
|
||||||
|
for (int i = 0; i < MAX_SWITCHES; i += 1) {
|
||||||
|
if (i >= swCnt || !switchIsCustomSwitch(i))
|
||||||
|
p[i + ITEM_MODEL_SETUP_SW1] = HIDDEN_ROW;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE + ITEM_MODEL_SETUP_LINES_COUNT);
|
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE + ITEM_MODEL_SETUP_LINES_COUNT);
|
||||||
title(STR_MENU_MODEL_SETUP);
|
title(STR_MENU_MODEL_SETUP);
|
||||||
|
|
||||||
@@ -988,33 +1029,48 @@ void menuModelSetup(event_t event)
|
|||||||
case ITEM_MODEL_SETUP_SW4:
|
case ITEM_MODEL_SETUP_SW4:
|
||||||
case ITEM_MODEL_SETUP_SW5:
|
case ITEM_MODEL_SETUP_SW5:
|
||||||
case ITEM_MODEL_SETUP_SW6:
|
case ITEM_MODEL_SETUP_SW6:
|
||||||
|
case ITEM_MODEL_SETUP_SW7:
|
||||||
|
case ITEM_MODEL_SETUP_SW8:
|
||||||
|
case ITEM_MODEL_SETUP_SW9:
|
||||||
|
case ITEM_MODEL_SETUP_SW10:
|
||||||
|
case ITEM_MODEL_SETUP_SW11:
|
||||||
|
case ITEM_MODEL_SETUP_SW12:
|
||||||
|
case ITEM_MODEL_SETUP_SW13:
|
||||||
|
case ITEM_MODEL_SETUP_SW14:
|
||||||
|
case ITEM_MODEL_SETUP_SW15:
|
||||||
|
case ITEM_MODEL_SETUP_SW16:
|
||||||
|
case ITEM_MODEL_SETUP_SW17:
|
||||||
|
case ITEM_MODEL_SETUP_SW18:
|
||||||
|
case ITEM_MODEL_SETUP_SW19:
|
||||||
|
case ITEM_MODEL_SETUP_SW20:
|
||||||
{
|
{
|
||||||
int index = (k - ITEM_MODEL_SETUP_SW1);
|
int index = (k - ITEM_MODEL_SETUP_SW1);
|
||||||
|
|
||||||
lcdDrawSizedText(INDENT_WIDTH, y, STR_CHAR_SWITCH, 2, attr);
|
lcdDrawSizedText(INDENT_WIDTH, y, STR_CHAR_SWITCH, 2, attr);
|
||||||
lcdDrawText(lcdNextPos, y, switchGetName(index+switchGetMaxSwitches()), attr);
|
lcdDrawText(lcdNextPos, y, switchGetDefaultName(index), attr);
|
||||||
|
|
||||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
cfsIndex = index;
|
swIndex = index;
|
||||||
pushMenu(menuModelCFSOne);
|
pushMenu(menuModelCFSOne);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZEXIST(g_model.switchNames[index])) {
|
int config = g_model.cfsType(index);
|
||||||
char s[LEN_SWITCH_NAME + 1];
|
|
||||||
strAppend(s, g_model.switchNames[index], LEN_SWITCH_NAME);
|
|
||||||
lcdDrawText(35, y, s);
|
|
||||||
} else {
|
|
||||||
lcdDrawMMM(35, y, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int config = FSWITCH_CONFIG(index);
|
|
||||||
lcdDrawText(30 + 5 * FW, y, STR_SWTYPES[config]);
|
lcdDrawText(30 + 5 * FW, y, STR_SWTYPES[config]);
|
||||||
|
|
||||||
if (config != SWITCH_NONE) {
|
if (config != SWITCH_NONE && config != SWITCH_GLOBAL) {
|
||||||
uint8_t group = FSWITCH_GROUP(index);
|
if (g_model.cfsName(index)[0]) {
|
||||||
|
char s[LEN_SWITCH_NAME + 1];
|
||||||
|
strAppend(s, g_model.cfsName(index), LEN_SWITCH_NAME);
|
||||||
|
lcdDrawText(35, y, s);
|
||||||
|
} else {
|
||||||
|
lcdDrawMMM(35, y, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t group = g_model.cfsGroup(index);
|
||||||
lcdDrawText(30 + 13 * FW, y, STR_FSGROUPS[group]);
|
lcdDrawText(30 + 13 * FW, y, STR_FSGROUPS[group]);
|
||||||
|
|
||||||
if (config != SWITCH_TOGGLE && group == 0) {
|
if (config != SWITCH_TOGGLE && group == 0) {
|
||||||
int startPos = FSWITCH_STARTUP(index);
|
int startPos = g_model.cfsStart(index);
|
||||||
lcdDrawText(30 + 15 * FW, y, _fct_sw_start[startPos]);
|
lcdDrawText(30 + 15 * FW, y, _fct_sw_start[startPos]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1024,6 +1080,7 @@ void menuModelSetup(event_t event)
|
|||||||
case ITEM_MODEL_SETUP_GROUP1_LABEL:
|
case ITEM_MODEL_SETUP_GROUP1_LABEL:
|
||||||
case ITEM_MODEL_SETUP_GROUP2_LABEL:
|
case ITEM_MODEL_SETUP_GROUP2_LABEL:
|
||||||
case ITEM_MODEL_SETUP_GROUP3_LABEL:
|
case ITEM_MODEL_SETUP_GROUP3_LABEL:
|
||||||
|
case ITEM_MODEL_SETUP_GROUP4_LABEL:
|
||||||
{
|
{
|
||||||
int group = (k - ITEM_MODEL_SETUP_GROUP1_LABEL) / 3 + 1;
|
int group = (k - ITEM_MODEL_SETUP_GROUP1_LABEL) / 3 + 1;
|
||||||
lcdDrawText(INDENT_WIDTH, y, STR_GROUP);
|
lcdDrawText(INDENT_WIDTH, y, STR_GROUP);
|
||||||
@@ -1034,13 +1091,14 @@ void menuModelSetup(event_t event)
|
|||||||
case ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON:
|
case ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON:
|
||||||
case ITEM_MODEL_SETUP_GROUP2_ALWAYS_ON:
|
case ITEM_MODEL_SETUP_GROUP2_ALWAYS_ON:
|
||||||
case ITEM_MODEL_SETUP_GROUP3_ALWAYS_ON:
|
case ITEM_MODEL_SETUP_GROUP3_ALWAYS_ON:
|
||||||
|
case ITEM_MODEL_SETUP_GROUP4_ALWAYS_ON:
|
||||||
{
|
{
|
||||||
uint8_t group = (k - ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON) / 3 + 1;
|
uint8_t group = (k - ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON) / 3 + 1;
|
||||||
lcdDrawText(INDENT_WIDTH * 2, y, STR_GROUP_ALWAYS_ON);
|
lcdDrawText(INDENT_WIDTH * 2, y, STR_GROUP_ALWAYS_ON);
|
||||||
int groupAlwaysOn = IS_FSWITCH_GROUP_ON(group);
|
int groupAlwaysOn = g_model.cfsGroupAlwaysOn(group);
|
||||||
groupAlwaysOn = editCheckBox(groupAlwaysOn, MODEL_SETUP_2ND_COLUMN, y, nullptr, attr, event);
|
groupAlwaysOn = editCheckBox(groupAlwaysOn, MODEL_SETUP_2ND_COLUMN, y, nullptr, attr, event);
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
SET_FSWITCH_GROUP_ON(group, groupAlwaysOn);
|
g_model.cfsSetGroupAlwaysOn(group, groupAlwaysOn);
|
||||||
setGroupSwitchState(group);
|
setGroupSwitchState(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1049,20 +1107,27 @@ void menuModelSetup(event_t event)
|
|||||||
case ITEM_MODEL_SETUP_GROUP1_START:
|
case ITEM_MODEL_SETUP_GROUP1_START:
|
||||||
case ITEM_MODEL_SETUP_GROUP2_START:
|
case ITEM_MODEL_SETUP_GROUP2_START:
|
||||||
case ITEM_MODEL_SETUP_GROUP3_START:
|
case ITEM_MODEL_SETUP_GROUP3_START:
|
||||||
|
case ITEM_MODEL_SETUP_GROUP4_START:
|
||||||
{
|
{
|
||||||
uint8_t group = (k - ITEM_MODEL_SETUP_GROUP1_START) / 3 + 1;
|
uint8_t group = (k - ITEM_MODEL_SETUP_GROUP1_START) / 3 + 1;
|
||||||
lcdDrawText(INDENT_WIDTH * 2, y, STR_START);
|
lcdDrawText(INDENT_WIDTH * 2, y, STR_START);
|
||||||
int sw = groupDefaultSwitch(group) + 1;
|
int sw = groupDefaultSwitch(group);
|
||||||
cfsGroup = group;
|
cfsGroup = group;
|
||||||
sw = editChoice(MODEL_SETUP_2ND_COLUMN + 1, y, nullptr, STR_FSSWITCHES, sw, 0, IS_FSWITCH_GROUP_ON(group) ? NUM_FUNCTIONS_SWITCHES : NUM_FUNCTIONS_SWITCHES + 1, attr, event, 0, checkCFSSwitchAvailable);
|
if (sw == -1)
|
||||||
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 1, y, "=", attr);
|
||||||
|
else if (sw == switchGetMaxSwitches())
|
||||||
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 1, y, STR_OFF, attr);
|
||||||
|
else
|
||||||
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 1, y, switchGetDefaultName(sw), attr);
|
||||||
|
sw = checkIncDec(event, sw, -1, switchGetMaxSwitches() - (g_model.cfsGroupAlwaysOn(group) ? 1 : 0), EE_MODEL, checkCFSSwitchAvailable);
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
for (int i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) {
|
for (int i = 0; i < switchGetMaxSwitches(); i += 1) {
|
||||||
if (FSWITCH_GROUP(i) == group) {
|
if (switchIsCustomSwitch(i) && g_model.cfsGroup(i) == group) {
|
||||||
FSWITCH_SET_STARTUP(i, sw ? FS_START_OFF : FS_START_PREVIOUS);
|
g_model.cfsSetStart(i, (sw >= 0) ? FS_START_OFF : FS_START_PREVIOUS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sw > 0 && sw <= NUM_FUNCTIONS_SWITCHES) {
|
if (sw >= 0 && sw < switchGetMaxSwitches()) {
|
||||||
FSWITCH_SET_STARTUP(sw - 1, FS_START_ON);
|
g_model.cfsSetStart(sw, FS_START_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1162,6 +1227,7 @@ void menuModelSetup(event_t event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM_MODEL_SETUP_SWITCHES_WARNING2:
|
case ITEM_MODEL_SETUP_SWITCHES_WARNING2:
|
||||||
|
case ITEM_MODEL_SETUP_SWITCHES_WARNING3:
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
if (IS_PREVIOUS_EVENT(event))
|
if (IS_PREVIOUS_EVENT(event))
|
||||||
menuVerticalOffset--;
|
menuVerticalOffset--;
|
||||||
@@ -1186,8 +1252,6 @@ void menuModelSetup(event_t event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
swarnstate_t states = g_model.switchWarning;
|
|
||||||
|
|
||||||
lcdDrawTextIndented(y, STR_SWITCHWARNING);
|
lcdDrawTextIndented(y, STR_SWITCHWARNING);
|
||||||
#if defined(PCBXLITE)
|
#if defined(PCBXLITE)
|
||||||
lcdDrawText(LCD_W, y, "<]", RIGHT);
|
lcdDrawText(LCD_W, y, "<]", RIGHT);
|
||||||
@@ -1213,17 +1277,15 @@ void menuModelSetup(event_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int current = 0;
|
int current = 0;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
||||||
if (event == EVT_KEY_BREAK(KEY_ENTER) && attr &&
|
if (event == EVT_KEY_BREAK(KEY_ENTER) && attr &&
|
||||||
l_posHorz == current && old_posHorz >= 0) {
|
l_posHorz == current && old_posHorz >= 0) {
|
||||||
uint8_t curr_state = (states & 0x07);
|
uint8_t curr_state = g_model.getSwitchWarning(i);
|
||||||
// remove old setting
|
|
||||||
g_model.switchWarning &= ~(0x07 << (3 * i));
|
|
||||||
// add the new one (if switch UP and 2POS, jump directly to DOWN)
|
// add the new one (if switch UP and 2POS, jump directly to DOWN)
|
||||||
curr_state += (curr_state != 1 || IS_CONFIG_3POS(i) ? 1 : 2);
|
curr_state += (curr_state != 1 || IS_CONFIG_3POS(i) ? 1 : 2);
|
||||||
g_model.switchWarning |= (curr_state & 0x03) << (3 * i);
|
g_model.setSwitchWarning(i, curr_state);
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
#if defined(PCBXLITE)
|
#if defined(PCBXLITE)
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
@@ -1235,10 +1297,9 @@ void menuModelSetup(event_t event)
|
|||||||
y + FH * qr.quot, switchGetLetter(i),
|
y + FH * qr.quot, switchGetLetter(i),
|
||||||
attr && (menuHorizontalPosition == current) ? INVERS : 0);
|
attr && (menuHorizontalPosition == current) ? INVERS : 0);
|
||||||
lcdDrawText(lcdNextPos, y + FH * qr.quot,
|
lcdDrawText(lcdNextPos, y + FH * qr.quot,
|
||||||
getSwitchWarnSymbol(states & 0x03));
|
getSwitchWarnSymbol(g_model.getSwitchWarning(i)));
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
states >>= 3;
|
|
||||||
}
|
}
|
||||||
if (attr && ((menuHorizontalPosition < 0) ||
|
if (attr && ((menuHorizontalPosition < 0) ||
|
||||||
menuHorizontalPosition >= switchWarningsCount)) {
|
menuHorizontalPosition >= switchWarningsCount)) {
|
||||||
|
|||||||
@@ -257,13 +257,13 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||||||
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_CHANS, attr);
|
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_CHANS, attr);
|
||||||
else
|
else
|
||||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, MIXSRC_FIRST_STICK + param - 1, attr);
|
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, MIXSRC_FIRST_STICK + param - 1, attr);
|
||||||
|
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_CH_INDEX(cfn), maxParam);
|
||||||
}
|
}
|
||||||
#if defined(GVARS)
|
#if defined(GVARS)
|
||||||
else if (func == FUNC_ADJUST_GVAR) {
|
else if (func == FUNC_ADJUST_GVAR) {
|
||||||
maxParam = MAX_GVARS - 1;
|
maxParam = MAX_GVARS - 1;
|
||||||
drawStringWithIndex(lcdNextPos + 2, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
|
drawStringWithIndex(lcdNextPos + 2, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
|
||||||
if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags);
|
if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
#endif // GVARS
|
#endif // GVARS
|
||||||
else if (func == FUNC_SET_TIMER) {
|
else if (func == FUNC_SET_TIMER) {
|
||||||
@@ -276,18 +276,17 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||||||
if (attr)
|
if (attr)
|
||||||
repeatLastCursorHorMove(event);
|
repeatLastCursorHorMove(event);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
else if (func == FUNC_PUSH_CUST_SWITCH) {
|
else if (func == FUNC_PUSH_CUST_SWITCH) {
|
||||||
maxParam = NUM_FUNCTIONS_SWITCHES - 1;
|
uint8_t sw = switchGetSwitchFromCustomIdx(CFN_CS_INDEX(cfn));
|
||||||
drawStringWithIndex(lcdNextPos +5, y, "SW", CFN_CS_INDEX(cfn) + 1, attr);
|
lcdDrawText(lcdNextPos + 5, y, switchGetDefaultName(sw), attr);
|
||||||
|
if (active) CFN_CS_INDEX(cfn) = switchGetCustomSwitchIdx(checkIncDec(event, sw, 0, switchGetMaxSwitches() - 1, eeFlags, switchIsCustomSwitch));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (attr) {
|
else if (attr) {
|
||||||
repeatLastCursorHorMove(event);
|
repeatLastCursorHorMove(event);
|
||||||
}
|
}
|
||||||
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_CH_INDEX(cfn), maxParam);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,21 +65,41 @@ void menuRadioDiagFS(event_t event)
|
|||||||
constexpr coord_t FS_3RD_COLUMN = 100;
|
constexpr coord_t FS_3RD_COLUMN = 100;
|
||||||
#endif
|
#endif
|
||||||
SIMPLE_SUBMENU(STR_MENU_FSWITCH, 1);
|
SIMPLE_SUBMENU(STR_MENU_FSWITCH, 1);
|
||||||
|
|
||||||
lcdDrawText(FS_1ST_COLUMN, MENU_HEADER_HEIGHT + 1, "Phys");
|
lcdDrawText(FS_1ST_COLUMN, MENU_HEADER_HEIGHT + 1, "Phys");
|
||||||
lcdDrawText(FS_2ND_COLUMN, MENU_HEADER_HEIGHT + 1, "Log");
|
lcdDrawText(FS_2ND_COLUMN, MENU_HEADER_HEIGHT + 1, "Log");
|
||||||
lcdDrawText(FS_3RD_COLUMN, MENU_HEADER_HEIGHT + 1, "Led");
|
lcdDrawText(FS_3RD_COLUMN, MENU_HEADER_HEIGHT + 1, "Led");
|
||||||
|
|
||||||
for(uint8_t i=0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
static uint8_t nxtSw = 0;
|
||||||
coord_t y = 2*FH + i*FH + 1;
|
static uint8_t ofst = 0;
|
||||||
lcdDrawTextIndented(y, STR_CHAR_SWITCH);
|
|
||||||
lcdDrawText(lcdNextPos, y, switchGetName(i+switchGetMaxSwitches()), 0);
|
if (event == EVT_ENTRY)
|
||||||
lcdDrawText(FS_1ST_COLUMN + 7, y, getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
ofst = 0;
|
||||||
lcdDrawText(FS_2ND_COLUMN + 5, y, getFSLogicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
|
||||||
|
for(uint8_t i=ofst, r=0; i < switchGetMaxSwitches(); i++) {
|
||||||
|
if (switchIsCustomSwitch(i)) {
|
||||||
|
if (r < 6) {
|
||||||
|
uint8_t sw = switchGetCustomSwitchIdx(i);
|
||||||
|
coord_t y = 2*FH + r*FH + 1;
|
||||||
|
lcdDrawTextIndented(y, STR_CHAR_SWITCH);
|
||||||
|
lcdDrawText(lcdNextPos, y, switchGetDefaultName(i));
|
||||||
|
lcdDrawText(FS_1ST_COLUMN + 7, y, getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||||
|
lcdDrawText(FS_2ND_COLUMN + 5, y, g_model.cfsState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
lcdDrawText(FS_3RD_COLUMN, y, STR_FS_COLOR_LIST[getRGBColorIndex(fsGetLedRGB(i))], 0);
|
lcdDrawText(FS_3RD_COLUMN, y, STR_FS_COLOR_LIST[getRGBColorIndex(rgbGetLedColor(sw))], 0);
|
||||||
#else
|
#else
|
||||||
lcdDrawText(FS_3RD_COLUMN, y, STR_OFFON[fsLedState(i)]);
|
lcdDrawText(FS_3RD_COLUMN, y, STR_OFFON[fsLedState(sw)]);
|
||||||
#endif
|
#endif
|
||||||
|
r += 1;
|
||||||
|
} else {
|
||||||
|
nxtSw = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nxtSw > 6 && event == EVT_KEY_BREAK(KEY_PAGEDN)) {
|
||||||
|
if (ofst == 0) ofst = nxtSw; else ofst = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -93,6 +113,8 @@ void menuRadioDiagKeys(event_t event)
|
|||||||
lcdDrawText(14*FW, 1, STR_VTRIM, INVERS);
|
lcdDrawText(14*FW, 1, STR_VTRIM, INVERS);
|
||||||
trim_yo = MENU_HEADER_HEIGHT + 1;
|
trim_yo = MENU_HEADER_HEIGHT + 1;
|
||||||
}
|
}
|
||||||
|
uint8_t sw_y = MENU_HEADER_HEIGHT + 1;
|
||||||
|
uint8_t sw_x = 8 * FW - 9;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 16; i++) {
|
for (uint8_t i = 0; i < 16; i++) {
|
||||||
coord_t y;
|
coord_t y;
|
||||||
@@ -131,13 +153,18 @@ void menuRadioDiagKeys(event_t event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < switchGetMaxSwitches()) {
|
if (i < switchGetMaxAllSwitches()) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i) && !switchIsCustomSwitch(i)) {
|
||||||
y = (i > 4) ? FH * (i - 4) + 1 : MENU_HEADER_HEIGHT + FH * i + 1;
|
|
||||||
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
|
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
|
||||||
getvalue_t sw =
|
getvalue_t sw =
|
||||||
((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
|
((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
|
||||||
drawSwitch(i > 4 ? 11 * FW - 5 : 8 * FW - 9, y, sw, 0, false);
|
drawSwitch(sw_x, sw_y, sw, 0, false);
|
||||||
|
if (i == 5) {
|
||||||
|
sw_x = 11 * FW - 5;
|
||||||
|
sw_y = MENU_HEADER_HEIGHT + 1;
|
||||||
|
} else {
|
||||||
|
sw_y += FH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ void drawSmallSwitch(coord_t x, coord_t y, int width, unsigned int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdDrawChar(width == 5 ? x + 1 : x, y, 'A' + index, SMLSIZE);
|
lcdDrawChar(width == 5 ? x + 1 : x, y, switchGetDefaultName(index)[1], SMLSIZE);
|
||||||
y += 7;
|
y += 7;
|
||||||
|
|
||||||
if (val <= 0) {
|
if (val <= 0) {
|
||||||
@@ -520,14 +520,25 @@ void menuMainView(event_t event)
|
|||||||
// -> 2 columns: one for each side
|
// -> 2 columns: one for each side
|
||||||
// -> 4 slots on each side
|
// -> 4 slots on each side
|
||||||
uint8_t maxSwitch = 0;
|
uint8_t maxSwitch = 0;
|
||||||
|
uint8_t leftMaxRow = 0;
|
||||||
|
uint8_t rightMaxRow = 0;
|
||||||
for (uint8_t n = 0; n < switchGetMaxSwitches(); n += 1)
|
for (uint8_t n = 0; n < switchGetMaxSwitches(); n += 1)
|
||||||
if (SWITCH_EXISTS(n) && !switchIsFlex(n))
|
if (SWITCH_EXISTS(n) && !switchIsFlex(n) && !switchIsCustomSwitch(n)) {
|
||||||
|
auto switch_display = switchGetDisplayPosition(n);
|
||||||
|
if (switch_display.col) {
|
||||||
|
if (switch_display.row > rightMaxRow)
|
||||||
|
rightMaxRow = switch_display.row;
|
||||||
|
} else {
|
||||||
|
if (switch_display.row > leftMaxRow)
|
||||||
|
leftMaxRow = switch_display.row;
|
||||||
|
}
|
||||||
maxSwitch = n + 1;
|
maxSwitch = n + 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < maxSwitch; ++i) {
|
if (leftMaxRow < 3 && rightMaxRow < 3) {
|
||||||
if (SWITCH_EXISTS(i) && !switchIsFlex(i)) {
|
for (int i = 0; i < maxSwitch; ++i) {
|
||||||
auto switch_display = switchGetDisplayPosition(i);
|
if (SWITCH_EXISTS(i) && !switchIsFlex(i) && !switchIsCustomSwitch(i)) {
|
||||||
if (maxSwitch < 7) {
|
auto switch_display = switchGetDisplayPosition(i);
|
||||||
coord_t x = switch_display.col == 0 ? 3 * FW + 3 : 18 * FW + 1;
|
coord_t x = switch_display.col == 0 ? 3 * FW + 3 : 18 * FW + 1;
|
||||||
coord_t y = 33 + switch_display.row * FH;
|
coord_t y = 33 + switch_display.row * FH;
|
||||||
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
|
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
|
||||||
@@ -537,9 +548,14 @@ void menuMainView(event_t event)
|
|||||||
: ((val == 0) ? 3 * i + 2 : 3 * i + 3));
|
: ((val == 0) ? 3 * i + 2 : 3 * i + 3));
|
||||||
drawSwitch(x, y, sw, CENTERED, false);
|
drawSwitch(x, y, sw, CENTERED, false);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int i = 0; i < maxSwitch; ++i) {
|
||||||
|
if (SWITCH_EXISTS(i) && !switchIsFlex(i) && !switchIsCustomSwitch(i)) {
|
||||||
|
auto switch_display = switchGetDisplayPosition(i);
|
||||||
coord_t x = (switch_display.col == 0 ? 8 : 96) + switch_display.row * 5;
|
coord_t x = (switch_display.col == 0 ? 8 : 96) + switch_display.row * 5;
|
||||||
if (maxSwitch < 9) x += (switch_display.col == 0 ? 2 : 3);
|
if (maxSwitch < 9) x += 3;
|
||||||
drawSmallSwitch(x, 5 * FH + 1, 4, i);
|
drawSmallSwitch(x, 5 * FH + 1, 4, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ uint8_t g_moduleIdx;
|
|||||||
uint8_t getSwitchWarningsCount()
|
uint8_t getSwitchWarningsCount()
|
||||||
{
|
{
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); ++i) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); ++i) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@@ -870,7 +870,6 @@ void menuModelSetup(event_t event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
lcdDrawTextIndented(y, STR_SWITCHWARNING);
|
lcdDrawTextIndented(y, STR_SWITCHWARNING);
|
||||||
swarnstate_t states = g_model.switchWarning;
|
|
||||||
|
|
||||||
if (attr) {
|
if (attr) {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
@@ -888,17 +887,15 @@ void menuModelSetup(event_t event)
|
|||||||
LcdFlags line = attr;
|
LcdFlags line = attr;
|
||||||
|
|
||||||
int current = 0;
|
int current = 0;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, 8);
|
div_t qr = div(current, 8);
|
||||||
if (event == EVT_KEY_BREAK(KEY_ENTER) && line &&
|
if (event == EVT_KEY_BREAK(KEY_ENTER) && line &&
|
||||||
l_posHorz == current) {
|
l_posHorz == current) {
|
||||||
uint8_t curr_state = (states & 0x07);
|
uint8_t curr_state = g_model.getSwitchWarning(i);
|
||||||
// remove old setting
|
|
||||||
g_model.switchWarning &= ~(0x07 << (3 * i));
|
|
||||||
// add the new one (if switch UP and 2POS, jump directly to DOWN)
|
// add the new one (if switch UP and 2POS, jump directly to DOWN)
|
||||||
curr_state += (curr_state != 1 || IS_CONFIG_3POS(i) ? 1 : 2);
|
curr_state += (curr_state != 1 || IS_CONFIG_3POS(i) ? 1 : 2);
|
||||||
g_model.switchWarning |= (curr_state & 0x03) << (3 * i);
|
g_model.setSwitchWarning(i, curr_state);
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
lcdDrawChar(
|
lcdDrawChar(
|
||||||
@@ -906,10 +903,9 @@ void menuModelSetup(event_t event)
|
|||||||
y + FH * qr.quot, 'A' + i,
|
y + FH * qr.quot, 'A' + i,
|
||||||
line && (menuHorizontalPosition == current) ? INVERS : 0);
|
line && (menuHorizontalPosition == current) ? INVERS : 0);
|
||||||
lcdDrawText(lcdNextPos, y + FH * qr.quot,
|
lcdDrawText(lcdNextPos, y + FH * qr.quot,
|
||||||
getSwitchWarnSymbol(states & 0x03));
|
getSwitchWarnSymbol(g_model.getSwitchWarning(i)));
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
states >>= 3;
|
|
||||||
}
|
}
|
||||||
if (attr && menuHorizontalPosition < 0) {
|
if (attr && menuHorizontalPosition < 0) {
|
||||||
#if defined(PCBX9E)
|
#if defined(PCBX9E)
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ endif()
|
|||||||
|
|
||||||
if(FUNCTION_SWITCHES)
|
if(FUNCTION_SWITCHES)
|
||||||
add_gui_src(model/function_switches.cpp)
|
add_gui_src(model/function_switches.cpp)
|
||||||
|
add_gui_src(radio/radio_cfs.cpp)
|
||||||
add_gui_src(radio/radio_diagcustswitches.cpp)
|
add_gui_src(radio/radio_diagcustswitches.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -59,15 +59,14 @@ void SwitchWarnDialog::checkEvents()
|
|||||||
FullScreenDialog::checkEvents();
|
FullScreenDialog::checkEvents();
|
||||||
|
|
||||||
std::string warn_txt;
|
std::string warn_txt;
|
||||||
swarnstate_t states = g_model.switchWarning;
|
for (int i = 0; i < switchGetMaxAllSwitches(); ++i) {
|
||||||
for (int i = 0; i < MAX_SWITCHES; ++i) {
|
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t)0x07 << (i * 3));
|
uint8_t warnState = g_model.getSwitchWarning(i);
|
||||||
if (states & mask) {
|
if (warnState) {
|
||||||
if ((switches_states & mask) != (states & mask)) {
|
swarnstate_t swState = g_model.getSwitchStateForWarning(i);
|
||||||
swarnstate_t state = (states >> (i * 3)) & 0x07;
|
if (warnState != swState) {
|
||||||
warn_txt +=
|
warn_txt +=
|
||||||
getSwitchPositionName(SWSRC_FIRST_SWITCH + i * 3 + state - 1);
|
getSwitchPositionName(SWSRC_FIRST_SWITCH + i * 3 + warnState - 1);
|
||||||
warn_txt += " ";
|
warn_txt += " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,15 +24,16 @@
|
|||||||
#include "function_switches.h"
|
#include "function_switches.h"
|
||||||
|
|
||||||
#include "edgetx.h"
|
#include "edgetx.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
#include "strhelpers.h"
|
#include "strhelpers.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
#include "color_picker.h"
|
#include "color_picker.h"
|
||||||
|
|
||||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||||
|
|
||||||
static const char* _fct_sw_start[] = {STR_CHAR_DOWN, STR_CHAR_UP, STR_LAST};
|
const char* _fct_sw_start[] = {STR_CHAR_UP, STR_CHAR_DOWN, STR_LAST};
|
||||||
|
|
||||||
const std::string edgetx_fs_manual_url =
|
const char* edgetx_fs_manual_url =
|
||||||
"https://edgetx.gitbook.io/edgetx-user-manual/b-and-w-radios/model-select/"
|
"https://edgetx.gitbook.io/edgetx-user-manual/b-and-w-radios/model-select/"
|
||||||
"setup#function-switches";
|
"setup#function-switches";
|
||||||
|
|
||||||
@@ -45,65 +46,70 @@ class FunctionSwitch : public Window
|
|||||||
padAll(PAD_TINY);
|
padAll(PAD_TINY);
|
||||||
|
|
||||||
std::string s(STR_CHAR_SWITCH);
|
std::string s(STR_CHAR_SWITCH);
|
||||||
s += switchGetName(switchIndex + switchGetMaxSwitches());
|
s += switchGetDefaultName(switchIndex);
|
||||||
|
|
||||||
new StaticText(this, {PAD_LARGE, PAD_MEDIUM, SW_W, EdgeTxStyles::STD_FONT_HEIGHT}, s);
|
new StaticText(this, {PAD_LARGE, PAD_MEDIUM, SW_W, EdgeTxStyles::STD_FONT_HEIGHT}, s);
|
||||||
|
|
||||||
new ModelTextEdit(this, {NM_X, 0, NM_W, 0},
|
new ModelTextEdit(this, {NM_X, 0, NM_W, 0},
|
||||||
g_model.switchNames[switchIndex], LEN_SWITCH_NAME);
|
g_model.cfsName(switchIndex), LEN_SWITCH_NAME);
|
||||||
|
|
||||||
typeChoice = new Choice(
|
typeChoice = new Choice(
|
||||||
this, {TP_X, 0, TP_W, 0}, STR_SWTYPES, SWITCH_NONE, SWITCH_2POS,
|
this, {TP_X, 0, TP_W, 0}, STR_SWTYPES, SWITCH_NONE, SWITCH_GLOBAL,
|
||||||
[=]() { return FSWITCH_CONFIG(switchIndex); },
|
[=]() { return g_model.cfsType(switchIndex); },
|
||||||
[=](int val) {
|
[=](int val) {
|
||||||
FSWITCH_SET_CONFIG(switchIndex, val);
|
g_model.cfsSetType(switchIndex, (SwitchConfig)val);
|
||||||
if (val == SWITCH_TOGGLE) {
|
if (val == SWITCH_NONE) {
|
||||||
FSWITCH_SET_STARTUP(switchIndex, FS_START_PREVIOUS);
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
fsLedRGB(switchGetCustomSwitchIdx(switchIndex), 0);
|
||||||
|
#endif
|
||||||
|
} else if (val == SWITCH_TOGGLE) {
|
||||||
|
g_model.cfsSetStart(switchIndex, FS_START_PREVIOUS);
|
||||||
setFSLogicalState(switchIndex, 0);
|
setFSLogicalState(switchIndex, 0);
|
||||||
startChoice->setValue(startChoice->getIntValue());
|
startChoice->setValue(startChoice->getIntValue());
|
||||||
}
|
}
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
});
|
});
|
||||||
typeChoice->setAvailableHandler([=](int typ) -> bool {
|
typeChoice->setAvailableHandler([=](int typ) -> bool {
|
||||||
int group = FSWITCH_GROUP(switchIndex);
|
if (typ == SWITCH_3POS) return false;
|
||||||
if (group > 0 && IS_FSWITCH_GROUP_ON(group) && typ == SWITCH_TOGGLE)
|
int group = g_model.cfsGroup(switchIndex);
|
||||||
|
if (group > 0 && g_model.cfsGroupAlwaysOn(group) && typ == SWITCH_TOGGLE)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
groupChoice = new Choice(
|
groupChoice = new Choice(
|
||||||
this, {GR_X, 0, GR_W, 0}, STR_FUNCTION_SWITCH_GROUPS, 0, 3,
|
this, {GR_X, 0, GR_W, 0}, STR_FUNCTION_SWITCH_GROUPS, 0, 3,
|
||||||
[=]() { return FSWITCH_GROUP(switchIndex); },
|
[=]() { return g_model.cfsGroup(switchIndex); },
|
||||||
[=](int group) {
|
[=](int group) {
|
||||||
int oldGroup = FSWITCH_GROUP(switchIndex);
|
int oldGroup = g_model.cfsGroup(switchIndex);
|
||||||
if (groupHasSwitchOn(group)) setFSLogicalState(switchIndex, 0);
|
if (groupHasSwitchOn(group)) setFSLogicalState(switchIndex, 0);
|
||||||
FSWITCH_SET_GROUP(switchIndex, group);
|
g_model.cfsSetGroup(switchIndex, group);
|
||||||
if (group > 0) {
|
if (group > 0) {
|
||||||
FSWITCH_SET_STARTUP(switchIndex, groupDefaultSwitch(group) == -1
|
g_model.cfsSetStart(switchIndex, groupDefaultSwitch(group) == -1
|
||||||
? FS_START_PREVIOUS
|
? FS_START_PREVIOUS
|
||||||
: FS_START_OFF);
|
: FS_START_OFF);
|
||||||
if (FSWITCH_CONFIG(switchIndex) == SWITCH_TOGGLE &&
|
if (g_model.cfsType(switchIndex) == SWITCH_TOGGLE &&
|
||||||
IS_FSWITCH_GROUP_ON(group))
|
g_model.cfsGroupAlwaysOn(group))
|
||||||
FSWITCH_SET_CONFIG(switchIndex, SWITCH_2POS);
|
g_model.cfsSetType(switchIndex, SWITCH_2POS);
|
||||||
setGroupSwitchState(group, switchIndex);
|
setGroupSwitchState(group);
|
||||||
} else {
|
} else {
|
||||||
FSWITCH_SET_STARTUP(switchIndex, FS_START_PREVIOUS);
|
g_model.cfsSetStart(switchIndex, FS_START_PREVIOUS);
|
||||||
}
|
}
|
||||||
setGroupSwitchState(oldGroup);
|
setGroupSwitchState(oldGroup);
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
});
|
});
|
||||||
groupChoice->setAvailableHandler([=](int group) -> bool {
|
groupChoice->setAvailableHandler([=](int group) -> bool {
|
||||||
if (FSWITCH_CONFIG(switchIndex) == SWITCH_TOGGLE && group &&
|
if (g_model.cfsType(switchIndex) == SWITCH_TOGGLE && group &&
|
||||||
IS_FSWITCH_GROUP_ON(group))
|
g_model.cfsGroupAlwaysOn(group))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
startChoice = new Choice(
|
startChoice = new Choice(
|
||||||
this, {ST_X, 0, ST_W, 0}, _fct_sw_start, 0, 2,
|
this, {ST_X, 0, ST_W, 0}, _fct_sw_start, 0, 2,
|
||||||
[=]() { return FSWITCH_STARTUP(switchIndex); },
|
[=]() { return g_model.cfsStart(switchIndex); },
|
||||||
[=](int val) {
|
[=](int val) {
|
||||||
FSWITCH_SET_STARTUP(switchIndex, val);
|
g_model.cfsSetStart(switchIndex, (fsStartPositionType)val);
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -113,23 +119,23 @@ class FunctionSwitch : public Window
|
|||||||
new StaticText(this, rect_t{C2_X - C2_W - PAD_TINY, C2_Y + PAD_SMALL, C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT);
|
new StaticText(this, rect_t{C2_X - C2_W - PAD_TINY, C2_Y + PAD_SMALL, C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
offValue = g_model.functionSwitchLedOFFColor[switchIndex];
|
offValue = g_model.cfsOffColor(switchIndex);
|
||||||
onValue = g_model.functionSwitchLedONColor[switchIndex];
|
onValue = g_model.cfsOnColor(switchIndex);
|
||||||
|
|
||||||
offColor = new ColorPicker(
|
offColor = new ColorPicker(
|
||||||
this, {C1_X, C1_Y, C1_W, 0},
|
this, {C1_X, C1_Y, C1_W, 0},
|
||||||
[=]() -> int { // getValue
|
[=]() -> int { // getValue
|
||||||
return g_model.functionSwitchLedOFFColor[switchIndex].getColor() | RGB888_FLAG;
|
return g_model.cfsOffColor(switchIndex).getColor() | RGB888_FLAG;
|
||||||
},
|
},
|
||||||
[=](int newValue) { // setValue
|
[=](int newValue) { // setValue
|
||||||
g_model.functionSwitchLedOFFColor[switchIndex] = offValue;
|
g_model.cfsOffColor(switchIndex) = offValue;
|
||||||
g_model.functionSwitchLedONColor[switchIndex] = onValue;
|
g_model.cfsOnColor(switchIndex) = onValue;
|
||||||
|
|
||||||
// Convert color index to RGB
|
// Convert color index to RGB
|
||||||
newValue = color32ToRGB(newValue);
|
newValue = color32ToRGB(newValue);
|
||||||
g_model.functionSwitchLedOFFColor[switchIndex].setColor(newValue);
|
g_model.cfsOffColor(switchIndex).setColor(newValue);
|
||||||
|
|
||||||
offValue = g_model.functionSwitchLedOFFColor[switchIndex];
|
offValue = g_model.cfsOffColor(switchIndex);
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
},
|
},
|
||||||
[=](int newValue) { previewColor(newValue); }, ETX_RGB888);
|
[=](int newValue) { previewColor(newValue); }, ETX_RGB888);
|
||||||
@@ -137,20 +143,29 @@ class FunctionSwitch : public Window
|
|||||||
onColor = new ColorPicker(
|
onColor = new ColorPicker(
|
||||||
this, {C2_X, C2_Y, C2_W, 0},
|
this, {C2_X, C2_Y, C2_W, 0},
|
||||||
[=]() -> int { // getValue
|
[=]() -> int { // getValue
|
||||||
return g_model.functionSwitchLedONColor[switchIndex].getColor() | RGB888_FLAG;
|
return g_model.cfsOnColor(switchIndex).getColor() | RGB888_FLAG;
|
||||||
},
|
},
|
||||||
[=](int newValue) { // setValue
|
[=](int newValue) { // setValue
|
||||||
g_model.functionSwitchLedOFFColor[switchIndex] = offValue;
|
g_model.cfsOffColor(switchIndex) = offValue;
|
||||||
g_model.functionSwitchLedONColor[switchIndex] = onValue;
|
g_model.cfsOnColor(switchIndex) = onValue;
|
||||||
|
|
||||||
// Convert color index to RGB
|
// Convert color index to RGB
|
||||||
newValue = color32ToRGB(newValue);
|
newValue = color32ToRGB(newValue);
|
||||||
g_model.functionSwitchLedONColor[switchIndex].setColor(newValue);
|
g_model.cfsOnColor(switchIndex).setColor(newValue);
|
||||||
|
|
||||||
onValue = g_model.functionSwitchLedONColor[switchIndex];
|
onValue = g_model.cfsOnColor(switchIndex);
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
},
|
},
|
||||||
[=](int newValue) { previewColor(newValue); }, ETX_RGB888);
|
[=](int newValue) { previewColor(newValue); }, ETX_RGB888);
|
||||||
|
|
||||||
|
overrideLabel = new StaticText(this, {GR_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_LARGE, GR_W + ST_W - PAD_LARGE, 0},
|
||||||
|
STR_LUA_OVERRIDE, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT);
|
||||||
|
offOverride = new ToggleSwitch(this, {C1_X - PAD_MEDIUM * 2, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0},
|
||||||
|
[=]() { return g_model.cfsOffColorLuaOverride(switchIndex); },
|
||||||
|
[=](bool v) { g_model.cfsSetOffColorLuaOverride(switchIndex, v); });
|
||||||
|
onOverride = new ToggleSwitch(this, {C2_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0},
|
||||||
|
[=]() { return g_model.cfsOnColorLuaOverride(switchIndex); },
|
||||||
|
[=](bool v) { g_model.cfsSetOnColorLuaOverride(switchIndex, v); });
|
||||||
#endif //FUNCTION_SWITCHES_RGB_LEDS
|
#endif //FUNCTION_SWITCHES_RGB_LEDS
|
||||||
|
|
||||||
setState();
|
setState();
|
||||||
@@ -167,7 +182,7 @@ class FunctionSwitch : public Window
|
|||||||
static constexpr coord_t ST_X = GR_X + GR_W + PAD_SMALL;
|
static constexpr coord_t ST_X = GR_X + GR_W + PAD_SMALL;
|
||||||
static LAYOUT_VAL_SCALED(ST_W, 60)
|
static LAYOUT_VAL_SCALED(ST_W, 60)
|
||||||
#if NARROW_LAYOUT
|
#if NARROW_LAYOUT
|
||||||
static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 2 + PAD_OUTLINE * 3;
|
static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 3 + PAD_OUTLINE * 4;
|
||||||
static constexpr coord_t C1_X = TP_X;
|
static constexpr coord_t C1_X = TP_X;
|
||||||
static constexpr coord_t C1_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE;
|
static constexpr coord_t C1_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE;
|
||||||
static LAYOUT_VAL_SCALED(C1_W, 40)
|
static LAYOUT_VAL_SCALED(C1_W, 40)
|
||||||
@@ -175,7 +190,7 @@ class FunctionSwitch : public Window
|
|||||||
static constexpr coord_t C2_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE;
|
static constexpr coord_t C2_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE;
|
||||||
static LAYOUT_VAL_SCALED(C2_W, 40)
|
static LAYOUT_VAL_SCALED(C2_W, 40)
|
||||||
#else
|
#else
|
||||||
static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE * 2;
|
static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 2 + PAD_OUTLINE * 3;
|
||||||
static constexpr coord_t C1_X = ST_X + ST_W + PAD_SMALL;
|
static constexpr coord_t C1_X = ST_X + ST_W + PAD_SMALL;
|
||||||
static constexpr coord_t C1_Y = 0;
|
static constexpr coord_t C1_Y = 0;
|
||||||
static LAYOUT_VAL_SCALED(C1_W, 40)
|
static LAYOUT_VAL_SCALED(C1_W, 40)
|
||||||
@@ -206,6 +221,9 @@ class FunctionSwitch : public Window
|
|||||||
ColorPicker* onColor = nullptr;
|
ColorPicker* onColor = nullptr;
|
||||||
RGBLedColor offValue;
|
RGBLedColor offValue;
|
||||||
RGBLedColor onValue;
|
RGBLedColor onValue;
|
||||||
|
StaticText* overrideLabel = nullptr;
|
||||||
|
ToggleSwitch* onOverride = nullptr;
|
||||||
|
ToggleSwitch* offOverride = nullptr;
|
||||||
#endif
|
#endif
|
||||||
int lastType = -1;
|
int lastType = -1;
|
||||||
|
|
||||||
@@ -214,29 +232,37 @@ class FunctionSwitch : public Window
|
|||||||
{
|
{
|
||||||
// Convert color index to RGB
|
// Convert color index to RGB
|
||||||
newValue = color32ToRGB(newValue);
|
newValue = color32ToRGB(newValue);
|
||||||
if (getFSLogicalState(switchIndex)) {
|
if (g_model.cfsState(switchIndex)) {
|
||||||
g_model.functionSwitchLedONColor[switchIndex].setColor(newValue);
|
g_model.cfsOnColor(switchIndex).setColor(newValue);
|
||||||
} else {
|
} else {
|
||||||
g_model.functionSwitchLedOFFColor[switchIndex].setColor(newValue);
|
g_model.cfsOffColor(switchIndex).setColor(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setState()
|
void setState()
|
||||||
{
|
{
|
||||||
startChoice->show(FSWITCH_CONFIG(switchIndex) == SWITCH_2POS && FSWITCH_GROUP(switchIndex) == 0);
|
uint8_t typ = g_model.cfsType(switchIndex);
|
||||||
groupChoice->show(FSWITCH_CONFIG(switchIndex) != SWITCH_NONE);
|
startChoice->show(typ == SWITCH_2POS && g_model.cfsGroup(switchIndex) == 0);
|
||||||
|
groupChoice->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
offColor->show(FSWITCH_CONFIG(switchIndex) != SWITCH_NONE);
|
offColor->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
onColor->show(FSWITCH_CONFIG(switchIndex) != SWITCH_NONE);
|
onColor->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
overrideLabel->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
onOverride->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
offOverride->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
if (typ != SWITCH_NONE && typ != SWITCH_GLOBAL)
|
||||||
|
setHeight(ROW_H);
|
||||||
|
else
|
||||||
|
setHeight(ROW_H - EdgeTxStyles::UI_ELEMENT_HEIGHT - PAD_OUTLINE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents() override
|
void checkEvents() override
|
||||||
{
|
{
|
||||||
setState();
|
setState();
|
||||||
if (lastType != (int)FSWITCH_CONFIG(switchIndex)) {
|
if (lastType != (int)g_model.cfsType(switchIndex)) {
|
||||||
lastType = FSWITCH_CONFIG(switchIndex);
|
lastType = g_model.cfsType(switchIndex);
|
||||||
typeChoice->setValue(lastType);
|
typeChoice->setValue(lastType);
|
||||||
}
|
}
|
||||||
Window::checkEvents();
|
Window::checkEvents();
|
||||||
@@ -256,38 +282,43 @@ class SwitchGroup : public Window
|
|||||||
|
|
||||||
auto btn = new TextButton(
|
auto btn = new TextButton(
|
||||||
this, {AO_X, 0, AO_W, 0}, STR_GROUP_ALWAYS_ON, [=]() -> int8_t {
|
this, {AO_X, 0, AO_W, 0}, STR_GROUP_ALWAYS_ON, [=]() -> int8_t {
|
||||||
int groupAlwaysOn = IS_FSWITCH_GROUP_ON(groupIndex);
|
int groupAlwaysOn = g_model.cfsGroupAlwaysOn(groupIndex);
|
||||||
groupAlwaysOn ^= 1;
|
groupAlwaysOn ^= 1;
|
||||||
SET_FSWITCH_GROUP_ON(groupIndex, groupAlwaysOn);
|
g_model.cfsSetGroupAlwaysOn(groupIndex, groupAlwaysOn);
|
||||||
setGroupSwitchState(groupIndex);
|
setGroupSwitchState(groupIndex);
|
||||||
startChoice->setValue(startChoice->getIntValue());
|
startChoice->setValue(startChoice->getIntValue());
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
return groupAlwaysOn;
|
return groupAlwaysOn;
|
||||||
});
|
});
|
||||||
btn->check(IS_FSWITCH_GROUP_ON(groupIndex));
|
btn->check(g_model.cfsGroupAlwaysOn(groupIndex));
|
||||||
|
|
||||||
new StaticText(this, {SL_X, PAD_MEDIUM, SL_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_SWITCH_STARTUP);
|
new StaticText(this, {SL_X, PAD_MEDIUM, SL_W, EdgeTxStyles::STD_FONT_HEIGHT}, STR_SWITCH_STARTUP);
|
||||||
|
|
||||||
startChoice = new Choice(
|
startChoice = new Choice(
|
||||||
this, {ST_X, 0, ST_W, 0}, STR_FSSWITCHES, 0,
|
this, {ST_X, 0, ST_W, 0}, 0, switchGetMaxSwitches() + 1,
|
||||||
NUM_FUNCTIONS_SWITCHES + 1,
|
|
||||||
[=]() { return groupDefaultSwitch(groupIndex) + 1; },
|
[=]() { return groupDefaultSwitch(groupIndex) + 1; },
|
||||||
[=](int sw) {
|
[=](int sw) {
|
||||||
for (int i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) {
|
for (int i = 0; i < switchGetMaxSwitches(); i += 1) {
|
||||||
if (FSWITCH_GROUP(i) == groupIndex) {
|
if (switchIsCustomSwitch(i) && g_model.cfsGroup(i) == groupIndex) {
|
||||||
FSWITCH_SET_STARTUP(i, sw ? FS_START_OFF : FS_START_PREVIOUS);
|
g_model.cfsSetStart(i, (sw > 0) ? FS_START_OFF : FS_START_PREVIOUS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sw > 0 && sw <= NUM_FUNCTIONS_SWITCHES) {
|
if (sw > 0 && sw <= switchGetMaxSwitches()) {
|
||||||
FSWITCH_SET_STARTUP(sw - 1, FS_START_ON);
|
g_model.cfsSetStart(sw - 1, FS_START_ON);
|
||||||
}
|
}
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
});
|
});
|
||||||
|
startChoice->setTextHandler([=](int sw) -> std::string {
|
||||||
|
if (sw == 0)
|
||||||
|
return "=";
|
||||||
|
if (sw == switchGetMaxSwitches() + 1)
|
||||||
|
return STR_OFF;
|
||||||
|
return switchGetDefaultName(sw - 1);
|
||||||
|
});
|
||||||
startChoice->setAvailableHandler([=](int sw) -> bool {
|
startChoice->setAvailableHandler([=](int sw) -> bool {
|
||||||
return (sw == 0) ||
|
return (sw == 0) ||
|
||||||
(sw == NUM_FUNCTIONS_SWITCHES + 1 &&
|
(sw == switchGetMaxSwitches() + 1 && !g_model.cfsGroupAlwaysOn(groupIndex)) ||
|
||||||
!IS_FSWITCH_GROUP_ON(groupIndex)) ||
|
(switchIsCustomSwitch(sw - 1) && g_model.cfsGroup(sw - 1) == groupIndex);
|
||||||
(FSWITCH_GROUP(sw - 1) == groupIndex);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,8 +362,9 @@ ModelFunctionSwitches::ModelFunctionSwitches() : Page(ICON_MODEL_SETUP)
|
|||||||
new StaticText(box, rect_t{FunctionSwitch::C2_X + PAD_OUTLINE, 0, FunctionSwitch::C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
new StaticText(box, rect_t{FunctionSwitch::C2_X + PAD_OUTLINE, 0, FunctionSwitch::C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) {
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i += 1) {
|
||||||
new FunctionSwitch(body, i);
|
if (switchIsCustomSwitch(i))
|
||||||
|
new FunctionSwitch(body, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 1; i <= 3; i += 1) {
|
for (uint8_t i = 1; i <= 3; i += 1) {
|
||||||
@@ -349,8 +381,7 @@ ModelFunctionSwitches::ModelFunctionSwitches() : Page(ICON_MODEL_SETUP)
|
|||||||
auto qr = lv_qrcode_create(box->getLvObj(), 150,
|
auto qr = lv_qrcode_create(box->getLvObj(), 150,
|
||||||
makeLvColor(COLOR_THEME_SECONDARY1),
|
makeLvColor(COLOR_THEME_SECONDARY1),
|
||||||
makeLvColor(COLOR_THEME_SECONDARY3));
|
makeLvColor(COLOR_THEME_SECONDARY3));
|
||||||
lv_qrcode_update(qr, edgetx_fs_manual_url.c_str(),
|
lv_qrcode_update(qr, edgetx_fs_manual_url, strlen(edgetx_fs_manual_url));
|
||||||
edgetx_fs_manual_url.length());
|
|
||||||
lv_obj_set_pos(qr, (LCD_W - 150) / 2, EdgeTxStyles::STD_FONT_HEIGHT);
|
lv_obj_set_pos(qr, (LCD_W - 150) / 2, EdgeTxStyles::STD_FONT_HEIGHT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class SwitchWarnMatrix : public ButtonMatrix
|
|||||||
{
|
{
|
||||||
// Setup button layout & texts
|
// Setup button layout & texts
|
||||||
uint8_t btn_cnt = 0;
|
uint8_t btn_cnt = 0;
|
||||||
for (uint8_t i = 0; i < MAX_SWITCHES; i++) {
|
for (uint8_t i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
sw_idx[btn_cnt] = i;
|
sw_idx[btn_cnt] = i;
|
||||||
btn_cnt++;
|
btn_cnt++;
|
||||||
@@ -66,17 +66,16 @@ class SwitchWarnMatrix : public ButtonMatrix
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btn_id >= MAX_SWITCHES) return;
|
if (btn_id >= switchGetMaxAllSwitches()) return;
|
||||||
auto sw = sw_idx[btn_id];
|
auto sw = sw_idx[btn_id];
|
||||||
|
|
||||||
swarnstate_t newstate = bfGet(g_model.switchWarning, 3 * sw, 3);
|
uint8_t newstate = g_model.getSwitchWarning(sw);
|
||||||
if (newstate == 1 && SWITCH_CONFIG(sw) != SWITCH_3POS)
|
if (newstate == 1 && g_model.getSwitchType(sw) != SWITCH_3POS)
|
||||||
newstate = 3;
|
newstate = 3;
|
||||||
else
|
else
|
||||||
newstate = (newstate + 1) % 4;
|
newstate = (newstate + 1) & 3;
|
||||||
|
|
||||||
g_model.switchWarning =
|
g_model.setSwitchWarning(sw, newstate);
|
||||||
bfSet(g_model.switchWarning, newstate, 3 * sw, 3);
|
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
|
|
||||||
setTextAndState(btn_id);
|
setTextAndState(btn_id);
|
||||||
@@ -84,15 +83,15 @@ class SwitchWarnMatrix : public ButtonMatrix
|
|||||||
|
|
||||||
bool isActive(uint8_t btn_id) override
|
bool isActive(uint8_t btn_id) override
|
||||||
{
|
{
|
||||||
if (btn_id >= MAX_SWITCHES) return false;
|
if (btn_id >= switchGetMaxAllSwitches()) return false;
|
||||||
return bfGet(g_model.switchWarning, 3 * sw_idx[btn_id], 3) != 0;
|
return g_model.getSwitchWarning(sw_idx[btn_id]) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTextAndState(uint8_t btn_id)
|
void setTextAndState(uint8_t btn_id)
|
||||||
{
|
{
|
||||||
swsrc_t index = sw_idx[btn_id];
|
swsrc_t index = sw_idx[btn_id];
|
||||||
auto warn_pos = g_model.switchWarning >> (3 * index) & 0x07;
|
auto warn_pos = g_model.getSwitchWarning(index);
|
||||||
std::string s = std::string(switchGetName(index)) +
|
std::string s = std::string(switchGetDefaultName(index)) +
|
||||||
std::string(getSwitchWarnSymbol(warn_pos));
|
std::string(getSwitchWarnSymbol(warn_pos));
|
||||||
setText(btn_id, s.c_str());
|
setText(btn_id, s.c_str());
|
||||||
setChecked(btn_id);
|
setChecked(btn_id);
|
||||||
@@ -109,7 +108,7 @@ class SwitchWarnMatrix : public ButtonMatrix
|
|||||||
void setAllState()
|
void setAllState()
|
||||||
{
|
{
|
||||||
uint8_t btn_id = 0;
|
uint8_t btn_id = 0;
|
||||||
for (uint8_t i = 0; i < MAX_SWITCHES; i++) {
|
for (uint8_t i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
setTextAndState(btn_id);
|
setTextAndState(btn_id);
|
||||||
btn_id++;
|
btn_id++;
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void FunctionLineButton::refresh()
|
|||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
case FUNC_PUSH_CUST_SWITCH:
|
case FUNC_PUSH_CUST_SWITCH:
|
||||||
sprintf(s + strlen(s), "%s%d", STR_SWITCH, CFN_CS_INDEX(cfn) + 1);
|
strAppend(s + strlen(s), switchGetDefaultName(switchGetSwitchFromCustomIdx(CFN_CS_INDEX(cfn))));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -505,10 +505,15 @@ void FunctionEditPage::updateSpecialFunctionOneWindow()
|
|||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
case FUNC_PUSH_CUST_SWITCH: {
|
case FUNC_PUSH_CUST_SWITCH: {
|
||||||
new StaticText(line, rect_t{}, STR_SWITCH);
|
new StaticText(line, rect_t{}, STR_SWITCH);
|
||||||
auto choice = new Choice(line, rect_t{}, 0, NUM_FUNCTIONS_SWITCHES - 1, GET_SET_DEFAULT(CFN_CS_INDEX(cfn)), STR_SWITCH);
|
auto choice = new Choice(line, rect_t{}, 0, switchGetMaxSwitches() - 1,
|
||||||
|
[=]() { return switchGetSwitchFromCustomIdx(CFN_CS_INDEX(cfn)); },
|
||||||
|
[=](int n) { CFN_CS_INDEX(cfn) = switchGetCustomSwitchIdx(n); },
|
||||||
|
STR_SWITCH);
|
||||||
choice->setTextHandler([=](int n) {
|
choice->setTextHandler([=](int n) {
|
||||||
return std::string(STR_SWITCH) + std::to_string(n + 1);
|
return std::string(switchGetDefaultName(n));
|
||||||
});
|
});
|
||||||
|
choice->setAvailableHandler(switchIsCustomSwitch);
|
||||||
|
|
||||||
line = specialFunctionOneWindow->newLine(grid);
|
line = specialFunctionOneWindow->newLine(grid);
|
||||||
|
|
||||||
auto edit = addNumberEdit(line, STR_INTERVAL, cfn, PUSH_CS_DURATION_MIN,
|
auto edit = addNumberEdit(line, STR_INTERVAL, cfn, PUSH_CS_DURATION_MIN,
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class SwitchDynamicLabel : public StaticText
|
|||||||
|
|
||||||
std::string label()
|
std::string label()
|
||||||
{
|
{
|
||||||
std::string str(switchGetCanonicalName(index));
|
std::string str(switchGetDefaultName(index));
|
||||||
return str + getSwitchPositionSymbol(lastpos);
|
return str + getSwitchPositionSymbol(lastpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ class HWSwitch
|
|||||||
HWSwitch(Window* parent, int swnum, coord_t y)
|
HWSwitch(Window* parent, int swnum, coord_t y)
|
||||||
{
|
{
|
||||||
new SwitchDynamicLabel(parent, swnum, PAD_TINY, y + PAD_SMALL, HWSwitches::SW_CTRL_W);
|
new SwitchDynamicLabel(parent, swnum, PAD_TINY, y + PAD_SMALL, HWSwitches::SW_CTRL_W);
|
||||||
new HWInputEdit(parent, (char*)switchGetCustomName(swnum), LEN_SWITCH_NAME,
|
new HWInputEdit(parent, g_eeGeneral.getSwitchCustomName(swnum), LEN_SWITCH_NAME,
|
||||||
HWSwitches::SW_CTRL_W + PAD_SMALL, y);
|
HWSwitches::SW_CTRL_W + PAD_SMALL, y);
|
||||||
|
|
||||||
coord_t x = HWSwitches::SW_CTRL_W * 2 + PAD_SMALL * 2;
|
coord_t x = HWSwitches::SW_CTRL_W * 2 + PAD_SMALL * 2;
|
||||||
@@ -233,12 +233,9 @@ class HWSwitch
|
|||||||
sw_cfg = new Choice(
|
sw_cfg = new Choice(
|
||||||
parent, {x, y, HWSwitches::SW_CTRL_W, 0},
|
parent, {x, y, HWSwitches::SW_CTRL_W, 0},
|
||||||
STR_SWTYPES, SWITCH_NONE, switchGetMaxType(swnum),
|
STR_SWTYPES, SWITCH_NONE, switchGetMaxType(swnum),
|
||||||
[=]() -> int { return SWITCH_CONFIG(swnum); },
|
[=]() -> int { return g_eeGeneral.switchType(swnum); },
|
||||||
[=](int newValue) {
|
[=](int newValue) {
|
||||||
swconfig_t mask = (swconfig_t)SWITCH_CONFIG_MASK(swnum);
|
g_eeGeneral.switchSetType(swnum, (SwitchConfig)newValue);
|
||||||
g_eeGeneral.switchConfig =
|
|
||||||
(g_eeGeneral.switchConfig & ~mask) |
|
|
||||||
((swconfig_t(newValue) & SW_CFG_MASK) << (SW_CFG_BITS * swnum));
|
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -266,9 +263,10 @@ HWSwitches::HWSwitches(Window* parent) :
|
|||||||
{
|
{
|
||||||
padAll(PAD_TINY);
|
padAll(PAD_TINY);
|
||||||
|
|
||||||
auto max_switches = switchGetMaxSwitches();
|
auto max_switches = switchGetMaxAllSwitches();
|
||||||
for (int i = 0; i < max_switches; i++) {
|
for (int i = 0; i < max_switches; i++) {
|
||||||
new HWSwitch(this, i, i * HWSwitch::SW_CTRL_H + PAD_OUTLINE);
|
if (!switchIsCustomSwitch(i))
|
||||||
|
new HWSwitch(this, i, i * HWSwitch::SW_CTRL_H + PAD_OUTLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,318 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) EdgeTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* opentx - https://github.com/opentx/opentx
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
|
||||||
|
#include "radio_cfs.h"
|
||||||
|
|
||||||
|
#include "edgetx.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
|
#include "strhelpers.h"
|
||||||
|
#include "switches.h"
|
||||||
|
#include "color_picker.h"
|
||||||
|
|
||||||
|
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||||
|
|
||||||
|
static const lv_coord_t cfs_line_col_dsc1[] = {LV_GRID_CONTENT,
|
||||||
|
LV_GRID_TEMPLATE_LAST};
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
static const lv_coord_t cfs_line_col_dsc2[] = {
|
||||||
|
LV_GRID_FR(13), LV_GRID_FR(11), LV_GRID_FR(11),
|
||||||
|
LV_GRID_FR(12), LV_GRID_FR(10), LV_GRID_FR(7), LV_GRID_FR(7),
|
||||||
|
LV_GRID_TEMPLATE_LAST};
|
||||||
|
#else
|
||||||
|
static const lv_coord_t cfs_line_col_dsc2[] = {
|
||||||
|
LV_GRID_FR(10), LV_GRID_FR(10), LV_GRID_FR(10),
|
||||||
|
LV_GRID_FR(12), LV_GRID_FR(8), LV_GRID_TEMPLATE_LAST};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static const lv_coord_t cfs_line_row_dsc[] = {LV_GRID_CONTENT,
|
||||||
|
LV_GRID_TEMPLATE_LAST};
|
||||||
|
|
||||||
|
extern const char* _fct_sw_start[];
|
||||||
|
extern const char* edgetx_fs_manual_url;
|
||||||
|
|
||||||
|
class RadioFunctionSwitch : public Window
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RadioFunctionSwitch(Window* parent, uint8_t sw) :
|
||||||
|
Window(parent, {0, 0, LCD_W - PAD_SMALL * 2, ROW_H}), switchIndex(sw)
|
||||||
|
{
|
||||||
|
padAll(PAD_TINY);
|
||||||
|
|
||||||
|
std::string s(STR_CHAR_SWITCH);
|
||||||
|
s += switchGetDefaultName(switchIndex);
|
||||||
|
|
||||||
|
new StaticText(this, {PAD_LARGE, PAD_MEDIUM, SW_W, EdgeTxStyles::STD_FONT_HEIGHT}, s);
|
||||||
|
|
||||||
|
new ModelTextEdit(this, {NM_X, 0, NM_W, 0},
|
||||||
|
g_eeGeneral.switchName(switchIndex), LEN_SWITCH_NAME);
|
||||||
|
|
||||||
|
typeChoice = new Choice(
|
||||||
|
this, {TP_X, 0, TP_W, 0}, STR_SWTYPES, SWITCH_NONE, SWITCH_GLOBAL,
|
||||||
|
[=]() { return g_eeGeneral.switchType(switchIndex); },
|
||||||
|
[=](int val) {
|
||||||
|
g_eeGeneral.switchSetType(switchIndex, (SwitchConfig)val);
|
||||||
|
if (val == SWITCH_NONE) {
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
if (g_model.getSwitchType(switchIndex) == SWITCH_NONE)
|
||||||
|
fsLedRGB(switchGetCustomSwitchIdx(switchIndex), 0);
|
||||||
|
#endif
|
||||||
|
} else if (val == SWITCH_TOGGLE) {
|
||||||
|
g_eeGeneral.switchSetStart(switchIndex, FS_START_PREVIOUS);
|
||||||
|
setFSLogicalState(switchIndex, 0);
|
||||||
|
startChoice->setValue(startChoice->getIntValue());
|
||||||
|
}
|
||||||
|
SET_DIRTY();
|
||||||
|
});
|
||||||
|
typeChoice->setAvailableHandler([=](int typ) -> bool {
|
||||||
|
if (typ == SWITCH_3POS || typ == SWITCH_GLOBAL) return false;
|
||||||
|
int group = g_eeGeneral.switchGroup(switchIndex);
|
||||||
|
if (group > 0 && g_model.cfsGroupAlwaysOn(group) && typ == SWITCH_TOGGLE)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
startChoice = new Choice(
|
||||||
|
this, {ST_X, 0, ST_W, 0}, _fct_sw_start, 0, 2,
|
||||||
|
[=]() { return g_eeGeneral.switchStart(switchIndex); },
|
||||||
|
[=](int val) {
|
||||||
|
g_eeGeneral.switchSetStart(switchIndex, (fsStartPositionType)val);
|
||||||
|
SET_DIRTY();
|
||||||
|
});
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
#if NARROW_LAYOUT
|
||||||
|
new StaticText(this, rect_t{C1_X - C1_W - PAD_TINY, C1_Y + PAD_SMALL, C1_W, 0}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT);
|
||||||
|
new StaticText(this, rect_t{C2_X - C2_W - PAD_TINY, C2_Y + PAD_SMALL, C2_W, 0}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
offValue = g_eeGeneral.switchOffColor(switchIndex);
|
||||||
|
onValue = g_eeGeneral.switchOnColor(switchIndex);
|
||||||
|
|
||||||
|
offColor = new ColorPicker(
|
||||||
|
this, {C1_X, 0, C1_W, 0},
|
||||||
|
[=]() -> int { // getValue
|
||||||
|
return g_eeGeneral.switchOffColor(switchIndex).getColor() | RGB888_FLAG;
|
||||||
|
},
|
||||||
|
[=](int newValue) { // setValue
|
||||||
|
g_eeGeneral.switchOffColor(switchIndex) = offValue;
|
||||||
|
g_eeGeneral.switchOnColor(switchIndex) = onValue;
|
||||||
|
|
||||||
|
// Convert color index to RGB
|
||||||
|
newValue = color32ToRGB(newValue);
|
||||||
|
g_eeGeneral.switchOffColor(switchIndex).setColor(newValue);
|
||||||
|
|
||||||
|
offValue = g_eeGeneral.switchOffColor(switchIndex);
|
||||||
|
SET_DIRTY();
|
||||||
|
},
|
||||||
|
[=](int newValue) { previewColor(newValue); }, ETX_RGB888);
|
||||||
|
|
||||||
|
onColor = new ColorPicker(
|
||||||
|
this, {C2_X, 0, C2_W, 0},
|
||||||
|
[=]() -> int { // getValue
|
||||||
|
return g_eeGeneral.switchOnColor(switchIndex).getColor() | RGB888_FLAG;
|
||||||
|
},
|
||||||
|
[=](int newValue) { // setValue
|
||||||
|
g_eeGeneral.switchOffColor(switchIndex) = offValue;
|
||||||
|
g_eeGeneral.switchOnColor(switchIndex) = onValue;
|
||||||
|
|
||||||
|
// Convert color index to RGB
|
||||||
|
newValue = color32ToRGB(newValue);
|
||||||
|
g_eeGeneral.switchOnColor(switchIndex).setColor(newValue);
|
||||||
|
|
||||||
|
onValue = g_eeGeneral.switchOnColor(switchIndex);
|
||||||
|
SET_DIRTY();
|
||||||
|
},
|
||||||
|
[=](int newValue) { previewColor(newValue); }, ETX_RGB888);
|
||||||
|
|
||||||
|
overrideLabel = new StaticText(this, {GR_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_LARGE, GR_W + ST_W - PAD_LARGE, 0},
|
||||||
|
STR_LUA_OVERRIDE, COLOR_THEME_PRIMARY1_INDEX, FONT(XS) | RIGHT);
|
||||||
|
offOverride = new ToggleSwitch(this, {C1_X - PAD_MEDIUM * 2, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0},
|
||||||
|
[=]() { return g_model.cfsOffColorLuaOverride(switchIndex); },
|
||||||
|
[=](bool v) { g_model.cfsSetOffColorLuaOverride(switchIndex, v); });
|
||||||
|
onOverride = new ToggleSwitch(this, {C2_X, C1_Y + EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE, 0, 0},
|
||||||
|
[=]() { return g_model.cfsOnColorLuaOverride(switchIndex); },
|
||||||
|
[=](bool v) { g_model.cfsSetOnColorLuaOverride(switchIndex, v); });
|
||||||
|
#endif //FUNCTION_SWITCHES_RGB_LEDS
|
||||||
|
|
||||||
|
setState();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
static LAYOUT_VAL_SCALED(SW_W, 70)
|
||||||
|
static constexpr coord_t NM_X = SW_W + PAD_SMALL;
|
||||||
|
static LAYOUT_VAL_SCALED(NM_W, 60)
|
||||||
|
static constexpr coord_t TP_X = NM_X + NM_W + PAD_SMALL;
|
||||||
|
static LAYOUT_VAL_SCALED(TP_W, 78)
|
||||||
|
static constexpr coord_t GR_X = TP_X + TP_W + PAD_SMALL;
|
||||||
|
static LAYOUT_VAL_SCALED(GR_W, 84)
|
||||||
|
static constexpr coord_t ST_X = GR_X + GR_W + PAD_SMALL;
|
||||||
|
static LAYOUT_VAL_SCALED(ST_W, 60)
|
||||||
|
#if NARROW_LAYOUT
|
||||||
|
static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 3 + PAD_OUTLINE * 4;
|
||||||
|
static constexpr coord_t C1_X = TP_X;
|
||||||
|
static constexpr coord_t C1_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE;
|
||||||
|
static LAYOUT_VAL_SCALED(C1_W, 40)
|
||||||
|
static constexpr coord_t C2_X = GR_X;
|
||||||
|
static constexpr coord_t C2_Y = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE;
|
||||||
|
static LAYOUT_VAL_SCALED(C2_W, 40)
|
||||||
|
#else
|
||||||
|
static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT * 2 + PAD_OUTLINE * 3;
|
||||||
|
static constexpr coord_t C1_X = ST_X + ST_W + PAD_SMALL;
|
||||||
|
static constexpr coord_t C1_Y = 0;
|
||||||
|
static LAYOUT_VAL_SCALED(C1_W, 40)
|
||||||
|
static constexpr coord_t C2_X = C1_X + C1_W + PAD_SMALL;
|
||||||
|
static constexpr coord_t C2_Y = 0;
|
||||||
|
static LAYOUT_VAL_SCALED(C2_W, 40)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
static constexpr coord_t ROW_H = EdgeTxStyles::UI_ELEMENT_HEIGHT + PAD_OUTLINE * 2;
|
||||||
|
static constexpr coord_t SW_W = (LCD_W - PAD_SMALL * 2 - PAD_TINY * 4) / 5;
|
||||||
|
static constexpr coord_t NM_X = SW_W + PAD_TINY;
|
||||||
|
static LAYOUT_VAL_SCALED(NM_W, 80)
|
||||||
|
static constexpr coord_t TP_X = NM_X + SW_W + PAD_TINY;
|
||||||
|
static LAYOUT_VAL_SCALED(TP_W, 86)
|
||||||
|
static constexpr coord_t GR_X = TP_X + SW_W + PAD_TINY;
|
||||||
|
static LAYOUT_VAL_SCALED(GR_W, 94)
|
||||||
|
static constexpr coord_t ST_X = GR_X + SW_W + PAD_LARGE * 2 + PAD_SMALL;
|
||||||
|
static LAYOUT_VAL_SCALED(ST_W, 70)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
uint8_t switchIndex;
|
||||||
|
Choice* typeChoice = nullptr;
|
||||||
|
Choice* startChoice = nullptr;
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
ColorPicker* offColor = nullptr;
|
||||||
|
ColorPicker* onColor = nullptr;
|
||||||
|
RGBLedColor offValue;
|
||||||
|
RGBLedColor onValue;
|
||||||
|
StaticText* overrideLabel = nullptr;
|
||||||
|
ToggleSwitch* onOverride = nullptr;
|
||||||
|
ToggleSwitch* offOverride = nullptr;
|
||||||
|
#endif
|
||||||
|
int lastType = -1;
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
void previewColor(int newValue)
|
||||||
|
{
|
||||||
|
// Convert color index to RGB
|
||||||
|
newValue = color32ToRGB(newValue);
|
||||||
|
if (g_model.cfsState(switchIndex)) {
|
||||||
|
g_eeGeneral.switchOnColor(switchIndex).setColor(newValue);
|
||||||
|
} else {
|
||||||
|
g_eeGeneral.switchOffColor(switchIndex).setColor(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void setState()
|
||||||
|
{
|
||||||
|
uint8_t typ = g_eeGeneral.switchType(switchIndex);
|
||||||
|
startChoice->show(typ == SWITCH_2POS && g_eeGeneral.switchGroup(switchIndex) == 0);
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
offColor->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
onColor->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
overrideLabel->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
onOverride->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
offOverride->show(typ != SWITCH_NONE && typ != SWITCH_GLOBAL);
|
||||||
|
if (typ != SWITCH_NONE && typ != SWITCH_GLOBAL)
|
||||||
|
setHeight(ROW_H);
|
||||||
|
else
|
||||||
|
setHeight(ROW_H - EdgeTxStyles::UI_ELEMENT_HEIGHT - PAD_OUTLINE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkEvents() override
|
||||||
|
{
|
||||||
|
setState();
|
||||||
|
if (lastType != (int)g_eeGeneral.switchType(switchIndex)) {
|
||||||
|
lastType = g_eeGeneral.switchType(switchIndex);
|
||||||
|
typeChoice->setValue(lastType);
|
||||||
|
}
|
||||||
|
Window::checkEvents();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
RadioFunctionSwitches::RadioFunctionSwitches() : Page(ICON_RADIO_HARDWARE)
|
||||||
|
{
|
||||||
|
header->setTitle(STR_HARDWARE);
|
||||||
|
header->setTitle2(STR_MENU_FSWITCH);
|
||||||
|
|
||||||
|
body->padAll(PAD_TINY);
|
||||||
|
body->setFlexLayout(LV_FLEX_FLOW_COLUMN, PAD_ZERO);
|
||||||
|
|
||||||
|
FlexGridLayout grid1(cfs_line_col_dsc1, cfs_line_row_dsc, PAD_TINY);
|
||||||
|
FlexGridLayout grid2(cfs_line_col_dsc2, cfs_line_row_dsc, PAD_TINY);
|
||||||
|
|
||||||
|
auto line = body->newLine(grid2);
|
||||||
|
new StaticText(line, rect_t{}, STR_SWITCHES);
|
||||||
|
new StaticText(line, rect_t{}, STR_NAME, COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
||||||
|
new StaticText(line, rect_t{}, STR_SWITCH_TYPE,
|
||||||
|
COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
||||||
|
grid2.nextColumn();
|
||||||
|
// new StaticText(line, rect_t{}, STR_GROUP, COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
||||||
|
startupHeader = new StaticText(line, rect_t{}, STR_SWITCH_STARTUP,
|
||||||
|
COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
new StaticText(line, rect_t{}, STR_OFF, COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
||||||
|
new StaticText(line, rect_t{}, STR_ON_ONE_SWITCHES[0], COLOR_THEME_PRIMARY1_INDEX, FONT(XS));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i += 1) {
|
||||||
|
if (switchIsCustomSwitch(i))
|
||||||
|
new RadioFunctionSwitch(body, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
setState();
|
||||||
|
|
||||||
|
line = body->newLine(grid1);
|
||||||
|
|
||||||
|
new StaticText(line, rect_t{}, STR_MORE_INFO);
|
||||||
|
|
||||||
|
line = body->newLine(grid1);
|
||||||
|
line->padBottom(PAD_LARGE);
|
||||||
|
line->padLeft((width() - 150) / 2);
|
||||||
|
|
||||||
|
auto qr = lv_qrcode_create(line->getLvObj(), 150,
|
||||||
|
makeLvColor(COLOR_THEME_SECONDARY1),
|
||||||
|
makeLvColor(COLOR_THEME_SECONDARY3));
|
||||||
|
lv_qrcode_update(qr, edgetx_fs_manual_url, strlen(edgetx_fs_manual_url));
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioFunctionSwitches::setState()
|
||||||
|
{
|
||||||
|
// int cnt = 0;
|
||||||
|
// for (int i = 1; i <= 3; i += 1) {
|
||||||
|
// cnt += getSwitchCountInFSGroup(i);
|
||||||
|
// }
|
||||||
|
// startupHeader->show(cnt != NUM_FUNCTIONS_SWITCHES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioFunctionSwitches::checkEvents()
|
||||||
|
{
|
||||||
|
setState();
|
||||||
|
Page::checkEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) EdgeTX
|
* Copyright (C) EdgeTX
|
||||||
*
|
*
|
||||||
|
* Based on code named
|
||||||
|
* opentx - https://github.com/opentx/opentx
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -13,9 +19,24 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "hal/switch_driver.h"
|
#if defined(FUNCTION_SWITCHES)
|
||||||
#include "stm32_switch_driver.h"
|
|
||||||
|
#include "page.h"
|
||||||
SwitchHwPos bsp_get_switch_position(const stm32_switch_t *sw, SwitchCategory cat, uint8_t idx) {return SWITCH_HW_MID;}
|
|
||||||
|
class RadioFunctionSwitches : public Page
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RadioFunctionSwitches();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BitmapBuffer* qrcode = nullptr;
|
||||||
|
StaticText* startupHeader = nullptr;
|
||||||
|
|
||||||
|
void setState();
|
||||||
|
void checkEvents() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -65,36 +65,40 @@ class RadioCustSwitchesDiagsWindow : public Window
|
|||||||
"Log");
|
"Log");
|
||||||
new StaticText(this, {FS_3RD_COLUMN, PAD_SMALL, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
new StaticText(this, {FS_3RD_COLUMN, PAD_SMALL, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
||||||
"Led");
|
"Led");
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) {
|
for (uint8_t i = 0, r = 0; i < switchGetMaxSwitches(); i += 1) {
|
||||||
coord_t y = (i + 2) * EdgeTxStyles::STD_FONT_HEIGHT;
|
if (switchIsCustomSwitch(i)) {
|
||||||
std::string s(STR_CHAR_SWITCH);
|
coord_t y = (r + 2) * EdgeTxStyles::STD_FONT_HEIGHT;
|
||||||
s += switchGetName(i + switchGetMaxSwitches());
|
std::string s(STR_CHAR_SWITCH);
|
||||||
new StaticText(this, {PAD_LARGE, y, FS_LBL_WIDTH, LV_SIZE_CONTENT}, s);
|
s += switchGetDefaultName(i);
|
||||||
new DynamicText(
|
new StaticText(this, {PAD_LARGE, y, FS_LBL_WIDTH, LV_SIZE_CONTENT}, s);
|
||||||
this, {FS_1ST_COLUMN + PAD_LARGE, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
new DynamicText(
|
||||||
[=]() {
|
this, {FS_1ST_COLUMN + PAD_LARGE, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
||||||
return getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP;
|
[=]() {
|
||||||
});
|
return getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP;
|
||||||
new DynamicText(
|
});
|
||||||
this, {FS_2ND_COLUMN + PAD_LARGE, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
new DynamicText(
|
||||||
[=]() { return getFSLogicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP; });
|
this, {FS_2ND_COLUMN + 10, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
||||||
|
[=]() { return g_model.cfsState(i) ? STR_CHAR_DOWN : STR_CHAR_UP; });
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
colorBox[i] = new ColorSwatch(this, {FS_3RD_COLUMN, y, FS_COLOR_WIDTH,
|
colorBox[r] = new ColorSwatch(this, {FS_3RD_COLUMN, y, FS_COLOR_WIDTH,
|
||||||
FS_COLOR_HEIGHT}, getLedColor(i));
|
FS_COLOR_HEIGHT}, getLedColor(r));
|
||||||
#else
|
#else
|
||||||
new DynamicText(this,
|
new DynamicText(this,
|
||||||
{FS_3RD_COLUMN, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
{FS_3RD_COLUMN, y, FS_LBL_WIDTH, LV_SIZE_CONTENT},
|
||||||
[=]() { return STR_OFFON[getFSLedState(i)]; });
|
[=]() { return STR_OFFON[getFSLedState(i)]; });
|
||||||
#endif
|
#endif
|
||||||
|
r += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
void checkEvents() override {
|
void checkEvents() override {
|
||||||
Window::checkEvents();
|
Window::checkEvents();
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) {
|
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) {
|
||||||
colorBox[i]->setColor(getLedColor(i));
|
if (colorBox[i])
|
||||||
|
colorBox[i]->setColor(getLedColor(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -125,14 +125,14 @@ class RadioKeyDiagsWindow : public Window
|
|||||||
|
|
||||||
void addSwitches(Window *form)
|
void addSwitches(Window *form)
|
||||||
{
|
{
|
||||||
switchValues = new lv_obj_t *[switchGetMaxSwitches()];
|
switchValues = new lv_obj_t *[switchGetMaxAllSwitches()];
|
||||||
lv_obj_t *obj = form->getLvObj();
|
lv_obj_t *obj = form->getLvObj();
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
uint8_t row = 0;
|
uint8_t row = 0;
|
||||||
|
|
||||||
// SWITCHES
|
// SWITCHES
|
||||||
for (i = 0; i < switchGetMaxSwitches(); i++) {
|
for (i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i) && !switchIsCustomSwitch(i)) {
|
||||||
auto lbl = lv_label_create(obj);
|
auto lbl = lv_label_create(obj);
|
||||||
lv_label_set_text(lbl, "");
|
lv_label_set_text(lbl, "");
|
||||||
lv_obj_set_pos(lbl, 0, row * EdgeTxStyles::STD_FONT_HEIGHT);
|
lv_obj_set_pos(lbl, 0, row * EdgeTxStyles::STD_FONT_HEIGHT);
|
||||||
@@ -197,8 +197,8 @@ class RadioKeyDiagsWindow : public Window
|
|||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
for (i = 0; i < switchGetMaxSwitches(); i++) {
|
for (i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i) && !switchIsCustomSwitch(i)) {
|
||||||
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
|
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
|
||||||
getvalue_t sw =
|
getvalue_t sw =
|
||||||
((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
|
((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "radio_setup.h"
|
#include "radio_setup.h"
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
#include "radio_cfs.h"
|
||||||
#include "radio_diagcustswitches.h"
|
#include "radio_diagcustswitches.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -191,6 +192,9 @@ void RadioHardwarePage::build(Window* window)
|
|||||||
{STR_STICKS, []() { new HWInputDialog<HWSticks>(STR_STICKS); }},
|
{STR_STICKS, []() { new HWInputDialog<HWSticks>(STR_STICKS); }},
|
||||||
{STR_POTS, []() { new HWInputDialog<HWPots>(STR_POTS, HWPots::POTS_WINDOW_WIDTH); }},
|
{STR_POTS, []() { new HWInputDialog<HWPots>(STR_POTS, HWPots::POTS_WINDOW_WIDTH); }},
|
||||||
{STR_SWITCHES, []() { new HWInputDialog<HWSwitches>(STR_SWITCHES, HWSwitches::SW_WINDOW_WIDTH); }},
|
{STR_SWITCHES, []() { new HWInputDialog<HWSwitches>(STR_SWITCHES, HWSwitches::SW_WINDOW_WIDTH); }},
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
{STR_FUNCTION_SWITCHES, []() { new RadioFunctionSwitches(); }},
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
// Debugs
|
// Debugs
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ class RadioHardwarePage : public PageTab
|
|||||||
|
|
||||||
void build(Window* window) override;
|
void build(Window* window) override;
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
static LAYOUT_SIZE(BTN_COLS, 2, 2)
|
||||||
|
#else
|
||||||
static LAYOUT_SIZE(BTN_COLS, 4, 3)
|
static LAYOUT_SIZE(BTN_COLS, 4, 3)
|
||||||
|
#endif
|
||||||
static LAYOUT_SIZE(FS_BTN_COLS, 2, 2)
|
static LAYOUT_SIZE(FS_BTN_COLS, 2, 2)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "hal/adc_driver.h"
|
#include "hal/adc_driver.h"
|
||||||
#include "hal/switch_driver.h"
|
#include "hal/switch_driver.h"
|
||||||
#include "hal/module_port.h"
|
#include "hal/module_port.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
|
|
||||||
#include "analogs.h"
|
#include "analogs.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
@@ -62,6 +63,11 @@ enum {
|
|||||||
ITEM_RADIO_HARDWARE_LABEL_SWITCHES,
|
ITEM_RADIO_HARDWARE_LABEL_SWITCHES,
|
||||||
ITEM_RADIO_HARDWARE_SWITCH,
|
ITEM_RADIO_HARDWARE_SWITCH,
|
||||||
ITEM_RADIO_HARDWARE_SWITCH_END = ITEM_RADIO_HARDWARE_SWITCH + MAX_SWITCHES - 1,
|
ITEM_RADIO_HARDWARE_SWITCH_END = ITEM_RADIO_HARDWARE_SWITCH + MAX_SWITCHES - 1,
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
ITEM_RADIO_HARDWARE_LABEL_CFS,
|
||||||
|
ITEM_RADIO_HARDWARE_CFS,
|
||||||
|
ITEM_RADIO_HARDWARE_CFS_END = ITEM_RADIO_HARDWARE_CFS + MAX_SWITCHES - 1,
|
||||||
|
#endif
|
||||||
CASE_BATTGRAPH(ITEM_RADIO_HARDWARE_BATT_RANGE)
|
CASE_BATTGRAPH(ITEM_RADIO_HARDWARE_BATT_RANGE)
|
||||||
ITEM_RADIO_HARDWARE_BATTERY_CALIB,
|
ITEM_RADIO_HARDWARE_BATTERY_CALIB,
|
||||||
ITEM_RADIO_HARDWARE_RTC_BATTERY,
|
ITEM_RADIO_HARDWARE_RTC_BATTERY,
|
||||||
@@ -114,6 +120,130 @@ static void onHardwareAntennaSwitchConfirm(const char * result)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
#define RADIO_SETUP_2ND_COLUMN (LCD_W-11*FW)
|
||||||
|
extern char* _fct_sw_start[];
|
||||||
|
static int swIndex;
|
||||||
|
|
||||||
|
extern bool checkCFSTypeAvailable(int val);
|
||||||
|
|
||||||
|
enum CFSFields {
|
||||||
|
CFS_FIELD_TYPE,
|
||||||
|
CFS_FIELD_NAME,
|
||||||
|
CFS_FIELD_START,
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
CFS_FIELD_COLOR_LABEL,
|
||||||
|
CFS_FIELD_ON_COLOR,
|
||||||
|
CFS_FIELD_ON_LUA_OVERRIDE,
|
||||||
|
CFS_FIELD_OFF_COLOR,
|
||||||
|
CFS_FIELD_OFF_LUA_OVERRIDE,
|
||||||
|
#endif
|
||||||
|
CFS_FIELD_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
extern void menuCFSColor(coord_t y, RGBLedColor& color, const char* title, LcdFlags attr, event_t event);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void menuRadioCFSOne(event_t event)
|
||||||
|
{
|
||||||
|
std::string s(STR_CHAR_SWITCH);
|
||||||
|
s += switchGetDefaultName(swIndex);
|
||||||
|
|
||||||
|
int config = g_eeGeneral.switchType(swIndex);
|
||||||
|
uint8_t group = g_eeGeneral.switchGroup(swIndex);
|
||||||
|
int startPos = g_eeGeneral.switchStart(swIndex);
|
||||||
|
|
||||||
|
SUBMENU(s.c_str(), CFS_FIELD_COUNT,
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 0 : HIDDEN_ROW),
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_TOGGLE && config != SWITCH_GLOBAL && group == 0) ? 0 : HIDDEN_ROW),
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? LABEL() : HIDDEN_ROW),
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 3 : HIDDEN_ROW),
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 0 : HIDDEN_ROW),
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 3 : HIDDEN_ROW),
|
||||||
|
(uint8_t)((config != SWITCH_NONE && config != SWITCH_GLOBAL) ? 0 : HIDDEN_ROW),
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
|
||||||
|
int8_t sub = menuVerticalPosition;
|
||||||
|
int8_t editMode = s_editMode;
|
||||||
|
|
||||||
|
coord_t y = MENU_HEADER_HEIGHT + 1;
|
||||||
|
|
||||||
|
for (int k = 0; k < NUM_BODY_LINES; k += 1) {
|
||||||
|
int i = k + menuVerticalOffset;
|
||||||
|
for (int j = 0; j <= i; j += 1) {
|
||||||
|
if (j < (int)DIM(mstate_tab) && mstate_tab[j] == HIDDEN_ROW) {
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LcdFlags attr = (sub == i ? (editMode > 0 ? BLINK | INVERS : INVERS) : 0);
|
||||||
|
|
||||||
|
switch(i) {
|
||||||
|
case CFS_FIELD_TYPE:
|
||||||
|
config = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_SWITCH_TYPE, STR_SWTYPES, config, SWITCH_NONE, SWITCH_3POS, attr, event, 0, checkCFSTypeAvailable);
|
||||||
|
if (attr && checkIncDec_Ret) {
|
||||||
|
g_eeGeneral.switchSetType(swIndex, (SwitchConfig)config);
|
||||||
|
if (config == SWITCH_NONE) {
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
if (g_model.getSwitchType(swIndex) == SWITCH_NONE)
|
||||||
|
fsLedRGB(switchGetCustomSwitchIdx(swIndex), 0);
|
||||||
|
#endif
|
||||||
|
} else if (config == SWITCH_TOGGLE) {
|
||||||
|
g_eeGeneral.switchSetStart(swIndex, FS_START_PREVIOUS); // Toggle switches do not have startup position
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_NAME:
|
||||||
|
editSingleName(RADIO_SETUP_2ND_COLUMN, y, STR_NAME, g_eeGeneral.switchName(swIndex),
|
||||||
|
LEN_SWITCH_NAME, event, (attr != 0),
|
||||||
|
editMode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_START:
|
||||||
|
lcdDrawText(0, y, STR_SWITCH_STARTUP);
|
||||||
|
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, _fct_sw_start[startPos], attr ? (s_editMode ? INVERS + BLINK : INVERS) : 0);
|
||||||
|
if (attr) {
|
||||||
|
startPos = checkIncDec(event, startPos, FS_START_OFF, FS_START_PREVIOUS, EE_MODEL);
|
||||||
|
g_eeGeneral.switchSetStart(swIndex, (fsStartPositionType)startPos);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
case CFS_FIELD_COLOR_LABEL:
|
||||||
|
lcdDrawText(0, y, STR_BLCOLOR);
|
||||||
|
lcdDrawText(LCD_W - 6 * FW, y, "R", RIGHT | SMLSIZE);
|
||||||
|
lcdDrawText(LCD_W - 3 * FW, y, "G", RIGHT | SMLSIZE);
|
||||||
|
lcdDrawText(LCD_W, y, "B", RIGHT | SMLSIZE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_ON_COLOR:
|
||||||
|
menuCFSColor(y, g_eeGeneral.switchOnColor(swIndex), STR_OFFON[1], attr, event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_ON_LUA_OVERRIDE:
|
||||||
|
g_eeGeneral.cfsSetOnColorLuaOverride(swIndex, editCheckBox(g_eeGeneral.cfsOnColorLuaOverride(swIndex), LCD_W - 2 * FW, y, STR_LUA_OVERRIDE, attr, event, INDENT_WIDTH));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_OFF_COLOR:
|
||||||
|
menuCFSColor(y, g_eeGeneral.switchOffColor(swIndex), STR_OFFON[0], attr, event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFS_FIELD_OFF_LUA_OVERRIDE:
|
||||||
|
g_eeGeneral.cfsSetOffColorLuaOverride(swIndex, editCheckBox(g_eeGeneral.cfsOffColorLuaOverride(swIndex), LCD_W - 2 * FW, y, STR_LUA_OVERRIDE, attr, event, INDENT_WIDTH));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
y += FH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t _dispSerialPort(uint8_t port_nr)
|
static uint8_t _dispSerialPort(uint8_t port_nr)
|
||||||
{
|
{
|
||||||
auto port = serialGetPort(port_nr);
|
auto port = serialGetPort(port_nr);
|
||||||
@@ -147,11 +277,25 @@ static void _init_menu_tab_array(uint8_t* tab, size_t len)
|
|||||||
tab[i] = idx < max_pots ? (IS_POT_MULTIPOS(idx) ? 1 : 2) : HIDDEN_ROW;
|
tab[i] = idx < max_pots ? (IS_POT_MULTIPOS(idx) ? 1 : 2) : HIDDEN_ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto max_switches = switchGetMaxSwitches();
|
int max_switches = switchGetMaxAllSwitches();
|
||||||
for (int i = ITEM_RADIO_HARDWARE_SWITCH; i <= ITEM_RADIO_HARDWARE_SWITCH_END; i++) {
|
for (int i = ITEM_RADIO_HARDWARE_SWITCH; i <= ITEM_RADIO_HARDWARE_SWITCH_END; i++) {
|
||||||
uint8_t idx = i - ITEM_RADIO_HARDWARE_SWITCH;
|
uint8_t idx = i - ITEM_RADIO_HARDWARE_SWITCH;
|
||||||
tab[i] = switchIsFlex(idx) ? 2 : idx < max_switches ? 1 : HIDDEN_ROW;
|
if (idx < max_switches && !switchIsCustomSwitch(idx)) {
|
||||||
|
tab[i] = switchIsFlex(idx) ? 2 : 1;
|
||||||
|
} else {
|
||||||
|
tab[i] = HIDDEN_ROW;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#if defined (FUNCTION_SWITCHES)
|
||||||
|
for (int i = ITEM_RADIO_HARDWARE_CFS; i <= ITEM_RADIO_HARDWARE_CFS_END; i++) {
|
||||||
|
uint8_t idx = i - ITEM_RADIO_HARDWARE_CFS;
|
||||||
|
if (idx < max_switches && switchIsCustomSwitch(idx)) {
|
||||||
|
tab[i] = 0;
|
||||||
|
} else {
|
||||||
|
tab[i] = HIDDEN_ROW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(BATTGRAPH)
|
#if defined(BATTGRAPH)
|
||||||
tab[ITEM_RADIO_HARDWARE_BATT_RANGE] = 1;
|
tab[ITEM_RADIO_HARDWARE_BATT_RANGE] = 1;
|
||||||
@@ -280,6 +424,12 @@ void menuRadioHardware(event_t event)
|
|||||||
lcdDrawTextAlignedLeft(y, STR_SWITCHES);
|
lcdDrawTextAlignedLeft(y, STR_SWITCHES);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
case ITEM_RADIO_HARDWARE_LABEL_CFS:
|
||||||
|
lcdDrawTextAlignedLeft(y, STR_FUNCTION_SWITCHES);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(BATTGRAPH)
|
#if defined(BATTGRAPH)
|
||||||
case ITEM_RADIO_HARDWARE_BATT_RANGE:
|
case ITEM_RADIO_HARDWARE_BATT_RANGE:
|
||||||
lcdDrawTextAlignedLeft(y, STR_BATTERY_RANGE);
|
lcdDrawTextAlignedLeft(y, STR_BATTERY_RANGE);
|
||||||
@@ -530,15 +680,14 @@ void menuRadioHardware(event_t event)
|
|||||||
setPotInversion(idx, 0);
|
setPotInversion(idx, 0);
|
||||||
storageDirty(EE_GENERAL);
|
storageDirty(EE_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
} else if (k <= ITEM_RADIO_HARDWARE_SWITCH_END) {
|
||||||
else if (k <= ITEM_RADIO_HARDWARE_SWITCH_END) {
|
|
||||||
// Switches
|
// Switches
|
||||||
int index = k - ITEM_RADIO_HARDWARE_SWITCH;
|
int index = k - ITEM_RADIO_HARDWARE_SWITCH;
|
||||||
int config = SWITCH_CONFIG(index);
|
int config = g_eeGeneral.switchType(index);
|
||||||
|
|
||||||
LcdFlags flags = menuHorizontalPosition < 0 ? attr : 0;
|
LcdFlags flags = menuHorizontalPosition < 0 ? attr : 0;
|
||||||
lcdDrawText(INDENT_WIDTH, y, STR_CHAR_SWITCH, flags);
|
lcdDrawText(INDENT_WIDTH, y, STR_CHAR_SWITCH, flags);
|
||||||
lcdDrawText(lcdNextPos, y, switchGetName(index), flags);
|
lcdDrawText(lcdNextPos, y, switchGetDefaultName(index), flags);
|
||||||
|
|
||||||
if (switchIsFlex(index)) {
|
if (switchIsFlex(index)) {
|
||||||
// flexSwitch source
|
// flexSwitch source
|
||||||
@@ -550,10 +699,10 @@ void menuRadioHardware(event_t event)
|
|||||||
|
|
||||||
//Name
|
//Name
|
||||||
flags = menuHorizontalPosition == 1 ? attr : 0;
|
flags = menuHorizontalPosition == 1 ? attr : 0;
|
||||||
if (switchHasCustomName(index) ||
|
if (g_eeGeneral.switchHasCustomName(index) ||
|
||||||
(attr && s_editMode > 0 && menuHorizontalPosition == 1)) {
|
(attr && s_editMode > 0 && menuHorizontalPosition == 1)) {
|
||||||
editName(HW_SETTINGS_COLUMN2, y,
|
editName(HW_SETTINGS_COLUMN2, y,
|
||||||
(char*)switchGetCustomName(index), LEN_SWITCH_NAME,
|
g_eeGeneral.getSwitchCustomName(index), LEN_SWITCH_NAME,
|
||||||
event, flags, 0, old_editMode);
|
event, flags, 0, old_editMode);
|
||||||
} else {
|
} else {
|
||||||
lcdDrawMMM(HW_SETTINGS_COLUMN2, y, flags);
|
lcdDrawMMM(HW_SETTINGS_COLUMN2, y, flags);
|
||||||
@@ -565,19 +714,14 @@ void menuRadioHardware(event_t event)
|
|||||||
SWITCH_NONE, switchGetMaxType(index), flags, event);
|
SWITCH_NONE, switchGetMaxType(index), flags, event);
|
||||||
|
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
swconfig_t mask = SWITCH_CONFIG_MASK(index);
|
g_eeGeneral.switchSetType(index, (SwitchConfig)config);
|
||||||
g_eeGeneral.switchConfig =
|
|
||||||
(g_eeGeneral.switchConfig & ~mask) |
|
|
||||||
((swconfig_t(config) & SW_CFG_MASK) << (SW_CFG_BITS * index));
|
|
||||||
storageDirty(EE_GENERAL);
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
flags = menuHorizontalPosition == 0 ? attr : 0;
|
flags = menuHorizontalPosition == 0 ? attr : 0;
|
||||||
if (switchHasCustomName(index) ||
|
if (g_eeGeneral.switchHasCustomName(index) ||
|
||||||
(attr && s_editMode > 0 && menuHorizontalPosition == 0)) {
|
(attr && s_editMode > 0 && menuHorizontalPosition == 0)) {
|
||||||
editName(HW_SETTINGS_COLUMN1, y,
|
editName(HW_SETTINGS_COLUMN1, y,
|
||||||
(char*)switchGetCustomName(index), LEN_SWITCH_NAME,
|
g_eeGeneral.getSwitchCustomName(index), LEN_SWITCH_NAME,
|
||||||
event, flags, 0, old_editMode);
|
event, flags, 0, old_editMode);
|
||||||
} else {
|
} else {
|
||||||
lcdDrawMMM(HW_SETTINGS_COLUMN1, y, flags);
|
lcdDrawMMM(HW_SETTINGS_COLUMN1, y, flags);
|
||||||
@@ -589,13 +733,43 @@ void menuRadioHardware(event_t event)
|
|||||||
SWITCH_NONE, switchGetMaxType(index), flags, event);
|
SWITCH_NONE, switchGetMaxType(index), flags, event);
|
||||||
|
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
swconfig_t mask = SWITCH_CONFIG_MASK(index);
|
g_eeGeneral.switchSetType(index, (SwitchConfig)config);
|
||||||
g_eeGeneral.switchConfig =
|
|
||||||
(g_eeGeneral.switchConfig & ~mask) |
|
|
||||||
((swconfig_t(config) & SW_CFG_MASK) << (SW_CFG_BITS * index));
|
|
||||||
storageDirty(EE_GENERAL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
} else if (k <= ITEM_RADIO_HARDWARE_CFS_END) {
|
||||||
|
// Customisable Switches
|
||||||
|
int index = k - ITEM_RADIO_HARDWARE_CFS;
|
||||||
|
int config = g_eeGeneral.switchType(index);
|
||||||
|
|
||||||
|
lcdDrawText(INDENT_WIDTH, y, STR_CHAR_SWITCH, attr);
|
||||||
|
lcdDrawText(lcdNextPos, y, switchGetDefaultName(index), attr);
|
||||||
|
|
||||||
|
lcdDrawText(HW_SETTINGS_COLUMN2, y, STR_SWTYPES[config]);
|
||||||
|
|
||||||
|
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
|
swIndex = index;
|
||||||
|
pushMenu(menuRadioCFSOne);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config != SWITCH_NONE) {
|
||||||
|
if (g_eeGeneral.switchName(index)[0]) {
|
||||||
|
char s[LEN_SWITCH_NAME + 1];
|
||||||
|
strAppend(s, g_eeGeneral.switchName(index), LEN_SWITCH_NAME);
|
||||||
|
lcdDrawText(HW_SETTINGS_COLUMN1, y, s);
|
||||||
|
} else {
|
||||||
|
lcdDrawMMM(HW_SETTINGS_COLUMN1, y, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t group = g_eeGeneral.switchGroup(index);
|
||||||
|
// lcdDrawText(30 + 13 * FW, y, STR_FSGROUPS[group]);
|
||||||
|
|
||||||
|
if (config != SWITCH_TOGGLE && group == 0) {
|
||||||
|
int startPos = g_eeGeneral.switchStart(index);
|
||||||
|
lcdDrawText(30 + 15 * FW, y, _fct_sw_start[startPos]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else if (k <= ITEM_RADIO_HARDWARE_SERIAL_PORT_END) {
|
} else if (k <= ITEM_RADIO_HARDWARE_SERIAL_PORT_END) {
|
||||||
auto port_nr = k - ITEM_RADIO_HARDWARE_SERIAL_PORT;
|
auto port_nr = k - ITEM_RADIO_HARDWARE_SERIAL_PORT;
|
||||||
auto port = serialGetPort(port_nr);
|
auto port = serialGetPort(port_nr);
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
|||||||
|
|
||||||
if (swtch >= SWSRC_FIRST_SWITCH && swtch <= SWSRC_LAST_SWITCH) {
|
if (swtch >= SWSRC_FIRST_SWITCH && swtch <= SWSRC_LAST_SWITCH) {
|
||||||
div_t swinfo = switchInfo(swtch);
|
div_t swinfo = switchInfo(swtch);
|
||||||
if (swinfo.quot >= switchGetMaxSwitches() + switchGetMaxFctSwitches()) {
|
if (swinfo.quot >= switchGetMaxAllSwitches()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_SWITCH_FS(swinfo.quot) && context == GeneralCustomFunctionsContext) {
|
if (switchIsCustomSwitch(swinfo.quot) && context == GeneralCustomFunctionsContext) {
|
||||||
return false; // FS are defined at model level, and cannot be in global functions
|
return false; // FS are defined at model level, and cannot be in global functions
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +439,7 @@ static bool isSwitchSwitchAvailable(int swtch, bool invert) {
|
|||||||
// Check normal switch
|
// Check normal switch
|
||||||
if (swtch < MAX_SWITCHES * 3) {
|
if (swtch < MAX_SWITCHES * 3) {
|
||||||
div_t swinfo = switchInfo(swtch + SWSRC_FIRST_SWITCH);
|
div_t swinfo = switchInfo(swtch + SWSRC_FIRST_SWITCH);
|
||||||
if (swinfo.quot >= switchGetMaxSwitches() + switchGetMaxFctSwitches()) {
|
if (swinfo.quot >= switchGetMaxAllSwitches()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,12 +670,9 @@ bool isAssignableFunctionAvailable(int function, bool modelFunctions)
|
|||||||
case FUNC_DISABLE_AUDIO_AMP:
|
case FUNC_DISABLE_AUDIO_AMP:
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(LED_STRIP_GPIO)
|
#if !defined(LED_STRIP_LENGTH)
|
||||||
case FUNC_RGB_LED:
|
case FUNC_RGB_LED:
|
||||||
return false;
|
return false;
|
||||||
#elif defined(RGB_LED_OFFSET)
|
|
||||||
case FUNC_RGB_LED:
|
|
||||||
return (LED_STRIP_LENGTH > RGB_LED_OFFSET);
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(DEBUG)
|
#if !defined(DEBUG)
|
||||||
case FUNC_TEST:
|
case FUNC_TEST:
|
||||||
|
|||||||
@@ -25,32 +25,59 @@
|
|||||||
#include "dataconstants.h"
|
#include "dataconstants.h"
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
static bool hasLedOverride[NUM_FUNCTIONS_SWITCHES] = { false };
|
||||||
|
static RGBLedColor ledOverride[NUM_FUNCTIONS_SWITCHES];
|
||||||
|
|
||||||
|
void setFSLedOverride(uint8_t index, bool state, uint8_t r, uint8_t g, uint8_t b)
|
||||||
|
{
|
||||||
|
hasLedOverride[index] = state;
|
||||||
|
ledOverride[index].r = r;
|
||||||
|
ledOverride[index].g = g;
|
||||||
|
ledOverride[index].b = b;
|
||||||
|
}
|
||||||
|
|
||||||
void setFSLedOFF(uint8_t index) {
|
void setFSLedOFF(uint8_t index) {
|
||||||
fsLedRGB(index, g_model.functionSwitchLedOFFColor[index].getColor());
|
if (g_model.getSwitchType(index) != SWITCH_NONE) {
|
||||||
|
uint8_t cfsIdx = switchGetCustomSwitchIdx(index);
|
||||||
|
if (hasLedOverride[cfsIdx] && g_model.getSwitchOffColorLuaOverride(index))
|
||||||
|
fsLedRGB(cfsIdx, ledOverride[cfsIdx].getColor());
|
||||||
|
else
|
||||||
|
fsLedRGB(cfsIdx, g_model.getSwitchOffColor(index).getColor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFSLedON(uint8_t index) {
|
void setFSLedON(uint8_t index) {
|
||||||
fsLedRGB(index, g_model.functionSwitchLedONColor[index].getColor());
|
if (g_model.getSwitchType(index) != SWITCH_NONE) {
|
||||||
|
uint8_t cfsIdx = switchGetCustomSwitchIdx(index);
|
||||||
|
if (hasLedOverride[cfsIdx] && g_model.getSwitchOnColorLuaOverride(index))
|
||||||
|
fsLedRGB(cfsIdx, ledOverride[cfsIdx].getColor());
|
||||||
|
else
|
||||||
|
fsLedRGB(cfsIdx, g_model.getSwitchOnColor(index).getColor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getFSLedState(uint8_t index) {
|
bool getFSLedState(uint8_t index) {
|
||||||
return fsGetLedRGB(index) == g_model.functionSwitchLedONColor[index].getColor();
|
uint8_t cfsIdx = switchGetCustomSwitchIdx(index);
|
||||||
|
return rgbGetLedColor(cfsIdx) == g_model.getSwitchOnColor(index).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getFSLedRGBColor(uint8_t index)
|
uint32_t getFSLedRGBColor(uint8_t index)
|
||||||
{
|
{
|
||||||
return fsGetLedRGB(index);
|
return fsGetLedRGB(index);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void setFSLedOFF(uint8_t index) {
|
void setFSLedOFF(uint8_t index) {
|
||||||
|
index = switchGetCustomSwitchIdx(index);
|
||||||
fsLedOff(index);
|
fsLedOff(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFSLedON(uint8_t index) {
|
void setFSLedON(uint8_t index) {
|
||||||
|
index = switchGetCustomSwitchIdx(index);
|
||||||
fsLedOn(index);
|
fsLedOn(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getFSLedState(uint8_t index) {
|
bool getFSLedState(uint8_t index) {
|
||||||
|
index = switchGetCustomSwitchIdx(index);
|
||||||
return fsLedState(index);
|
return fsLedState(index);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
// "Off", "White", "Red", "Green", "Yellow", "Orange", "Blue", "Pink"
|
// "Off", "White", "Red", "Green", "Yellow", "Orange", "Blue", "Pink"
|
||||||
constexpr uint32_t colorTable[] = {0x000000, 0xFFFFFF, 0xFF0000, 0x00FF00, 0xFFFF00, 0xFF4000, 0x0000FF, 0xFF00FF};
|
constexpr uint32_t colorTable[] = {0x000000, 0xFFFFFF, 0xFF0000, 0x00FF00, 0xFFFF00, 0xFF4000, 0x0000FF, 0xFF00FF};
|
||||||
|
|
||||||
|
void setFSLedOverride(uint8_t index, bool state, uint8_t r, uint8_t g, uint8_t b);
|
||||||
void setFSLedOFF(uint8_t index);
|
void setFSLedOFF(uint8_t index);
|
||||||
void setFSLedON(uint8_t index);
|
void setFSLedON(uint8_t index);
|
||||||
bool getFSLedState(uint8_t index);
|
bool getFSLedState(uint8_t index);
|
||||||
|
|||||||
@@ -31,15 +31,18 @@
|
|||||||
// Board API
|
// Board API
|
||||||
void boardInitSwitches();
|
void boardInitSwitches();
|
||||||
|
|
||||||
SwitchHwPos boardSwitchGetPosition(SwitchCategory cat, uint8_t idx);
|
SwitchHwPos boardSwitchGetPosition(uint8_t idx);
|
||||||
|
|
||||||
const char* boardSwitchGetName(SwitchCategory cat, uint8_t idx);
|
const char* boardSwitchGetName(uint8_t idx);
|
||||||
SwitchHwType boardSwitchGetType(SwitchCategory cat, uint8_t idx);
|
SwitchHwType boardSwitchGetType(uint8_t idx);
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
bool boardIsCustomSwitch(uint8_t idx);
|
||||||
|
uint8_t boardGetCustomSwitchIdx(uint8_t idx);
|
||||||
|
#endif
|
||||||
uint8_t boardGetMaxSwitches();
|
uint8_t boardGetMaxSwitches();
|
||||||
uint8_t boardGetMaxFctSwitches();
|
|
||||||
|
|
||||||
swconfig_t boardSwitchGetDefaultConfig();
|
SwitchConfig boardSwitchGetDefaultConfig(uint8_t n);
|
||||||
|
|
||||||
constexpr uint8_t _INVALID_ADC_CH = 0xFF;
|
constexpr uint8_t _INVALID_ADC_CH = 0xFF;
|
||||||
|
|
||||||
@@ -51,14 +54,39 @@ void switchInit()
|
|||||||
boardInitSwitches();
|
boardInitSwitches();
|
||||||
}
|
}
|
||||||
|
|
||||||
swconfig_t switchGetDefaultConfig() { return boardSwitchGetDefaultConfig(); }
|
SwitchConfig switchGetDefaultConfig(uint8_t n) { return boardSwitchGetDefaultConfig(n); }
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
bool switchIsCustomSwitch(int sw)
|
||||||
|
{
|
||||||
|
return boardIsCustomSwitch(sw);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t switchGetCustomSwitchIdx(uint8_t sw)
|
||||||
|
{
|
||||||
|
return boardGetCustomSwitchIdx(sw);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t switchGetSwitchFromCustomIdx(uint8_t idx)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i += 1)
|
||||||
|
if (switchIsCustomSwitch(i) && switchGetCustomSwitchIdx(i) == idx)
|
||||||
|
return i;
|
||||||
|
return switchGetMaxSwitches();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
bool switchIsCustomSwitch(int sw) { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t switchGetMaxSwitches()
|
uint8_t switchGetMaxSwitches()
|
||||||
{
|
{
|
||||||
return boardGetMaxSwitches() + MAX_FLEX_SWITCHES;
|
return boardGetMaxSwitches();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t switchGetMaxFctSwitches() { return boardGetMaxFctSwitches(); }
|
uint8_t switchGetMaxAllSwitches()
|
||||||
|
{
|
||||||
|
return boardGetMaxSwitches() + MAX_FLEX_SWITCHES;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t switchState(uint8_t pos_idx)
|
uint32_t switchState(uint8_t pos_idx)
|
||||||
{
|
{
|
||||||
@@ -72,9 +100,9 @@ uint32_t switchState(uint8_t pos_idx)
|
|||||||
SwitchHwPos switchGetPosition(uint8_t sw_idx)
|
SwitchHwPos switchGetPosition(uint8_t sw_idx)
|
||||||
{
|
{
|
||||||
auto idx = (int)sw_idx;
|
auto idx = (int)sw_idx;
|
||||||
auto max_switches = boardGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
if (idx < max_switches) {
|
if (idx < max_switches) {
|
||||||
return boardSwitchGetPosition(SWITCH_PHYSICAL, idx);
|
return boardSwitchGetPosition(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
idx -= max_switches;
|
idx -= max_switches;
|
||||||
@@ -95,12 +123,6 @@ SwitchHwPos switchGetPosition(uint8_t sw_idx)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx -= MAX_FLEX_SWITCHES;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idx < boardGetMaxFctSwitches()) {
|
|
||||||
return boardSwitchGetPosition(SWITCH_FUNCTION, idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_HW_UP;
|
return SWITCH_HW_UP;
|
||||||
@@ -113,12 +135,12 @@ static const char * const _flex_sw_canon_names[] = {
|
|||||||
static_assert(DIM(_flex_sw_canon_names) >= MAX_FLEX_SWITCHES,
|
static_assert(DIM(_flex_sw_canon_names) >= MAX_FLEX_SWITCHES,
|
||||||
"Missing canonical name for flex switches");
|
"Missing canonical name for flex switches");
|
||||||
|
|
||||||
const char* switchGetName(uint8_t sw_idx)
|
const char* switchGetDefaultName(uint8_t sw_idx)
|
||||||
{
|
{
|
||||||
auto idx = (int)sw_idx;
|
auto idx = (int)sw_idx;
|
||||||
auto max_switches = boardGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
if (idx < max_switches) {
|
if (idx < max_switches) {
|
||||||
return boardSwitchGetName(SWITCH_PHYSICAL, idx);
|
return boardSwitchGetName(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
idx -= max_switches;
|
idx -= max_switches;
|
||||||
@@ -129,20 +151,25 @@ const char* switchGetName(uint8_t sw_idx)
|
|||||||
|
|
||||||
idx -= MAX_FLEX_SWITCHES;
|
idx -= MAX_FLEX_SWITCHES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx < boardGetMaxFctSwitches()) {
|
|
||||||
return boardSwitchGetName(SWITCH_FUNCTION, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t switchGetIndexFromName(const char* name)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i += 1)
|
||||||
|
if (strcmp(name, boardSwitchGetName(i)) == 0)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
SwitchHwType switchGetHwType(uint8_t sw_idx)
|
SwitchHwType switchGetHwType(uint8_t sw_idx)
|
||||||
{
|
{
|
||||||
auto idx = (int)sw_idx;
|
auto idx = (int)sw_idx;
|
||||||
auto max_switches = boardGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
if (idx < max_switches) {
|
if (idx < max_switches) {
|
||||||
return boardSwitchGetType(SWITCH_PHYSICAL, idx);
|
return boardSwitchGetType(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
idx -= max_switches;
|
idx -= max_switches;
|
||||||
@@ -155,8 +182,8 @@ SwitchHwType switchGetHwType(uint8_t sw_idx)
|
|||||||
|
|
||||||
bool switchIsFlex(uint8_t idx)
|
bool switchIsFlex(uint8_t idx)
|
||||||
{
|
{
|
||||||
auto max_switches = boardGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
return idx >= max_switches && idx < max_switches + MAX_FLEX_SWITCHES;
|
return idx >= max_switches && idx < switchGetMaxAllSwitches();
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchConfigFlex_raw(uint8_t idx, int8_t channel)
|
void switchConfigFlex_raw(uint8_t idx, int8_t channel)
|
||||||
@@ -179,7 +206,7 @@ uint8_t switchGetFlexChannel(uint8_t idx)
|
|||||||
|
|
||||||
void switchConfigFlex(uint8_t idx, int8_t channel)
|
void switchConfigFlex(uint8_t idx, int8_t channel)
|
||||||
{
|
{
|
||||||
auto max_switches = boardGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
if (idx < max_switches) return;
|
if (idx < max_switches) return;
|
||||||
idx -= max_switches;
|
idx -= max_switches;
|
||||||
switchConfigFlex_raw(idx, channel);
|
switchConfigFlex_raw(idx, channel);
|
||||||
@@ -193,7 +220,7 @@ int8_t switchGetFlexConfig_raw(uint8_t idx)
|
|||||||
|
|
||||||
int8_t switchGetFlexConfig(uint8_t idx)
|
int8_t switchGetFlexConfig(uint8_t idx)
|
||||||
{
|
{
|
||||||
auto max_switches = boardGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
if (idx < max_switches) return _INVALID_ADC_CH;
|
if (idx < max_switches) return _INVALID_ADC_CH;
|
||||||
idx -= max_switches;
|
idx -= max_switches;
|
||||||
return switchGetFlexConfig_raw(idx);
|
return switchGetFlexConfig_raw(idx);
|
||||||
@@ -208,7 +235,7 @@ bool switchIsFlexValid_raw(uint8_t sw_idx)
|
|||||||
|
|
||||||
bool switchIsFlexValid(uint8_t idx)
|
bool switchIsFlexValid(uint8_t idx)
|
||||||
{
|
{
|
||||||
auto max_switches = boardGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
if (idx < max_switches) return false;
|
if (idx < max_switches) return false;
|
||||||
idx -= max_switches;
|
idx -= max_switches;
|
||||||
return switchIsFlexValid_raw(idx);
|
return switchIsFlexValid_raw(idx);
|
||||||
@@ -229,7 +256,7 @@ bool switchIsFlexInputAvailable(uint8_t idx, uint8_t channel)
|
|||||||
if (MAX_FLEX_SWITCHES == 0) return false;
|
if (MAX_FLEX_SWITCHES == 0) return false;
|
||||||
if (POT_CONFIG(channel) != FLEX_SWITCH) return false;
|
if (POT_CONFIG(channel) != FLEX_SWITCH) return false;
|
||||||
|
|
||||||
auto phy_switches = boardGetMaxSwitches();
|
auto phy_switches = switchGetMaxSwitches();
|
||||||
if (idx < phy_switches) return false;
|
if (idx < phy_switches) return false;
|
||||||
|
|
||||||
return is_flex_input_available(idx - phy_switches, channel);
|
return is_flex_input_available(idx - phy_switches, channel);
|
||||||
@@ -237,9 +264,8 @@ bool switchIsFlexInputAvailable(uint8_t idx, uint8_t channel)
|
|||||||
|
|
||||||
static void invalidate_flex_config(uint8_t flex_idx)
|
static void invalidate_flex_config(uint8_t flex_idx)
|
||||||
{
|
{
|
||||||
auto sw_idx = flex_idx + boardGetMaxSwitches();
|
auto sw_idx = flex_idx + switchGetMaxSwitches();
|
||||||
swconfig_t mask = (swconfig_t)SWITCH_CONFIG_MASK(sw_idx);
|
g_eeGeneral.switchSetType(sw_idx, SWITCH_NONE);
|
||||||
g_eeGeneral.switchConfig &= ~mask;
|
|
||||||
|
|
||||||
_flex_switches[flex_idx] = _INVALID_ADC_CH;
|
_flex_switches[flex_idx] = _INVALID_ADC_CH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "edgetx_types.h"
|
#include "edgetx_types.h"
|
||||||
|
#include "edgetx_constants.h"
|
||||||
|
|
||||||
enum SwitchHwType {
|
enum SwitchHwType {
|
||||||
SWITCH_HW_2POS = 0,
|
SWITCH_HW_2POS = 0,
|
||||||
@@ -36,21 +37,22 @@ enum SwitchHwPos {
|
|||||||
SWITCH_HW_DOWN,
|
SWITCH_HW_DOWN,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SwitchCategory {
|
|
||||||
SWITCH_PHYSICAL=0,
|
|
||||||
SWITCH_FUNCTION,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define SWITCH_HW_INVERTED 1
|
#define SWITCH_HW_INVERTED 1
|
||||||
|
|
||||||
// init hardware for switches
|
// init hardware for switches
|
||||||
void switchInit();
|
void switchInit();
|
||||||
|
|
||||||
// returns the factory configuration for all switches
|
// returns the factory configuration for all switches
|
||||||
swconfig_t switchGetDefaultConfig();
|
SwitchConfig switchGetDefaultConfig(uint8_t n);
|
||||||
|
|
||||||
// returns the maximum number of regular switches supported in hardware (customizable switches NOT included)
|
bool switchIsCustomSwitch(int sw);
|
||||||
|
uint8_t switchGetCustomSwitchIdx(uint8_t sw);
|
||||||
|
uint8_t switchGetSwitchFromCustomIdx(uint8_t sw);
|
||||||
|
|
||||||
|
// returns the maximum number of physical + custom switches supported in hardware
|
||||||
uint8_t switchGetMaxSwitches();
|
uint8_t switchGetMaxSwitches();
|
||||||
|
// returns the maximum number of physical + custom + flex switches supported in hardware
|
||||||
|
uint8_t switchGetMaxAllSwitches();
|
||||||
|
|
||||||
// returns the number of configured switches
|
// returns the number of configured switches
|
||||||
uint8_t getSwitchCount();
|
uint8_t getSwitchCount();
|
||||||
@@ -58,9 +60,6 @@ uint8_t getSwitchCount();
|
|||||||
// returns the highest row for a specified column
|
// returns the highest row for a specified column
|
||||||
uint8_t switchGetMaxRow(uint8_t col);
|
uint8_t switchGetMaxRow(uint8_t col);
|
||||||
|
|
||||||
// returns the maximum number of customizable switches supported in hardware
|
|
||||||
uint8_t switchGetMaxFctSwitches();
|
|
||||||
|
|
||||||
struct switch_display_pos_t {
|
struct switch_display_pos_t {
|
||||||
uint8_t col;
|
uint8_t col;
|
||||||
uint8_t row;
|
uint8_t row;
|
||||||
@@ -83,20 +82,12 @@ void switchConfigFlex_raw(uint8_t idx, int8_t channel);
|
|||||||
int8_t switchGetFlexConfig_raw(uint8_t idx);
|
int8_t switchGetFlexConfig_raw(uint8_t idx);
|
||||||
bool switchIsFlexValid_raw(uint8_t idx);
|
bool switchIsFlexValid_raw(uint8_t idx);
|
||||||
|
|
||||||
// The functions bellow support regular as well as customizable switches.
|
|
||||||
//
|
|
||||||
// Regular switches are indexed from `0` to `switchGetMaxSwitches() - 1`
|
|
||||||
// Customizable switches are indexed above the previous range.
|
|
||||||
//
|
|
||||||
// The total number of switches (and max index + 1) is:
|
|
||||||
// switchGetMaxSwitches() + switchGetMaxFctSwitches()
|
|
||||||
//
|
|
||||||
|
|
||||||
// returns state (0 / 1) of a specific switch position
|
// returns state (0 / 1) of a specific switch position
|
||||||
uint32_t switchState(uint8_t pos_idx);
|
uint32_t switchState(uint8_t pos_idx);
|
||||||
|
|
||||||
// returns a position for a switch index
|
// returns a position for a switch index
|
||||||
SwitchHwPos switchGetPosition(uint8_t idx);
|
SwitchHwPos switchGetPosition(uint8_t idx);
|
||||||
|
|
||||||
const char* switchGetName(uint8_t idx);
|
const char* switchGetDefaultName(uint8_t idx);
|
||||||
SwitchHwType switchGetHwType(uint8_t idx);
|
SwitchHwType switchGetHwType(uint8_t idx);
|
||||||
|
int8_t switchGetIndexFromName(const char* name);
|
||||||
|
|||||||
+2
-2
@@ -198,7 +198,7 @@ void writeHeader()
|
|||||||
f_puts(",", &g_oLogFile);
|
f_puts(",", &g_oLogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
for (uint8_t i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
char s[LEN_SWITCH_NAME + 2];
|
char s[LEN_SWITCH_NAME + 2];
|
||||||
char * temp;
|
char * temp;
|
||||||
@@ -341,7 +341,7 @@ void logsWrite()
|
|||||||
f_printf(&g_oLogFile, "%d,", calibratedAnalogs[offset + i]);
|
f_printf(&g_oLogFile, "%d,", calibratedAnalogs[offset + i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
for (uint8_t i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
f_printf(&g_oLogFile, "%d,", getSwitchState(i));
|
f_printf(&g_oLogFile, "%d,", getSwitchState(i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ LROT_BEGIN(lvgllib, NULL, 0)
|
|||||||
LROT_FUNCENTRY(box, [](lua_State* L) { return luaLvglObjEx(L, []() { return new LvglWidgetBox(); }); })
|
LROT_FUNCENTRY(box, [](lua_State* L) { return luaLvglObjEx(L, []() { return new LvglWidgetBox(); }); })
|
||||||
LROT_FUNCENTRY(setting, [](lua_State* L) { return luaLvglObjEx(L, []() { return new LvglWidgetSetting(); }, true); })
|
LROT_FUNCENTRY(setting, [](lua_State* L) { return luaLvglObjEx(L, []() { return new LvglWidgetSetting(); }, true); })
|
||||||
LROT_FUNCENTRY(page, [](lua_State* L) { return luaLvglObj(L, []() { return new LvglWidgetPage(); }, true); })
|
LROT_FUNCENTRY(page, [](lua_State* L) { return luaLvglObj(L, []() { return new LvglWidgetPage(); }, true); })
|
||||||
LROT_FUNCENTRY(dialog, [](lua_State* L) { return luaLvglObjEx(L, []() { return new LvglWidgetDialog(); }, true); })
|
LROT_FUNCENTRY(dialog, [](lua_State* L) { return luaLvglObj(L, []() { return new LvglWidgetDialog(); }, true); })
|
||||||
// Dialogs
|
// Dialogs
|
||||||
LROT_FUNCENTRY(confirm, [](lua_State* L) { return luaLvglPopup(L, []() { return new LvglWidgetConfirmDialog(); }); })
|
LROT_FUNCENTRY(confirm, [](lua_State* L) { return luaLvglPopup(L, []() { return new LvglWidgetConfirmDialog(); }); })
|
||||||
LROT_FUNCENTRY(message, [](lua_State* L) { return luaLvglPopup(L, []() { return new LvglWidgetMessageDialog(); }); })
|
LROT_FUNCENTRY(message, [](lua_State* L) { return luaLvglPopup(L, []() { return new LvglWidgetMessageDialog(); }); })
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "input_mapping.h"
|
#include "input_mapping.h"
|
||||||
#if defined(LED_STRIP_GPIO)
|
#if defined(LED_STRIP_GPIO)
|
||||||
#include "boards/generic_stm32/rgb_leds.h"
|
#include "boards/generic_stm32/rgb_leds.h"
|
||||||
|
#include "hal/rgbleds.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -2843,7 +2844,15 @@ static int luaGetTrainerStatus(lua_State * L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LED_STRIP_GPIO)
|
// To simplify code below
|
||||||
|
#if !defined(BLING_LED_STRIP_LENGTH)
|
||||||
|
#define BLING_LED_STRIP_LENGTH 0
|
||||||
|
#endif
|
||||||
|
#if !defined(CFS_LED_STRIP_LENGTH)
|
||||||
|
#define CFS_LED_STRIP_LENGTH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (BLING_LED_STRIP_LENGTH > 0) || (CFS_LED_STRIP_LENGTH > 0)
|
||||||
/*luadoc
|
/*luadoc
|
||||||
@function setRGBLedColor(id, rvalue, bvalue, cvalue)
|
@function setRGBLedColor(id, rvalue, bvalue, cvalue)
|
||||||
|
|
||||||
@@ -2855,28 +2864,101 @@ static int luaGetTrainerStatus(lua_State * L)
|
|||||||
|
|
||||||
@param bvalue: interger, value of blue channel
|
@param bvalue: interger, value of blue channel
|
||||||
|
|
||||||
|
@retval: true if LED index is valid, false otherwise
|
||||||
|
|
||||||
@status current Introduced in 2.10
|
@status current Introduced in 2.10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int luaSetRgbLedColor(lua_State * L)
|
static int luaSetRgbLedColor(lua_State * L)
|
||||||
{
|
{
|
||||||
uint8_t id = luaL_checkunsigned(L, 1);
|
uint8_t id = luaL_checkunsigned(L, 1);
|
||||||
|
|
||||||
|
if (id >= (BLING_LED_STRIP_LENGTH + CFS_LED_STRIP_LENGTH)) {
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t r = luaL_checkunsigned(L, 2);
|
uint8_t r = luaL_checkunsigned(L, 2);
|
||||||
uint8_t g = luaL_checkunsigned(L, 3);
|
uint8_t g = luaL_checkunsigned(L, 3);
|
||||||
uint8_t b = luaL_checkunsigned(L, 4);
|
uint8_t b = luaL_checkunsigned(L, 4);
|
||||||
|
|
||||||
#if defined(LED_STRIP_RESERVED_AT_END)
|
#if CFS_LED_STRIP_LENGTH > 0
|
||||||
if (id >= LED_STRIP_LENGTH - LED_STRIP_RESERVED_AT_END) {
|
if (id >= BLING_LED_STRIP_LENGTH) {
|
||||||
|
id -= BLING_LED_STRIP_LENGTH;
|
||||||
|
uint8_t swIdx = switchGetSwitchFromCustomIdx(id / CFS_LEDS_PER_SWITCH);
|
||||||
|
if (g_model.getSwitchType(swIdx) == SWITCH_NONE) {
|
||||||
|
rgbSetLedColor(id + CFS_LED_STRIP_START, r, g, b);
|
||||||
|
} else {
|
||||||
lua_pushboolean(L, false);
|
lua_pushboolean(L, false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
} else {
|
||||||
|
rgbSetLedColor(id + BLING_LED_STRIP_START, r, g, b);
|
||||||
rgbSetLedColor(id, r, g, b);
|
}
|
||||||
|
#else
|
||||||
|
rgbSetLedColor(id + BLING_LED_STRIP_START, r, g, b);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lua_pushboolean(L, true);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (CFS_LED_STRIP_LENGTH > 0)
|
||||||
|
/*luadoc
|
||||||
|
@function setCFSLedColor(id, rvalue, bvalue, cvalue)
|
||||||
|
|
||||||
|
Overrides the LED color for a custom function switch
|
||||||
|
- if passed 4 arguments (id, r, g, b) then sets override color
|
||||||
|
- if passed 1 argument (id) then cancels override color
|
||||||
|
|
||||||
|
@param id: string identifying a custom function switch name
|
||||||
|
|
||||||
|
@param rvalue: interger, value of red channel
|
||||||
|
|
||||||
|
@param gvalue: interger, value of green channel
|
||||||
|
|
||||||
|
@param bvalue: interger, value of blue channel
|
||||||
|
|
||||||
|
@retval: true if LED index is valid, false otherwise
|
||||||
|
|
||||||
|
@status current Introduced in ???
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int luaSetCFSLedColor(lua_State * L)
|
||||||
|
{
|
||||||
|
uint8_t r = 0, g = 0, b = 0;
|
||||||
|
int n = lua_gettop(L);
|
||||||
|
const char* nm = luaL_checkstring(L, 1);
|
||||||
|
|
||||||
|
int8_t id = switchGetIndexFromName(nm);
|
||||||
|
|
||||||
|
if (id < 0) {
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t cfsIdx = switchGetCustomSwitchIdx(id);
|
||||||
|
|
||||||
|
if (cfsIdx >= CFS_LED_STRIP_LENGTH / CFS_LEDS_PER_SWITCH) {
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n > 1) {
|
||||||
|
r = luaL_checkunsigned(L, 2);
|
||||||
|
g = luaL_checkunsigned(L, 3);
|
||||||
|
b = luaL_checkunsigned(L, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
setFSLedOverride(cfsIdx, n > 1, r, g, b);
|
||||||
|
|
||||||
|
lua_pushboolean(L, true);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LED_STRIP_LENGTH)
|
||||||
/*luadoc
|
/*luadoc
|
||||||
@function applyRGBLedColors()
|
@function applyRGBLedColors()
|
||||||
|
|
||||||
@@ -2892,7 +2974,6 @@ static int luaApplyRGBLedColors(lua_State * L)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -2997,9 +3078,12 @@ LROT_BEGIN(etxlib, NULL, 0)
|
|||||||
LROT_FUNCENTRY( getSourceIndex, luaGetSourceIndex )
|
LROT_FUNCENTRY( getSourceIndex, luaGetSourceIndex )
|
||||||
LROT_FUNCENTRY( getSourceName, luaGetSourceName )
|
LROT_FUNCENTRY( getSourceName, luaGetSourceName )
|
||||||
LROT_FUNCENTRY( sources, luaSources )
|
LROT_FUNCENTRY( sources, luaSources )
|
||||||
#if defined(LED_STRIP_GPIO)
|
#if (BLING_LED_STRIP_LENGTH > 0) || (CFS_LED_STRIP_LENGTH > 0)
|
||||||
LROT_FUNCENTRY(setRGBLedColor, luaSetRgbLedColor )
|
LROT_FUNCENTRY( setRGBLedColor, luaSetRgbLedColor )
|
||||||
LROT_FUNCENTRY(applyRGBLedColors, luaApplyRGBLedColors )
|
LROT_FUNCENTRY( applyRGBLedColors, luaApplyRGBLedColors )
|
||||||
|
#endif
|
||||||
|
#if (CFS_LED_STRIP_LENGTH > 0)
|
||||||
|
LROT_FUNCENTRY( setCFSLedColor, luaSetCFSLedColor )
|
||||||
#endif
|
#endif
|
||||||
LROT_FUNCENTRY( getStickMode, luaGetStickMode )
|
LROT_FUNCENTRY( getStickMode, luaGetStickMode )
|
||||||
LROT_END(etxlib, NULL, 0)
|
LROT_END(etxlib, NULL, 0)
|
||||||
@@ -3144,18 +3228,8 @@ LROT_BEGIN(etxcst, NULL, 0)
|
|||||||
LROT_NUMENTRY( PLAY_NOW, PLAY_NOW )
|
LROT_NUMENTRY( PLAY_NOW, PLAY_NOW )
|
||||||
LROT_NUMENTRY( PLAY_BACKGROUND, PLAY_BACKGROUND )
|
LROT_NUMENTRY( PLAY_BACKGROUND, PLAY_BACKGROUND )
|
||||||
LROT_NUMENTRY( TIMEHOUR, TIMEHOUR )
|
LROT_NUMENTRY( TIMEHOUR, TIMEHOUR )
|
||||||
#if defined(LED_STRIP_GPIO)
|
#if (BLING_LED_STRIP_LENGTH > 0) || (CFS_LED_STRIP_LENGTH > 0)
|
||||||
#if defined(RADIO_V16)
|
LROT_NUMENTRY( LED_STRIP_LENGTH, BLING_LED_STRIP_LENGTH + CFS_LED_STRIP_LENGTH )
|
||||||
LROT_NUMENTRY( LED_STRIP_LENGTH, LED_STRIP_LENGTH - 6 )
|
|
||||||
#elif defined(RGB_LED_OFFSET)
|
|
||||||
// Exclude function switch LEDs
|
|
||||||
LROT_NUMENTRY( LED_STRIP_LENGTH, LED_STRIP_LENGTH - RGB_LED_OFFSET )
|
|
||||||
#elif defined(LED_STRIP_RESERVED_AT_END)
|
|
||||||
// Exclude leds at the end of the strip
|
|
||||||
LROT_NUMENTRY( LED_STRIP_LENGTH, LED_STRIP_LENGTH - LED_STRIP_RESERVED_AT_END )
|
|
||||||
#else
|
|
||||||
LROT_NUMENTRY( LED_STRIP_LENGTH, LED_STRIP_LENGTH )
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
LROT_NUMENTRY( UNIT_RAW, UNIT_RAW )
|
LROT_NUMENTRY( UNIT_RAW, UNIT_RAW )
|
||||||
LROT_NUMENTRY( UNIT_VOLTS, UNIT_VOLTS )
|
LROT_NUMENTRY( UNIT_VOLTS, UNIT_VOLTS )
|
||||||
|
|||||||
+14
-16
@@ -424,18 +424,14 @@ getvalue_t _getValue(mixsrc_t i, bool* valid)
|
|||||||
else if (i >= MIXSRC_FIRST_SWITCH && i <= MIXSRC_LAST_SWITCH) {
|
else if (i >= MIXSRC_FIRST_SWITCH && i <= MIXSRC_LAST_SWITCH) {
|
||||||
auto sw_idx = (uint8_t)(i - MIXSRC_FIRST_SWITCH);
|
auto sw_idx = (uint8_t)(i - MIXSRC_FIRST_SWITCH);
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
auto max_reg_switches = switchGetMaxSwitches();
|
auto max_switches = switchGetMaxSwitches();
|
||||||
if (sw_idx >= max_reg_switches) {
|
if (sw_idx < max_switches && switchIsCustomSwitch(sw_idx)) {
|
||||||
auto fct_idx = sw_idx - max_reg_switches;
|
return _switch_2pos_lookup[g_model.cfsState(sw_idx)];
|
||||||
auto max_fct_switches = switchGetMaxFctSwitches();
|
|
||||||
if (fct_idx < max_fct_switches) {
|
|
||||||
return _switch_2pos_lookup[getFSLogicalState(fct_idx)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
auto sw_cfg = (SwitchConfig)SWITCH_CONFIG(sw_idx);
|
auto sw_cfg = g_model.getSwitchType(sw_idx);
|
||||||
switch(sw_cfg) {
|
switch(sw_cfg) {
|
||||||
case SWITCH_NONE:
|
default:
|
||||||
if (valid != nullptr) *valid = false;
|
if (valid != nullptr) *valid = false;
|
||||||
return 0;
|
return 0;
|
||||||
case SWITCH_TOGGLE:
|
case SWITCH_TOGGLE:
|
||||||
@@ -452,18 +448,20 @@ getvalue_t _getValue(mixsrc_t i, bool* valid)
|
|||||||
if (stepcount == 0)
|
if (stepcount == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (IS_FSWITCH_GROUP_ON(group_idx))
|
if (g_model.cfsGroupAlwaysOn(group_idx))
|
||||||
stepcount--;
|
stepcount--;
|
||||||
|
|
||||||
int stepsize = (2 * RESX) / stepcount;
|
int stepsize = (2 * RESX) / stepcount;
|
||||||
int value = -RESX;
|
int value = -RESX;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < switchGetMaxFctSwitches(); i++) {
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
if(FSWITCH_GROUP(i) == group_idx) {
|
if (switchIsCustomSwitch(i)) {
|
||||||
if (getFSLogicalState(i) == 1)
|
if (g_model.getSwitchGroup(i) == group_idx) {
|
||||||
return value + (IS_FSWITCH_GROUP_ON(group_idx) ? 0 : stepsize);
|
if (g_model.cfsState(i) == 1)
|
||||||
else
|
return value + (g_model.cfsGroupAlwaysOn(group_idx) ? 0 : stepsize);
|
||||||
value += stepsize;
|
else
|
||||||
|
value += stepsize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -RESX;
|
return -RESX;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ bool getSwitchAudioFile(char* path, swsrc_t index)
|
|||||||
|
|
||||||
if (index <= SWSRC_LAST_SWITCH) {
|
if (index <= SWSRC_LAST_SWITCH) {
|
||||||
div_t swinfo = switchInfo(index);
|
div_t swinfo = switchInfo(index);
|
||||||
auto sw_name = switchGetName(swinfo.quot);
|
auto sw_name = switchGetDefaultName(swinfo.quot);
|
||||||
if (!sw_name) return false;
|
if (!sw_name) return false;
|
||||||
str = strAppend(str, sw_name);
|
str = strAppend(str, sw_name);
|
||||||
str = strAppend(str, _sw_positions[swinfo.rem]);
|
str = strAppend(str, _sw_positions[swinfo.rem]);
|
||||||
@@ -116,9 +116,9 @@ bool matchModeAudioFile(const char* filename, int& index, int& event)
|
|||||||
bool matchSwitchAudioFile(const char* filename, int& sw_pos)
|
bool matchSwitchAudioFile(const char* filename, int& sw_pos)
|
||||||
{
|
{
|
||||||
// Switches Audio Files <switchname>-[up|mid|down].wav
|
// Switches Audio Files <switchname>-[up|mid|down].wav
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
auto* c = filename;
|
auto* c = filename;
|
||||||
auto sw_name = switchGetName(i);
|
auto sw_name = switchGetDefaultName(i);
|
||||||
auto sw_name_len = strlen(sw_name);
|
auto sw_name_len = strlen(sw_name);
|
||||||
if (strncasecmp(c, sw_name, sw_name_len) != 0) continue;
|
if (strncasecmp(c, sw_name, sw_name_len) != 0) continue;
|
||||||
c += sw_name_len;
|
c += sw_name_len;
|
||||||
|
|||||||
+24
-28
@@ -100,6 +100,26 @@ void setVendorSpecificModelDefaults(uint8_t id)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
void initCustomSwitches()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < switchGetMaxSwitches(); i += 1) {
|
||||||
|
if (switchIsCustomSwitch(i)) {
|
||||||
|
uint8_t idx = switchGetCustomSwitchIdx(i);
|
||||||
|
g_model.customSwitches[idx].type = SWITCH_GLOBAL;
|
||||||
|
g_model.customSwitches[idx].group = 0;
|
||||||
|
g_model.customSwitches[idx].start = FS_START_PREVIOUS;
|
||||||
|
g_model.customSwitches[idx].state = 0;
|
||||||
|
g_model.customSwitches[idx].name[0] = 0;
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
g_model.customSwitches[idx].offColor.setColor(0);
|
||||||
|
g_model.customSwitches[idx].onColor.setColor(0xFFFFFF);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void applyDefaultTemplate()
|
void applyDefaultTemplate()
|
||||||
{
|
{
|
||||||
setDefaultInputs();
|
setDefaultInputs();
|
||||||
@@ -110,42 +130,18 @@ void applyDefaultTemplate()
|
|||||||
setDefaultModelRegistrationID();
|
setDefaultModelRegistrationID();
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
g_model.functionSwitchConfig = DEFAULT_FS_CONFIG;
|
initCustomSwitches();
|
||||||
g_model.functionSwitchGroup = DEFAULT_FS_GROUPS;
|
|
||||||
g_model.functionSwitchStartConfig = DEFAULT_FS_STARTUP_CONFIG;
|
|
||||||
g_model.functionSwitchLogicalState = 0;
|
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
|
||||||
g_model.functionSwitchLedOFFColor[i].setColor(0);
|
|
||||||
g_model.functionSwitchLedONColor[i].setColor(0xFFFFFF);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
|
||||||
g_model.functionSwitchLedOFFColor[i].setColor(0);
|
|
||||||
g_model.functionSwitchLedONColor[i].setColor(0xFFFFFF);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
|
|
||||||
LayoutFactory::loadDefaultLayout();
|
LayoutFactory::loadDefaultLayout();
|
||||||
|
#endif
|
||||||
|
|
||||||
// enable switch warnings
|
// enable switch warnings
|
||||||
for (uint64_t i = 0; i < MAX_SWITCHES; i++) {
|
for (uint64_t i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
|
||||||
g_model.switchWarning |= (1ull << (3ull * i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
// enable switch warnings
|
|
||||||
for (uint64_t i = 0; i < MAX_SWITCHES; i++) {
|
|
||||||
if (SWITCH_WARNING_ALLOWED(i))
|
if (SWITCH_WARNING_ALLOWED(i))
|
||||||
g_model.switchWarning |= (1ull << (3ull * i));
|
g_model.setSwitchWarning(i, 1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_HATS_AS_KEYS)
|
#if defined(USE_HATS_AS_KEYS)
|
||||||
g_model.hatsMode = HATSMODE_GLOBAL;
|
g_model.hatsMode = HATSMODE_GLOBAL;
|
||||||
|
|||||||
+5
-23
@@ -85,28 +85,10 @@
|
|||||||
#define SW_CFG_MASK ((1 << SW_CFG_BITS) - 1)
|
#define SW_CFG_MASK ((1 << SW_CFG_BITS) - 1)
|
||||||
#define SWITCH_CONFIG_MASK(x) ((swconfig_t)SW_CFG_MASK << (SW_CFG_BITS * (x)))
|
#define SWITCH_CONFIG_MASK(x) ((swconfig_t)SW_CFG_MASK << (SW_CFG_BITS * (x)))
|
||||||
|
|
||||||
#define SWITCH_CONFIG(x) (bfGet<swconfig_t>(g_eeGeneral.switchConfig, SW_CFG_BITS * (x), SW_CFG_BITS))
|
#define SWITCH_EXISTS(x) (g_model.getSwitchType(x) != SWITCH_NONE)
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#define IS_CONFIG_3POS(x) (g_model.getSwitchType(x) == SWITCH_3POS)
|
||||||
#define FSW_CFG_BITS 2
|
#define IS_CONFIG_TOGGLE(x) (g_model.getSwitchType(x) == SWITCH_TOGGLE)
|
||||||
#define FSWITCH_CONFIG(x) (bfGet<swconfig_t>(g_model.functionSwitchConfig, FSW_CFG_BITS * (x), FSW_CFG_BITS))
|
#define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !IS_CONFIG_TOGGLE(x))
|
||||||
#define FSWITCH_SET_CONFIG(x,v) g_model.functionSwitchConfig = bfSet<swconfig_t>(g_model.functionSwitchConfig, v, FSW_CFG_BITS * (x), FSW_CFG_BITS)
|
|
||||||
#define FSWITCH_GROUP(x) (bfGet<swconfig_t>(g_model.functionSwitchGroup, FSW_CFG_BITS * (x), FSW_CFG_BITS))
|
|
||||||
#define FSWITCH_SET_GROUP(x,v) g_model.functionSwitchGroup = bfSet<swconfig_t>(g_model.functionSwitchGroup, v, FSW_CFG_BITS * (x), FSW_CFG_BITS)
|
|
||||||
#define FSWITCH_STARTUP(x) (bfGet<swconfig_t>(g_model.functionSwitchStartConfig, FSW_CFG_BITS * (x), FSW_CFG_BITS))
|
|
||||||
#define FSWITCH_SET_STARTUP(x,v) g_model.functionSwitchStartConfig = bfSet<swconfig_t>(g_model.functionSwitchStartConfig, v, FSW_CFG_BITS * (x), FSW_CFG_BITS)
|
|
||||||
#define IS_FSWITCH_GROUP_ON(x) (bfGet<swconfig_t>(g_model.functionSwitchGroup, FSW_CFG_BITS * NUM_FUNCTIONS_SWITCHES + x, 1))
|
|
||||||
#define SET_FSWITCH_GROUP_ON(x,v) g_model.functionSwitchGroup = bfSet<swconfig_t>(g_model.functionSwitchGroup, v, FSW_CFG_BITS * NUM_FUNCTIONS_SWITCHES + x, 1)
|
|
||||||
#define IS_SWITCH_FS(x) (x >= switchGetMaxSwitches() && x < (switchGetMaxSwitches() + switchGetMaxFctSwitches()))
|
|
||||||
#define SWITCH_EXISTS(x) (IS_SWITCH_FS(x) ? true : (SWITCH_CONFIG(x) != SWITCH_NONE))
|
|
||||||
#define IS_CONFIG_3POS(x) (IS_SWITCH_FS(x) ? (FSWITCH_CONFIG(x - switchGetMaxSwitches()) == SWITCH_3POS) : (SWITCH_CONFIG(x) == SWITCH_3POS))
|
|
||||||
#define IS_CONFIG_TOGGLE(x) (IS_SWITCH_FS(x) ? (FSWITCH_CONFIG(x - switchGetMaxSwitches()) == SWITCH_TOGGLE) : (SWITCH_CONFIG(x) == SWITCH_TOGGLE))
|
|
||||||
#else
|
|
||||||
#define SWITCH_EXISTS(x) (SWITCH_CONFIG(x) != SWITCH_NONE)
|
|
||||||
#define IS_CONFIG_3POS(x) (SWITCH_CONFIG(x) == SWITCH_3POS)
|
|
||||||
#define IS_CONFIG_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
|
|
||||||
#define IS_SWITCH_FS(x) (false)
|
|
||||||
#endif
|
|
||||||
#define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !(IS_CONFIG_TOGGLE(x) || IS_SWITCH_FS(x)))
|
|
||||||
|
|
||||||
#define ALTERNATE_VIEW 0x10
|
#define ALTERNATE_VIEW 0x10
|
||||||
|
|
||||||
@@ -267,4 +249,4 @@ constexpr uint8_t EE_GENERAL = 0x01;
|
|||||||
constexpr uint8_t EE_MODEL = 0x02;
|
constexpr uint8_t EE_MODEL = 0x02;
|
||||||
constexpr uint8_t EE_LABELS = 0x04;
|
constexpr uint8_t EE_LABELS = 0x04;
|
||||||
|
|
||||||
#endif // _MYEEPROM_H_
|
#endif // _MYEEPROM_H_
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ const char * loadRadioSettings()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
adcCalibDefaults();
|
adcCalibDefaults();
|
||||||
|
generalDefaultSwitches();
|
||||||
|
|
||||||
const char* error = loadRadioSettingsYaml(true);
|
const char* error = loadRadioSettingsYaml(true);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@@ -191,8 +192,6 @@ const char * loadRadioSettings()
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct yaml_checksummer_ctx {
|
struct yaml_checksummer_ctx {
|
||||||
FRESULT result;
|
FRESULT result;
|
||||||
uint16_t checksum;
|
uint16_t checksum;
|
||||||
@@ -341,6 +340,10 @@ const char * readModelYaml(const char * filename, uint8_t * buffer, uint32_t siz
|
|||||||
memset(buffer,0,size);
|
memset(buffer,0,size);
|
||||||
|
|
||||||
if (init_model) {
|
if (init_model) {
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
extern void initCustomSwitches();
|
||||||
|
initCustomSwitches();
|
||||||
|
#endif
|
||||||
auto md = reinterpret_cast<ModelData*>(buffer);
|
auto md = reinterpret_cast<ModelData*>(buffer);
|
||||||
#if defined(FLIGHT_MODES) && defined(GVARS)
|
#if defined(FLIGHT_MODES) && defined(GVARS)
|
||||||
// reset GVars to default values
|
// reset GVars to default values
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -221,7 +232,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -255,13 +266,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -275,12 +293,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -313,7 +331,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -340,7 +358,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -381,7 +399,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -402,7 +420,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -462,7 +480,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -475,7 +493,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -633,7 +651,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -683,7 +701,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -727,7 +745,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -776,7 +794,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -816,16 +834,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -840,19 +857,19 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -90,6 +90,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -240,7 +251,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -274,13 +285,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -292,12 +310,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_PADDING( 16 ),
|
YAML_PADDING( 16 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -330,7 +348,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -357,7 +375,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -409,7 +427,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -430,7 +448,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -490,7 +508,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -503,7 +521,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -661,7 +679,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -711,7 +729,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -755,7 +773,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -779,7 +797,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -811,7 +829,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -851,16 +869,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -876,20 +893,20 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ static bool w_mixSrcRaw(const YamlNode* node, uint32_t val, yaml_writer_func wf,
|
|||||||
}
|
}
|
||||||
else if (val >= MIXSRC_FIRST_SWITCH
|
else if (val >= MIXSRC_FIRST_SWITCH
|
||||||
&& val <= MIXSRC_LAST_SWITCH) {
|
&& val <= MIXSRC_LAST_SWITCH) {
|
||||||
str = switchGetCanonicalName(val - MIXSRC_FIRST_SWITCH);
|
str = switchGetDefaultName(val - MIXSRC_FIRST_SWITCH);
|
||||||
}
|
}
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
else if (val >= MIXSRC_FIRST_CUSTOMSWITCH_GROUP
|
else if (val >= MIXSRC_FIRST_CUSTOMSWITCH_GROUP
|
||||||
@@ -847,60 +847,30 @@ static const struct YamlNode struct_sliderConfig[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t sw_read(void* user, const char* val, uint8_t val_len)
|
static uint32_t sw_idx_read(void* user, const char* val, uint8_t val_len)
|
||||||
{
|
{
|
||||||
(void)user;
|
(void)user;
|
||||||
return switchLookupIdx(val, val_len);
|
return switchLookupIdx(val, val_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sw_write(void* user, yaml_writer_func wf, void* opaque)
|
static bool currentSwitchIsCFS = false;
|
||||||
|
|
||||||
|
bool sw_idx_write(void* user, yaml_writer_func wf, void* opaque)
|
||||||
{
|
{
|
||||||
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
||||||
uint16_t idx = tw->getElmts();
|
uint16_t idx = tw->getElmts();
|
||||||
|
|
||||||
const char* str = switchGetCanonicalName(idx);
|
currentSwitchIsCFS = switchIsCustomSwitch(idx);
|
||||||
|
|
||||||
|
const char* str = switchGetDefaultName(idx);
|
||||||
return str ? wf(opaque, str, strlen(str)) : true;
|
return str ? wf(opaque, str, strlen(str)) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sw_name_read(void* user, uint8_t* data, uint32_t bitoffs,
|
bool switch_is_cfs(void* user, uint8_t* data, uint32_t bitoffs)
|
||||||
const char* val, uint8_t val_len)
|
|
||||||
{
|
{
|
||||||
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
return currentSwitchIsCFS;
|
||||||
uint16_t idx = tw->getElmts(1);
|
|
||||||
|
|
||||||
|
|
||||||
switchSetCustomName(idx, val, val_len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool sw_name_write(void* user, uint8_t* data, uint32_t bitoffs,
|
|
||||||
yaml_writer_func wf, void* opaque)
|
|
||||||
{
|
|
||||||
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
|
||||||
uint16_t idx = tw->getElmts(1);
|
|
||||||
|
|
||||||
|
|
||||||
const char* str = switchGetCustomName(idx);
|
|
||||||
if (!wf(opaque, "\"", 1)) return false;
|
|
||||||
if (!wf(opaque, str, strnlen(str, LEN_SWITCH_NAME)))
|
|
||||||
return false;
|
|
||||||
return wf(opaque, "\"", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct YamlIdStr enum_SwitchConfig[] = {
|
|
||||||
{ SWITCH_NONE, "none" },
|
|
||||||
{ SWITCH_TOGGLE, "toggle" },
|
|
||||||
{ SWITCH_2POS, "2pos" },
|
|
||||||
{ SWITCH_3POS, "3pos" },
|
|
||||||
{ 0, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct YamlNode struct_switchConfig[] = {
|
|
||||||
YAML_IDX_CUST( "sw", sw_read, sw_write),
|
|
||||||
YAML_ENUM( "type", 2, enum_SwitchConfig),
|
|
||||||
YAML_CUSTOM( "name", sw_name_read, sw_name_write),
|
|
||||||
YAML_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool flex_sw_valid(void* user, uint8_t* data, uint32_t bitoffs)
|
static bool flex_sw_valid(void* user, uint8_t* data, uint32_t bitoffs)
|
||||||
{
|
{
|
||||||
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
||||||
@@ -908,13 +878,11 @@ static bool flex_sw_valid(void* user, uint8_t* data, uint32_t bitoffs)
|
|||||||
return switchIsFlexValid_raw(idx);
|
return switchIsFlexValid_raw(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t boardGetMaxSwitches();
|
|
||||||
|
|
||||||
static uint32_t flex_sw_read(void* user, const char* val, uint8_t val_len)
|
static uint32_t flex_sw_read(void* user, const char* val, uint8_t val_len)
|
||||||
{
|
{
|
||||||
(void)user;
|
(void)user;
|
||||||
auto idx = switchLookupIdx(val, val_len);
|
auto idx = switchLookupIdx(val, val_len);
|
||||||
return idx - boardGetMaxSwitches();
|
return idx - switchGetMaxSwitches();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool flex_sw_write(void* user, yaml_writer_func wf, void* opaque)
|
bool flex_sw_write(void* user, yaml_writer_func wf, void* opaque)
|
||||||
@@ -922,8 +890,8 @@ bool flex_sw_write(void* user, yaml_writer_func wf, void* opaque)
|
|||||||
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
||||||
uint16_t idx = tw->getElmts();
|
uint16_t idx = tw->getElmts();
|
||||||
|
|
||||||
auto sw_offset = boardGetMaxSwitches();
|
auto sw_offset = switchGetMaxSwitches();
|
||||||
const char* str = switchGetCanonicalName(idx + sw_offset);
|
const char* str = switchGetDefaultName(idx + sw_offset);
|
||||||
return str ? wf(opaque, str, strlen(str)) : true;
|
return str ? wf(opaque, str, strlen(str)) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1002,7 +970,7 @@ static const struct YamlIdStr enum_PotConfig[] = {
|
|||||||
|
|
||||||
static const struct YamlNode struct_potConfig[] = {
|
static const struct YamlNode struct_potConfig[] = {
|
||||||
YAML_IDX_CUST("pot", pot_read, pot_write ),
|
YAML_IDX_CUST("pot", pot_read, pot_write ),
|
||||||
YAML_ENUM("type", POT_CFG_TYPE_BITS, enum_PotConfig),
|
YAML_ENUM("type", POT_CFG_TYPE_BITS, enum_PotConfig, NULL),
|
||||||
YAML_UNSIGNED("inv", POT_CFG_INV_BITS),
|
YAML_UNSIGNED("inv", POT_CFG_INV_BITS),
|
||||||
YAML_CUSTOM("name", pot_name_read, pot_name_write),
|
YAML_CUSTOM("name", pot_name_read, pot_name_write),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -1121,7 +1089,7 @@ static bool w_swtchSrc_unquoted(const YamlNode* node, uint32_t val,
|
|||||||
if (sval <= SWSRC_LAST_SWITCH) {
|
if (sval <= SWSRC_LAST_SWITCH) {
|
||||||
|
|
||||||
auto sw_info = switchInfo(sval);
|
auto sw_info = switchInfo(sval);
|
||||||
str = switchGetCanonicalName(sw_info.quot);
|
str = switchGetDefaultName(sw_info.quot);
|
||||||
if (!str) return true;
|
if (!str) return true;
|
||||||
wf(opaque, str, strlen(str));
|
wf(opaque, str, strlen(str));
|
||||||
str = yaml_unsigned2str(sw_info.rem);
|
str = yaml_unsigned2str(sw_info.rem);
|
||||||
@@ -1270,8 +1238,8 @@ static const struct YamlIdStr enum_SwitchWarnPos[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct YamlNode struct_swtchWarn[] {
|
static const struct YamlNode struct_swtchWarn[] {
|
||||||
YAML_IDX_CUST( "sw", sw_read, sw_write ),
|
YAML_IDX_CUST( "sw", sw_idx_read, sw_idx_write ),
|
||||||
YAML_ENUM( "pos", 2, enum_SwitchWarnPos ),
|
YAML_ENUM( "pos", 2, enum_SwitchWarnPos, NULL ),
|
||||||
YAML_END,
|
YAML_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2340,7 +2308,7 @@ static bool port_write(void* user, yaml_writer_func wf, void* opaque)
|
|||||||
|
|
||||||
static const struct YamlNode struct_serialConfig[] = {
|
static const struct YamlNode struct_serialConfig[] = {
|
||||||
YAML_IDX_CUST( "port", port_read, port_write),
|
YAML_IDX_CUST( "port", port_read, port_write),
|
||||||
YAML_ENUM( "mode", 4, enum_UartModes),
|
YAML_ENUM( "mode", 4, enum_UartModes, NULL),
|
||||||
YAML_PADDING( 3 ),
|
YAML_PADDING( 3 ),
|
||||||
YAML_UNSIGNED( "power", 1 ),
|
YAML_UNSIGNED( "power", 1 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -2369,3 +2337,165 @@ static void r_serialMode(void* user, uint8_t* data, uint32_t bitoffs,
|
|||||||
*serialPort = (*serialPort & ~(0xF << port_nr * SERIAL_CONF_BITS_PER_PORT)) |
|
*serialPort = (*serialPort & ~(0xF << port_nr * SERIAL_CONF_BITS_PER_PORT)) |
|
||||||
(m << port_nr * SERIAL_CONF_BITS_PER_PORT);
|
(m << port_nr * SERIAL_CONF_BITS_PER_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
|
||||||
|
static uint16_t getIdx(void *user)
|
||||||
|
{
|
||||||
|
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
||||||
|
return tw->getElmts(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_cfs_name(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint16_t idx = getIdx(user);
|
||||||
|
strAppend(g_model.customSwitches[idx].name, val, LEN_SWITCH_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct YamlNode struct_cfsNameConfig[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_CUSTOM( "val", r_cfs_name, nullptr),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||||
|
static void r_cfs_on_color_r(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint16_t idx = getIdx(user);
|
||||||
|
g_model.customSwitches[idx].onColor.r = yaml_str2uint(val, val_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_cfs_on_color_g(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint16_t idx = getIdx(user);
|
||||||
|
g_model.customSwitches[idx].onColor.g = yaml_str2uint(val, val_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_cfs_on_color_b(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint16_t idx = getIdx(user);
|
||||||
|
g_model.customSwitches[idx].onColor.b = yaml_str2uint(val, val_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct YamlNode struct_cfsOnColorConfig[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_CUSTOM( "r", r_cfs_on_color_r, nullptr),
|
||||||
|
YAML_CUSTOM( "g", r_cfs_on_color_g, nullptr),
|
||||||
|
YAML_CUSTOM( "b", r_cfs_on_color_b, nullptr),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
|
||||||
|
static void r_cfs_off_color_r(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint16_t idx = getIdx(user);
|
||||||
|
g_model.customSwitches[idx].offColor.r = yaml_str2uint(val, val_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_cfs_off_color_g(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint16_t idx = getIdx(user);
|
||||||
|
g_model.customSwitches[idx].offColor.g = yaml_str2uint(val, val_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_cfs_off_color_b(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint16_t idx = getIdx(user);
|
||||||
|
g_model.customSwitches[idx].offColor.b = yaml_str2uint(val, val_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct YamlNode struct_cfsOffColorConfig[] = {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_CUSTOM( "r", r_cfs_off_color_r, nullptr),
|
||||||
|
YAML_CUSTOM( "g", r_cfs_off_color_g, nullptr),
|
||||||
|
YAML_CUSTOM( "b", r_cfs_off_color_b, nullptr),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static uint32_t cfs_idx_read(void* user, const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
return switchGetCustomSwitchIdx(switchLookupIdx(val, val_len));
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool cfs_idx_write(void* user, yaml_writer_func wf, void* opaque)
|
||||||
|
{
|
||||||
|
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
||||||
|
uint16_t idx = tw->getElmts();
|
||||||
|
|
||||||
|
const char* str = switchGetDefaultName(switchGetSwitchFromCustomIdx(idx));
|
||||||
|
return str ? wf(opaque, str, strlen(str)) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct YamlNode struct_cfsGroupOn[] {
|
||||||
|
YAML_IDX,
|
||||||
|
YAML_UNSIGNED( "v", 1 ),
|
||||||
|
YAML_END,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void r_functionSwitchConfig(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint32_t v = yaml_str2uint(val, val_len);
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
g_model.customSwitches[i].type = (SwitchConfig)bfGet<uint16_t>(v, 2 * i, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_functionSwitchStartConfig(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint32_t v = yaml_str2uint(val, val_len);
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
uint8_t b = bfGet<uint16_t>(v, 2 * i, 2);
|
||||||
|
if (b < 2) b ^= 1; // Swap On & Off
|
||||||
|
g_model.customSwitches[i].start = (fsStartPositionType)b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_functionSwitchGroup(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint32_t v = yaml_str2uint(val, val_len);
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
g_model.customSwitches[i].group = bfGet<uint16_t>(v, 2 * i, 2);
|
||||||
|
}
|
||||||
|
for (int i = 0; i <= 3; i += 1) {
|
||||||
|
g_model.cfsSetGroupAlwaysOn(i, bfGet<uint16_t>(v, 2 * 6 + i, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r_functionSwitchLogicalState(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
|
{
|
||||||
|
uint32_t v = yaml_str2uint(val, val_len);
|
||||||
|
for (int i = 0; i < 6; i += 1) {
|
||||||
|
g_model.customSwitches[i].state = bfGet<uint16_t>(v, 1 * i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cfsGroupIsActive(void* user, uint8_t* data, uint32_t bitoffs)
|
||||||
|
{
|
||||||
|
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
||||||
|
uint16_t idx = tw->getElmts();
|
||||||
|
return idx > 0 && idx <= NUM_FUNCTIONS_GROUPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isAlwaysActive(void* user, uint8_t* data, uint32_t bitoffs)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool switchIsActive(void* user, uint8_t* data, uint32_t bitoffs)
|
||||||
|
{
|
||||||
|
auto tw = reinterpret_cast<YamlTreeWalker*>(user);
|
||||||
|
uint16_t idx = tw->getElmts();
|
||||||
|
return idx < switchGetMaxSwitches();
|
||||||
|
}
|
||||||
|
|||||||
@@ -89,6 +89,29 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_GLOBAL, "GLOBAL" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_fsStartPositionType[] = {
|
||||||
|
{ FS_START_OFF, "START_OFF" },
|
||||||
|
{ FS_START_ON, "START_ON" },
|
||||||
|
{ FS_START_PREVIOUS, "START_PREVIOUS" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_booleanEnum[] = {
|
||||||
|
{ BOOL_OFF, "OFF" },
|
||||||
|
{ BOOL_ON, "ON" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -222,7 +245,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -256,13 +279,31 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_RGBLedColor[] = {
|
||||||
|
YAML_UNSIGNED( "r", 8 ),
|
||||||
|
YAML_UNSIGNED( "g", 8 ),
|
||||||
|
YAML_UNSIGNED( "b", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, switch_is_cfs),
|
||||||
|
YAML_ENUM("onColorLuaOverride", 1, enum_booleanEnum, switch_is_cfs),
|
||||||
|
YAML_ENUM("offColorLuaOverride", 1, enum_booleanEnum, switch_is_cfs),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_STRUCT("onColor", 24, struct_RGBLedColor, switch_is_cfs),
|
||||||
|
YAML_STRUCT("offColor", 24, struct_RGBLedColor, switch_is_cfs),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -276,12 +317,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -314,7 +355,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -341,7 +382,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 80, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -382,7 +423,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -403,7 +444,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -463,7 +504,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -476,7 +517,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -634,7 +675,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -684,7 +725,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -728,7 +769,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -775,16 +816,23 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
YAML_UNION("u", 192, union_TelemetryScreenData_u_elmts, select_tele_screen_data),
|
YAML_UNION("u", 192, union_TelemetryScreenData_u_elmts, select_tele_screen_data),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_RGBLedColor[] = {
|
static const struct YamlNode struct_customSwitch[] = {
|
||||||
YAML_IDX,
|
YAML_IDX_CUST("sw",cfs_idx_read,cfs_idx_write),
|
||||||
YAML_UNSIGNED( "r", 8 ),
|
YAML_STRING("name", 3),
|
||||||
YAML_UNSIGNED( "g", 8 ),
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
YAML_UNSIGNED( "b", 8 ),
|
YAML_UNSIGNED( "group", 3 ),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, NULL),
|
||||||
|
YAML_UNSIGNED( "state", 1 ),
|
||||||
|
YAML_ENUM("onColorLuaOverride", 1, enum_booleanEnum, NULL),
|
||||||
|
YAML_ENUM("offColorLuaOverride", 1, enum_booleanEnum, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_STRUCT("onColor", 24, struct_RGBLedColor, isAlwaysActive),
|
||||||
|
YAML_STRUCT("offColor", 24, struct_RGBLedColor, isAlwaysActive),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -824,16 +872,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -847,27 +894,30 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("screens", 192, 4, struct_TelemetryScreenData, NULL),
|
YAML_ARRAY("screens", 192, 4, struct_TelemetryScreenData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "functionSwitchConfig", 16 ),
|
YAML_CUSTOM("functionSwitchConfig",r_functionSwitchConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchGroup", 16 ),
|
YAML_CUSTOM("functionSwitchGroup",r_functionSwitchGroup,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchStartConfig", 16 ),
|
YAML_CUSTOM("functionSwitchStartConfig",r_functionSwitchStartConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchLogicalState", 8 ),
|
YAML_CUSTOM("functionSwitchLogicalState",r_functionSwitchLogicalState,nullptr),
|
||||||
YAML_ARRAY("switchNames", 24, 6, struct_string_24, NULL),
|
YAML_ARRAY("switchNames", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsNameConfig, nullptr),
|
||||||
YAML_ARRAY("functionSwitchLedONColor", 24, 6, struct_RGBLedColor, NULL),
|
YAML_ARRAY("functionSwitchLedONColor", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsOnColorConfig, nullptr),
|
||||||
YAML_ARRAY("functionSwitchLedOFFColor", 24, 6, struct_RGBLedColor, NULL),
|
YAML_ARRAY("functionSwitchLedOFFColor", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsOffColorConfig, nullptr),
|
||||||
|
YAML_ARRAY("customSwitches", 88, 8, struct_customSwitch, isAlwaysActive),
|
||||||
|
YAML_ARRAY("cfsGroupOn", 1, 8, struct_cfsGroupOn, cfsGroupIsActive),
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -89,6 +89,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -231,7 +242,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -265,13 +276,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -285,12 +303,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -323,7 +341,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -350,7 +368,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -400,7 +418,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -421,7 +439,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -481,7 +499,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -494,7 +512,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -652,7 +670,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -702,7 +720,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -746,7 +764,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -770,7 +788,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -802,7 +820,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -842,16 +860,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -867,20 +884,20 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -96,6 +96,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -238,7 +249,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -272,18 +283,25 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
YAML_UNSIGNED( "ppmunit", 2 ),
|
YAML_UNSIGNED( "ppmunit", 2 ),
|
||||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
YAML_ENUM("hatsMode", 2, enum_HatsMode, NULL),
|
||||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||||
YAML_CUSTOM("board",nullptr,w_board),
|
YAML_CUSTOM("board",nullptr,w_board),
|
||||||
YAML_ARRAY("calib", 48, 20, struct_CalibData, NULL),
|
YAML_ARRAY("calib", 48, 20, struct_CalibData, NULL),
|
||||||
@@ -292,12 +310,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -330,7 +348,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -357,7 +375,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -407,7 +425,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -428,7 +446,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -488,7 +506,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -501,7 +519,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -659,7 +677,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -709,7 +727,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -753,7 +771,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -777,7 +795,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -809,7 +827,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -835,7 +853,7 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
YAML_ENUM("hatsMode", 2, enum_HatsMode, NULL),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||||
@@ -850,16 +868,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -875,20 +892,20 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -96,6 +96,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -238,7 +249,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -272,18 +283,25 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
YAML_UNSIGNED( "ppmunit", 2 ),
|
YAML_UNSIGNED( "ppmunit", 2 ),
|
||||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
YAML_ENUM("hatsMode", 2, enum_HatsMode, NULL),
|
||||||
YAML_CUSTOM("semver",nullptr,w_semver),
|
YAML_CUSTOM("semver",nullptr,w_semver),
|
||||||
YAML_CUSTOM("board",nullptr,w_board),
|
YAML_CUSTOM("board",nullptr,w_board),
|
||||||
YAML_ARRAY("calib", 48, 20, struct_CalibData, NULL),
|
YAML_ARRAY("calib", 48, 20, struct_CalibData, NULL),
|
||||||
@@ -292,12 +310,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -330,7 +348,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -357,7 +375,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -407,7 +425,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -428,7 +446,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -488,7 +506,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -501,7 +519,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -659,7 +677,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -709,7 +727,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -753,7 +771,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -777,7 +795,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -809,7 +827,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -835,7 +853,7 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
YAML_UNSIGNED( "disableTelemetryWarning", 1 ),
|
||||||
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
YAML_UNSIGNED( "showInstanceIds", 1 ),
|
||||||
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
YAML_UNSIGNED( "checklistInteractive", 1 ),
|
||||||
YAML_ENUM("hatsMode", 2, enum_HatsMode),
|
YAML_ENUM("hatsMode", 2, enum_HatsMode, NULL),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
YAML_SIGNED( "customThrottleWarningPosition", 8 ),
|
||||||
YAML_UNSIGNED( "beepANACenter", 16 ),
|
YAML_UNSIGNED( "beepANACenter", 16 ),
|
||||||
@@ -850,16 +868,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -875,20 +892,20 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -89,6 +89,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -231,7 +242,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -265,13 +276,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -285,12 +303,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -323,7 +341,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -350,7 +368,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -400,7 +418,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -421,7 +439,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -481,7 +499,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -494,7 +512,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -652,7 +670,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -702,7 +720,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -746,7 +764,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -770,7 +788,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -802,7 +820,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -842,16 +860,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -867,20 +884,20 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -90,6 +90,29 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_GLOBAL, "GLOBAL" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_fsStartPositionType[] = {
|
||||||
|
{ FS_START_OFF, "START_OFF" },
|
||||||
|
{ FS_START_ON, "START_ON" },
|
||||||
|
{ FS_START_PREVIOUS, "START_PREVIOUS" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_booleanEnum[] = {
|
||||||
|
{ BOOL_OFF, "OFF" },
|
||||||
|
{ BOOL_ON, "ON" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -240,7 +263,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -274,13 +297,31 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_RGBLedColor[] = {
|
||||||
|
YAML_UNSIGNED( "r", 8 ),
|
||||||
|
YAML_UNSIGNED( "g", 8 ),
|
||||||
|
YAML_UNSIGNED( "b", 8 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, switch_is_cfs),
|
||||||
|
YAML_ENUM("onColorLuaOverride", 1, enum_booleanEnum, switch_is_cfs),
|
||||||
|
YAML_ENUM("offColorLuaOverride", 1, enum_booleanEnum, switch_is_cfs),
|
||||||
|
YAML_PADDING( 1 ),
|
||||||
|
YAML_STRUCT("onColor", 24, struct_RGBLedColor, switch_is_cfs),
|
||||||
|
YAML_STRUCT("offColor", 24, struct_RGBLedColor, switch_is_cfs),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -292,12 +333,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_PADDING( 16 ),
|
YAML_PADDING( 16 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -330,7 +371,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -357,7 +398,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 80, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -409,7 +450,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -430,7 +471,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -490,7 +531,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -503,7 +544,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -661,7 +702,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -711,7 +752,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -755,7 +796,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -779,7 +820,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -809,21 +850,23 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
YAML_ARRAY("options", 128, 1, struct_ZoneOptionValueTyped, NULL),
|
YAML_ARRAY("options", 128, 1, struct_ZoneOptionValueTyped, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_string_24[] = {
|
static const struct YamlNode struct_customSwitch[] = {
|
||||||
YAML_IDX,
|
YAML_IDX_CUST("sw",cfs_idx_read,cfs_idx_write),
|
||||||
YAML_STRING("val", 3),
|
YAML_STRING("name", 3),
|
||||||
YAML_END
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
};
|
YAML_UNSIGNED( "group", 2 ),
|
||||||
static const struct YamlNode struct_RGBLedColor[] = {
|
YAML_ENUM("start", 2, enum_fsStartPositionType, NULL),
|
||||||
YAML_IDX,
|
YAML_UNSIGNED( "state", 1 ),
|
||||||
YAML_UNSIGNED( "r", 8 ),
|
YAML_ENUM("onColorLuaOverride", 1, enum_booleanEnum, NULL),
|
||||||
YAML_UNSIGNED( "g", 8 ),
|
YAML_ENUM("offColorLuaOverride", 1, enum_booleanEnum, NULL),
|
||||||
YAML_UNSIGNED( "b", 8 ),
|
YAML_PADDING( 6 ),
|
||||||
|
YAML_STRUCT("onColor", 24, struct_RGBLedColor, isAlwaysActive),
|
||||||
|
YAML_STRUCT("offColor", 24, struct_RGBLedColor, isAlwaysActive),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -863,16 +906,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 384, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -887,28 +929,31 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("topbarWidgetWidth", 8, 6, struct_unsigned_8, NULL),
|
YAML_ARRAY("topbarWidgetWidth", 8, 6, struct_unsigned_8, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "functionSwitchConfig", 16 ),
|
YAML_CUSTOM("functionSwitchConfig",r_functionSwitchConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchGroup", 16 ),
|
YAML_CUSTOM("functionSwitchGroup",r_functionSwitchGroup,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchStartConfig", 16 ),
|
YAML_CUSTOM("functionSwitchStartConfig",r_functionSwitchStartConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchLogicalState", 8 ),
|
YAML_CUSTOM("functionSwitchLogicalState",r_functionSwitchLogicalState,nullptr),
|
||||||
YAML_ARRAY("switchNames", 24, 6, struct_string_24, NULL),
|
YAML_ARRAY("switchNames", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsNameConfig, nullptr),
|
||||||
YAML_ARRAY("functionSwitchLedONColor", 24, 6, struct_RGBLedColor, NULL),
|
YAML_ARRAY("functionSwitchLedONColor", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsOnColorConfig, nullptr),
|
||||||
YAML_ARRAY("functionSwitchLedOFFColor", 24, 6, struct_RGBLedColor, NULL),
|
YAML_ARRAY("functionSwitchLedOFFColor", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsOffColorConfig, nullptr),
|
||||||
|
YAML_ARRAY("customSwitches", 88, 6, struct_customSwitch, isAlwaysActive),
|
||||||
|
YAML_ARRAY("cfsGroupOn", 1, 8, struct_cfsGroupOn, cfsGroupIsActive),
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -90,6 +90,24 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_GLOBAL, "GLOBAL" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_fsStartPositionType[] = {
|
||||||
|
{ FS_START_OFF, "START_OFF" },
|
||||||
|
{ FS_START_ON, "START_ON" },
|
||||||
|
{ FS_START_PREVIOUS, "START_PREVIOUS" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -240,7 +258,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -274,13 +292,21 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, switch_is_cfs),
|
||||||
|
YAML_PADDING( 3 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -292,12 +318,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_PADDING( 16 ),
|
YAML_PADDING( 16 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -330,7 +356,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -357,7 +383,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -409,7 +435,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -430,7 +456,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -490,7 +516,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -503,7 +529,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -661,7 +687,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -711,7 +737,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -755,7 +781,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -779,7 +805,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -809,14 +835,18 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
YAML_ARRAY("options", 128, 1, struct_ZoneOptionValueTyped, NULL),
|
YAML_ARRAY("options", 128, 1, struct_ZoneOptionValueTyped, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_string_24[] = {
|
static const struct YamlNode struct_customSwitch[] = {
|
||||||
YAML_IDX,
|
YAML_IDX_CUST("sw",cfs_idx_read,cfs_idx_write),
|
||||||
YAML_STRING("val", 3),
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_UNSIGNED( "group", 2 ),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, NULL),
|
||||||
|
YAML_UNSIGNED( "state", 1 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -856,16 +886,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -880,26 +909,29 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("topbarWidgetWidth", 8, 6, struct_unsigned_8, NULL),
|
YAML_ARRAY("topbarWidgetWidth", 8, 6, struct_unsigned_8, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "functionSwitchConfig", 16 ),
|
YAML_CUSTOM("functionSwitchConfig",r_functionSwitchConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchGroup", 16 ),
|
YAML_CUSTOM("functionSwitchGroup",r_functionSwitchGroup,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchStartConfig", 16 ),
|
YAML_CUSTOM("functionSwitchStartConfig",r_functionSwitchStartConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchLogicalState", 8 ),
|
YAML_CUSTOM("functionSwitchLogicalState",r_functionSwitchLogicalState,nullptr),
|
||||||
YAML_ARRAY("switchNames", 24, 6, struct_string_24, NULL),
|
YAML_ARRAY("switchNames", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsNameConfig, nullptr),
|
||||||
|
YAML_ARRAY("customSwitches", 32, 6, struct_customSwitch, isAlwaysActive),
|
||||||
|
YAML_ARRAY("cfsGroupOn", 1, 8, struct_cfsGroupOn, cfsGroupIsActive),
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -89,6 +89,24 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_GLOBAL, "GLOBAL" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_fsStartPositionType[] = {
|
||||||
|
{ FS_START_OFF, "START_OFF" },
|
||||||
|
{ FS_START_ON, "START_ON" },
|
||||||
|
{ FS_START_PREVIOUS, "START_PREVIOUS" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -222,7 +240,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -256,13 +274,21 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, switch_is_cfs),
|
||||||
|
YAML_PADDING( 3 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -276,12 +302,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -314,7 +340,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -341,7 +367,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -382,7 +408,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -403,7 +429,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -463,7 +489,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -476,7 +502,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -634,7 +660,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -684,7 +710,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -728,7 +754,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -775,9 +801,18 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
YAML_UNION("u", 192, union_TelemetryScreenData_u_elmts, select_tele_screen_data),
|
YAML_UNION("u", 192, union_TelemetryScreenData_u_elmts, select_tele_screen_data),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_customSwitch[] = {
|
||||||
|
YAML_IDX_CUST("sw",cfs_idx_read,cfs_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_UNSIGNED( "group", 2 ),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, NULL),
|
||||||
|
YAML_UNSIGNED( "state", 1 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -817,16 +852,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -840,25 +874,28 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("screens", 192, 4, struct_TelemetryScreenData, NULL),
|
YAML_ARRAY("screens", 192, 4, struct_TelemetryScreenData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "functionSwitchConfig", 16 ),
|
YAML_CUSTOM("functionSwitchConfig",r_functionSwitchConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchGroup", 16 ),
|
YAML_CUSTOM("functionSwitchGroup",r_functionSwitchGroup,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchStartConfig", 16 ),
|
YAML_CUSTOM("functionSwitchStartConfig",r_functionSwitchStartConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchLogicalState", 8 ),
|
YAML_CUSTOM("functionSwitchLogicalState",r_functionSwitchLogicalState,nullptr),
|
||||||
YAML_ARRAY("switchNames", 24, 6, struct_string_24, NULL),
|
YAML_ARRAY("switchNames", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsNameConfig, nullptr),
|
||||||
|
YAML_ARRAY("customSwitches", 32, 6, struct_customSwitch, isAlwaysActive),
|
||||||
|
YAML_ARRAY("cfsGroupOn", 1, 8, struct_cfsGroupOn, cfsGroupIsActive),
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -89,6 +89,24 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_GLOBAL, "GLOBAL" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
const struct YamlIdStr enum_fsStartPositionType[] = {
|
||||||
|
{ FS_START_OFF, "START_OFF" },
|
||||||
|
{ FS_START_ON, "START_ON" },
|
||||||
|
{ FS_START_PREVIOUS, "START_PREVIOUS" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -222,7 +240,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -256,13 +274,21 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, switch_is_cfs),
|
||||||
|
YAML_PADDING( 3 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -276,12 +302,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -314,7 +340,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -341,7 +367,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -382,7 +408,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -403,7 +429,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -463,7 +489,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -476,7 +502,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -634,7 +660,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -684,7 +710,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -728,7 +754,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -775,9 +801,18 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
YAML_UNION("u", 192, union_TelemetryScreenData_u_elmts, select_tele_screen_data),
|
YAML_UNION("u", 192, union_TelemetryScreenData_u_elmts, select_tele_screen_data),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_customSwitch[] = {
|
||||||
|
YAML_IDX_CUST("sw",cfs_idx_read,cfs_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_UNSIGNED( "group", 2 ),
|
||||||
|
YAML_ENUM("start", 2, enum_fsStartPositionType, NULL),
|
||||||
|
YAML_UNSIGNED( "state", 1 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -817,16 +852,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -840,25 +874,28 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("screens", 192, 4, struct_TelemetryScreenData, NULL),
|
YAML_ARRAY("screens", 192, 4, struct_TelemetryScreenData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "functionSwitchConfig", 16 ),
|
YAML_CUSTOM("functionSwitchConfig",r_functionSwitchConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchGroup", 16 ),
|
YAML_CUSTOM("functionSwitchGroup",r_functionSwitchGroup,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchStartConfig", 16 ),
|
YAML_CUSTOM("functionSwitchStartConfig",r_functionSwitchStartConfig,nullptr),
|
||||||
YAML_UNSIGNED( "functionSwitchLogicalState", 8 ),
|
YAML_CUSTOM("functionSwitchLogicalState",r_functionSwitchLogicalState,nullptr),
|
||||||
YAML_ARRAY("switchNames", 24, 6, struct_string_24, NULL),
|
YAML_ARRAY("switchNames", 0, NUM_FUNCTIONS_SWITCHES, struct_cfsNameConfig, nullptr),
|
||||||
|
YAML_ARRAY("customSwitches", 32, 6, struct_customSwitch, isAlwaysActive),
|
||||||
|
YAML_ARRAY("cfsGroupOn", 1, 8, struct_cfsGroupOn, cfsGroupIsActive),
|
||||||
|
YAML_PADDING( 8 ),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -89,6 +89,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -239,7 +250,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -273,13 +284,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -291,12 +309,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_PADDING( 16 ),
|
YAML_PADDING( 16 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -329,7 +347,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -356,7 +374,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 16, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_STRING("currModelFilename", 17),
|
YAML_STRING("currModelFilename", 17),
|
||||||
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
YAML_UNSIGNED( "modelQuickSelect", 1 ),
|
||||||
@@ -408,7 +426,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -429,7 +447,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -489,7 +507,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -502,7 +520,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -660,7 +678,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -710,7 +728,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -754,7 +772,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -778,7 +796,7 @@ static const struct YamlNode union_ZoneOptionValue_elmts[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
static const struct YamlNode struct_ZoneOptionValueTyped[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum),
|
YAML_ENUM("type", 32, enum_ZoneOptionValueEnum, NULL),
|
||||||
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
YAML_UNION("value", 96, union_ZoneOptionValue_elmts, select_zov),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -810,7 +828,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -850,16 +868,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -875,20 +892,20 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioThemesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -221,7 +232,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -255,13 +266,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -275,12 +293,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -313,7 +331,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -340,7 +358,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -381,7 +399,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -402,7 +420,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -462,7 +480,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -475,7 +493,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -633,7 +651,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -683,7 +701,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -727,7 +745,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -776,7 +794,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -816,8 +834,7 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
@@ -826,8 +843,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -842,19 +859,19 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -221,7 +232,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -255,13 +266,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -275,12 +293,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -313,7 +331,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -340,7 +358,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -381,7 +399,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -402,7 +420,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -462,7 +480,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -475,7 +493,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -633,7 +651,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -683,7 +701,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -727,7 +745,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -776,7 +794,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -816,8 +834,7 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
@@ -826,8 +843,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -842,19 +859,19 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -221,7 +232,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -255,13 +266,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -275,12 +293,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -313,7 +331,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -340,7 +358,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -381,7 +399,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -402,7 +420,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -462,7 +480,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -475,7 +493,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -633,7 +651,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -683,7 +701,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -727,7 +745,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -776,7 +794,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -816,8 +834,7 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
@@ -826,8 +843,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -843,19 +860,19 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -221,7 +232,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -255,13 +266,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -275,12 +293,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -313,7 +331,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -340,7 +358,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -381,7 +399,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -402,7 +420,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -462,7 +480,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -475,7 +493,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -633,7 +651,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -683,7 +701,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -727,7 +745,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -776,7 +794,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -816,16 +834,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -840,19 +857,19 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -88,6 +88,17 @@ const struct YamlIdStr enum_Functions[] = {
|
|||||||
{ FUNC_TEST, "TEST" },
|
{ FUNC_TEST, "TEST" },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
const struct YamlIdStr enum_SwitchConfig[] = {
|
||||||
|
{ SWITCH_NONE, "NONE" },
|
||||||
|
{ SWITCH_TOGGLE, "TOGGLE" },
|
||||||
|
{ SWITCH_2POS, "2POS" },
|
||||||
|
{ SWITCH_3POS, "3POS" },
|
||||||
|
{ SWITCH_none, "none" },
|
||||||
|
{ SWITCH_toggle, "toggle" },
|
||||||
|
{ SWITCH_2pos, "2pos" },
|
||||||
|
{ SWITCH_3pos, "3pos" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
const struct YamlIdStr enum_TimerModes[] = {
|
const struct YamlIdStr enum_TimerModes[] = {
|
||||||
{ TMRMODE_OFF, "OFF" },
|
{ TMRMODE_OFF, "OFF" },
|
||||||
{ TMRMODE_ON, "ON" },
|
{ TMRMODE_ON, "ON" },
|
||||||
@@ -223,7 +234,7 @@ static const struct YamlNode struct_signed_16[] = {
|
|||||||
static const struct YamlNode struct_TrainerMix[] = {
|
static const struct YamlNode struct_TrainerMix[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_UNSIGNED( "srcChn", 6 ),
|
YAML_UNSIGNED( "srcChn", 6 ),
|
||||||
YAML_ENUM("mode", 2, enum_TrainerMultiplex),
|
YAML_ENUM("mode", 2, enum_TrainerMultiplex, NULL),
|
||||||
YAML_SIGNED( "studWeight", 8 ),
|
YAML_SIGNED( "studWeight", 8 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
@@ -257,13 +268,20 @@ static const struct YamlNode union_anonymous_0_elmts[] = {
|
|||||||
static const struct YamlNode struct_CustomFunctionData[] = {
|
static const struct YamlNode struct_CustomFunctionData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_ENUM("func", 6, enum_Functions),
|
YAML_ENUM("func", 6, enum_Functions, NULL),
|
||||||
YAML_CUSTOM("def",r_customFn,w_customFn),
|
YAML_CUSTOM("def",r_customFn,w_customFn),
|
||||||
YAML_PADDING( 64 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_PADDING( 7 ),
|
YAML_PADDING( 7 ),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
|
static const struct YamlNode struct_switchDef[] = {
|
||||||
|
YAML_IDX_CUST("sw",sw_idx_read,sw_idx_write),
|
||||||
|
YAML_STRING("name", 3),
|
||||||
|
YAML_ENUM("type", 3, enum_SwitchConfig, NULL),
|
||||||
|
YAML_PADDING( 5 ),
|
||||||
|
YAML_END
|
||||||
|
};
|
||||||
static const struct YamlNode struct_RadioData[] = {
|
static const struct YamlNode struct_RadioData[] = {
|
||||||
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
YAML_UNSIGNED( "manuallyEdited", 1 ),
|
||||||
YAML_SIGNED( "timezoneMinutes", 3 ),
|
YAML_SIGNED( "timezoneMinutes", 3 ),
|
||||||
@@ -277,12 +295,12 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "contrast", 8 ),
|
YAML_UNSIGNED( "contrast", 8 ),
|
||||||
YAML_UNSIGNED( "vBatWarn", 8 ),
|
YAML_UNSIGNED( "vBatWarn", 8 ),
|
||||||
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
YAML_SIGNED( "txVoltageCalibration", 8 ),
|
||||||
YAML_ENUM("backlightMode", 3, enum_BacklightMode),
|
YAML_ENUM("backlightMode", 3, enum_BacklightMode, NULL),
|
||||||
YAML_ENUM("antennaMode", 2, enum_AntennaModes),
|
YAML_ENUM("antennaMode", 2, enum_AntennaModes, NULL),
|
||||||
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
YAML_UNSIGNED( "disableRtcWarning", 1 ),
|
||||||
YAML_UNSIGNED( "keysBacklight", 1 ),
|
YAML_UNSIGNED( "keysBacklight", 1 ),
|
||||||
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
YAML_UNSIGNED( "dontPlayHello", 1 ),
|
||||||
YAML_ENUM("internalModule", 8, enum_ModuleType),
|
YAML_ENUM("internalModule", 8, enum_ModuleType, NULL),
|
||||||
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
YAML_STRUCT("trainer", 128, struct_TrainerData, NULL),
|
||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_PADDING( 2 ),
|
YAML_PADDING( 2 ),
|
||||||
@@ -315,7 +333,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_UNSIGNED( "backlightBright", 8 ),
|
YAML_UNSIGNED( "backlightBright", 8 ),
|
||||||
YAML_UNSIGNED( "globalTimer", 32 ),
|
YAML_UNSIGNED( "globalTimer", 32 ),
|
||||||
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
YAML_UNSIGNED( "bluetoothBaudrate", 4 ),
|
||||||
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes),
|
YAML_ENUM("bluetoothMode", 4, enum_BluetoothModes, NULL),
|
||||||
YAML_UNSIGNED( "countryCode", 2 ),
|
YAML_UNSIGNED( "countryCode", 2 ),
|
||||||
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
YAML_SIGNED( "pwrOnSpeed", 3 ),
|
||||||
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
YAML_SIGNED( "pwrOffSpeed", 3 ),
|
||||||
@@ -342,7 +360,7 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 0, MAX_POTS, struct_sliderConfig, nullptr),
|
||||||
YAML_PADDING( 8 ),
|
YAML_PADDING( 8 ),
|
||||||
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 4, 8, struct_potConfig, nullptr),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 32, 20, struct_switchDef, switchIsActive),
|
||||||
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
YAML_ARRAY("flexSwitches", 0, MAX_FLEX_SWITCHES, struct_flexSwitch, flex_sw_valid),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_STRING("bluetoothName", 10),
|
YAML_STRING("bluetoothName", 10),
|
||||||
@@ -385,7 +403,7 @@ static const struct YamlNode struct_TimerData[] = {
|
|||||||
YAML_UNSIGNED( "start", 22 ),
|
YAML_UNSIGNED( "start", 22 ),
|
||||||
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
YAML_SIGNED_CUST( "swtch", 10, r_swtchSrc, w_swtchSrc ),
|
||||||
YAML_SIGNED( "value", 22 ),
|
YAML_SIGNED( "value", 22 ),
|
||||||
YAML_ENUM("mode", 3, enum_TimerModes),
|
YAML_ENUM("mode", 3, enum_TimerModes, NULL),
|
||||||
YAML_UNSIGNED( "countdownBeep", 2 ),
|
YAML_UNSIGNED( "countdownBeep", 2 ),
|
||||||
YAML_UNSIGNED( "minuteBeep", 1 ),
|
YAML_UNSIGNED( "minuteBeep", 1 ),
|
||||||
YAML_UNSIGNED( "persistent", 2 ),
|
YAML_UNSIGNED( "persistent", 2 ),
|
||||||
@@ -406,7 +424,7 @@ static const struct YamlNode struct_MixData[] = {
|
|||||||
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
YAML_SIGNED_CUST( "srcRaw", 10, r_mixSrcRawEx, w_mixSrcRawEx ),
|
||||||
YAML_UNSIGNED( "carryTrim", 1 ),
|
YAML_UNSIGNED( "carryTrim", 1 ),
|
||||||
YAML_UNSIGNED( "mixWarn", 2 ),
|
YAML_UNSIGNED( "mixWarn", 2 ),
|
||||||
YAML_ENUM("mltpx", 2, enum_MixerMultiplex),
|
YAML_ENUM("mltpx", 2, enum_MixerMultiplex, NULL),
|
||||||
YAML_UNSIGNED( "delayPrec", 1 ),
|
YAML_UNSIGNED( "delayPrec", 1 ),
|
||||||
YAML_UNSIGNED( "speedPrec", 1 ),
|
YAML_UNSIGNED( "speedPrec", 1 ),
|
||||||
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
YAML_UNSIGNED_CUST( "flightModes", 9, r_flightModes, w_flightModes ),
|
||||||
@@ -466,7 +484,7 @@ static const struct YamlNode struct_signed_8[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_LogicalSwitchData[] = {
|
static const struct YamlNode struct_LogicalSwitchData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions),
|
YAML_ENUM("func", 8, enum_LogicalSwitchesFunctions, NULL),
|
||||||
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
YAML_CUSTOM("def",r_logicSw,w_logicSw),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
YAML_PADDING( 10 ),
|
YAML_PADDING( 10 ),
|
||||||
@@ -479,7 +497,7 @@ static const struct YamlNode struct_LogicalSwitchData[] = {
|
|||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_SwashRingData[] = {
|
static const struct YamlNode struct_SwashRingData[] = {
|
||||||
YAML_ENUM("type", 8, enum_SwashType),
|
YAML_ENUM("type", 8, enum_SwashType, NULL),
|
||||||
YAML_UNSIGNED( "value", 8 ),
|
YAML_UNSIGNED( "value", 8 ),
|
||||||
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "collectiveSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
YAML_UNSIGNED_CUST( "aileronSource", 8, r_mixSrcRaw, w_mixSrcRaw ),
|
||||||
@@ -637,7 +655,7 @@ static const struct YamlNode struct_ModuleData[] = {
|
|||||||
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
YAML_CUSTOM("subType",r_modSubtype,w_modSubtype),
|
||||||
YAML_UNSIGNED( "channelsStart", 8 ),
|
YAML_UNSIGNED( "channelsStart", 8 ),
|
||||||
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
YAML_SIGNED_CUST( "channelsCount", 8, r_channelsCount, w_channelsCount ),
|
||||||
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes),
|
YAML_ENUM("failsafeMode", 4, enum_FailsafeModes, NULL),
|
||||||
YAML_PADDING( 4 ),
|
YAML_PADDING( 4 ),
|
||||||
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
YAML_UNION("mod", 200, union_anonymous_4_elmts, select_mod_type),
|
||||||
YAML_END
|
YAML_END
|
||||||
@@ -687,7 +705,7 @@ static const struct YamlNode struct_anonymous_16[] = {
|
|||||||
static const struct YamlNode union_anonymous_15_elmts[] = {
|
static const struct YamlNode union_anonymous_15_elmts[] = {
|
||||||
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
YAML_STRUCT("frskyInstance", 8, struct_anonymous_16, NULL),
|
||||||
YAML_UNSIGNED( "instance", 8 ),
|
YAML_UNSIGNED( "instance", 8 ),
|
||||||
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula),
|
YAML_ENUM("formula", 8, enum_TelemetrySensorFormula, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_anonymous_18[] = {
|
static const struct YamlNode struct_anonymous_18[] = {
|
||||||
@@ -731,7 +749,7 @@ static const struct YamlNode struct_TelemetrySensor[] = {
|
|||||||
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
YAML_UNION("id2", 8, union_anonymous_15_elmts, select_id2),
|
||||||
YAML_STRING("label", 4),
|
YAML_STRING("label", 4),
|
||||||
YAML_UNSIGNED( "subId", 8 ),
|
YAML_UNSIGNED( "subId", 8 ),
|
||||||
YAML_ENUM("type", 1, enum_TelemetrySensorType),
|
YAML_ENUM("type", 1, enum_TelemetrySensorType, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_UNSIGNED( "unit", 6 ),
|
YAML_UNSIGNED( "unit", 6 ),
|
||||||
YAML_UNSIGNED( "prec", 2 ),
|
YAML_UNSIGNED( "prec", 2 ),
|
||||||
@@ -780,7 +798,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = {
|
|||||||
};
|
};
|
||||||
static const struct YamlNode struct_USBJoystickChData[] = {
|
static const struct YamlNode struct_USBJoystickChData[] = {
|
||||||
YAML_IDX,
|
YAML_IDX,
|
||||||
YAML_ENUM("mode", 3, enum_USBJoystickCh),
|
YAML_ENUM("mode", 3, enum_USBJoystickCh, NULL),
|
||||||
YAML_UNSIGNED( "inversion", 1 ),
|
YAML_UNSIGNED( "inversion", 1 ),
|
||||||
YAML_UNSIGNED( "param", 4 ),
|
YAML_UNSIGNED( "param", 4 ),
|
||||||
YAML_UNSIGNED( "btn_num", 5 ),
|
YAML_UNSIGNED( "btn_num", 5 ),
|
||||||
@@ -820,16 +838,15 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,nullptr),
|
||||||
YAML_ARRAY("switchWarning", 3, 21, struct_swtchWarn, nullptr),
|
YAML_ARRAY("switchWarning", 2, 32, struct_swtchWarn, nullptr),
|
||||||
YAML_PADDING(1),
|
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
YAML_STRUCT("rssiAlarms", 0, struct_RssiAlarmData, NULL),
|
||||||
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
YAML_STRUCT("rfAlarms", 16, struct_RFAlarmData, NULL),
|
||||||
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
YAML_UNSIGNED( "thrTrimSw", 3 ),
|
||||||
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode),
|
YAML_ENUM("potsWarnMode", 2, enum_PotsWarnMode, NULL),
|
||||||
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("jitterFilter", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_PADDING( 1 ),
|
YAML_PADDING( 1 ),
|
||||||
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
YAML_ARRAY("moduleData", 232, 2, struct_ModuleData, NULL),
|
||||||
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
YAML_ARRAY("failsafeChannels", 16, 32, struct_signed_16, NULL),
|
||||||
@@ -844,19 +861,19 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_UNSIGNED( "view", 8 ),
|
YAML_UNSIGNED( "view", 8 ),
|
||||||
YAML_STRING("modelRegistrationID", 8),
|
YAML_STRING("modelRegistrationID", 8),
|
||||||
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
YAML_UNSIGNED( "usbJoystickExtMode", 1 ),
|
||||||
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode),
|
YAML_ENUM("usbJoystickIfMode", 3, enum_USBJoystickIfMode, NULL),
|
||||||
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
YAML_UNSIGNED( "usbJoystickCircularCut", 4 ),
|
||||||
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
YAML_ARRAY("usbJoystickCh", 16, 26, struct_USBJoystickChData, NULL),
|
||||||
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioGFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("radioTrainerDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelHeliDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelFMDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCurvesDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelGVDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelLSDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelSFDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelCustomScriptsDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable),
|
YAML_ENUM("modelTelemetryDisabled", 2, enum_ModelOverridableEnable, NULL),
|
||||||
YAML_END
|
YAML_END
|
||||||
};
|
};
|
||||||
static const struct YamlNode struct_PartialModel[] = {
|
static const struct YamlNode struct_PartialModel[] = {
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ struct YamlNode
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
const YamlIdStr* choices;
|
const YamlIdStr* choices;
|
||||||
|
is_active_func is_active;
|
||||||
} _enum;
|
} _enum;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -141,8 +142,8 @@ struct YamlNode
|
|||||||
#define YAML_ARRAY(tag, bits, max_elmts, nodes, f_is_active) \
|
#define YAML_ARRAY(tag, bits, max_elmts, nodes, f_is_active) \
|
||||||
{ .size=(bits), .type=YDT_ARRAY, .elmts=(max_elmts), YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.is_active=(f_is_active)}}} }
|
{ .size=(bits), .type=YDT_ARRAY, .elmts=(max_elmts), YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.is_active=(f_is_active)}}} }
|
||||||
|
|
||||||
#define YAML_ENUM(tag, bits, id_strs) \
|
#define YAML_ENUM(tag, bits, id_strs, f_is_active) \
|
||||||
{ .size=(bits), .type=YDT_ENUM, .elmts=0, YAML_TAG(tag), .u={._enum={ .choices=(id_strs) }} }
|
{ .size=(bits), .type=YDT_ENUM, .elmts=0, YAML_TAG(tag), .u={._enum={ .choices=(id_strs), .is_active=(f_is_active) }} }
|
||||||
|
|
||||||
#define YAML_UNION(tag, bits, nodes, f_sel_m) \
|
#define YAML_UNION(tag, bits, nodes, f_sel_m) \
|
||||||
{ .size=(bits), .type=YDT_UNION, .elmts=0, YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.select_member=(f_sel_m) }}} }
|
{ .size=(bits), .type=YDT_UNION, .elmts=0, YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.select_member=(f_sel_m) }}} }
|
||||||
@@ -193,8 +194,8 @@ struct YamlNode
|
|||||||
#define YAML_ARRAY(tag, bits, max_elmts, nodes, f_is_active) \
|
#define YAML_ARRAY(tag, bits, max_elmts, nodes, f_is_active) \
|
||||||
{ (bits), YDT_ARRAY, (max_elmts), YAML_TAG(tag), {{ (nodes), {{ (f_is_active) }}}} }
|
{ (bits), YDT_ARRAY, (max_elmts), YAML_TAG(tag), {{ (nodes), {{ (f_is_active) }}}} }
|
||||||
|
|
||||||
#define YAML_ENUM(tag, bits, id_strs) \
|
#define YAML_ENUM(tag, bits, id_strs, f_is_active) \
|
||||||
{ (bits), YDT_ENUM, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)(id_strs) }} }
|
{ (bits), YDT_ENUM, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)(id_strs, {{ (f_is_active) }}) }} }
|
||||||
|
|
||||||
#define YAML_UNION(tag, bits, nodes, f_sel_m) \
|
#define YAML_UNION(tag, bits, nodes, f_sel_m) \
|
||||||
{ (bits), YDT_UNION, .elmts=0, YAML_TAG(tag), {{ (nodes), {{ (YamlNode::is_active_func)(f_sel_m) }}}} }
|
{ (bits), YDT_UNION, .elmts=0, YAML_TAG(tag), {{ (nodes), {{ (YamlNode::is_active_func)(f_sel_m) }}}} }
|
||||||
|
|||||||
@@ -622,6 +622,13 @@ bool YamlTreeWalker::generate(yaml_writer_func wf, void* opaque)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
if (attr->type == YDT_ENUM && attr->u._enum.is_active) {
|
||||||
|
if (!attr->u._enum.is_active(this, data, getBitOffset())) {
|
||||||
|
toNextAttr();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// only for lists:
|
// only for lists:
|
||||||
// - arrays have IDX upfront
|
// - arrays have IDX upfront
|
||||||
// - structs are not marked as arrays
|
// - structs are not marked as arrays
|
||||||
|
|||||||
@@ -420,19 +420,19 @@ char *getFlightModeString(char *dest, int8_t idx)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getCustomSwitchesGroupName(char *dest, uint8_t idx)
|
char* getCustomSwitchesGroupName(char *dest, uint8_t idx)
|
||||||
{
|
{
|
||||||
dest = strAppendStringWithIndex(dest, "GR", idx + 1);
|
dest = strAppendStringWithIndex(dest, "GR", idx + 1);
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getSwitchName(char *dest, uint8_t idx, bool defaultOnly)
|
char* getSwitchName(char *dest, uint8_t idx, bool defaultOnly)
|
||||||
{
|
{
|
||||||
if (!defaultOnly && switchHasCustomName(idx)) {
|
if (!defaultOnly && g_model.switchHasCustomName(idx)) {
|
||||||
dest = strAppend(dest, switchGetCustomName(idx), LEN_SWITCH_NAME);
|
dest = strAppend(dest, g_model.getSwitchCustomName(idx), LEN_SWITCH_NAME);
|
||||||
} else {
|
} else {
|
||||||
dest = strAppend(dest, switchGetName(idx), LEN_SWITCH_NAME);
|
dest = strAppend(dest, switchGetDefaultName(idx), LEN_SWITCH_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
|
|||||||
+130
-188
@@ -88,72 +88,59 @@ uint8_t potsPos[MAX_POTS];
|
|||||||
// Non pushed : SWSRC_Sx0 = -1024 = Sx(up) = state 0
|
// Non pushed : SWSRC_Sx0 = -1024 = Sx(up) = state 0
|
||||||
// Pushed : SWSRC_Sx2 = +1024 = Sx(down) = state 1
|
// Pushed : SWSRC_Sx2 = +1024 = Sx(down) = state 1
|
||||||
|
|
||||||
uint8_t fsPreviousState = 0;
|
uint16_t fsPreviousState = 0;
|
||||||
uint8_t functionSwitchFunctionState = 0;
|
|
||||||
|
|
||||||
void setFSStartupPosition()
|
void setFSStartupPosition()
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
if (switchIsCustomSwitch(i)) {
|
||||||
if (FSWITCH_CONFIG(i) == SWITCH_TOGGLE)
|
uint8_t startPos = g_model.getSwitchStart(i);
|
||||||
startPos = FS_START_OFF;
|
if (g_model.getSwitchType(i) == SWITCH_TOGGLE)
|
||||||
switch(startPos) {
|
startPos = FS_START_OFF;
|
||||||
case FS_START_OFF:
|
switch(startPos) {
|
||||||
g_model.functionSwitchLogicalState &= ~(1 << i); // clear state
|
case FS_START_OFF:
|
||||||
break;
|
g_model.cfsSetState(i, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
case FS_START_ON:
|
case FS_START_ON:
|
||||||
g_model.functionSwitchLogicalState |= 1 << i;
|
g_model.cfsSetState(i, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FS_START_PREVIOUS:
|
case FS_START_PREVIOUS:
|
||||||
default:
|
default:
|
||||||
// Do nothing, use existing g_model.functionSwitchLogicalState value
|
// Do nothing, use existing value
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getFSLogicalState()
|
|
||||||
{
|
|
||||||
return g_model.functionSwitchLogicalState;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t getFSLogicalState(uint8_t index)
|
|
||||||
{
|
|
||||||
return (uint8_t )(bfSingleBitGet(getFSLogicalState(), index) >> (index));
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFSLogicalState(uint8_t index, uint8_t value)
|
void setFSLogicalState(uint8_t index, uint8_t value)
|
||||||
{
|
{
|
||||||
if (value)
|
g_model.cfsSetState(index, value ? 1 : 0);
|
||||||
g_model.functionSwitchLogicalState |= 1 << index; // Set bit
|
|
||||||
else
|
|
||||||
g_model.functionSwitchLogicalState &= ~(1 << index); // clear state
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getFSPhysicalState(uint8_t index)
|
bool getFSPhysicalState(uint8_t index)
|
||||||
{
|
{
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
if (bfSingleBitGet(functionSwitchFunctionState, index))
|
if (switchIsCustomSwitch(index) && g_model.cfsSFState(index))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
index += switchGetMaxSwitches();
|
|
||||||
return switchGetPosition(index) != SWITCH_HW_UP;
|
return switchGetPosition(index) != SWITCH_HW_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getFSPreviousPhysicalState(uint8_t index)
|
static bool getFSPreviousPhysicalState(uint8_t index)
|
||||||
{
|
{
|
||||||
return (uint8_t )(bfSingleBitGet(fsPreviousState, index) >> (index));
|
return (uint8_t)(bfSingleBitGet(fsPreviousState, index) >> (index));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getSwitchCountInFSGroup(uint8_t index)
|
uint8_t getSwitchCountInFSGroup(uint8_t index)
|
||||||
{
|
{
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < switchGetMaxFctSwitches(); i++) {
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
if (FSWITCH_GROUP(i) == index)
|
if (switchIsCustomSwitch(i) && g_model.getSwitchGroup(i) == index)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,63 +154,63 @@ bool isFSGroupUsed(uint8_t index)
|
|||||||
|
|
||||||
void evalFunctionSwitches()
|
void evalFunctionSwitches()
|
||||||
{
|
{
|
||||||
uint8_t fct_switches = switchGetMaxFctSwitches();
|
for (uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
||||||
for (uint8_t i = 0; i < fct_switches; i++) {
|
if (switchIsCustomSwitch(i)) {
|
||||||
if (FSWITCH_CONFIG(i) == SWITCH_NONE) {
|
if (g_model.getSwitchType(i) == SWITCH_NONE) {
|
||||||
setFSLedOFF(i);
|
continue;
|
||||||
//fsLedRGB(i, 0);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t physicalState = getFSPhysicalState(i);
|
|
||||||
if (physicalState != getFSPreviousPhysicalState(i)) {
|
|
||||||
// FS was moved
|
|
||||||
inactivityTimerReset(ActivitySource::MainControls);
|
|
||||||
if ((FSWITCH_CONFIG(i) == SWITCH_2POS && physicalState == 1) ||
|
|
||||||
(FSWITCH_CONFIG(i) == SWITCH_TOGGLE)) {
|
|
||||||
if (IS_FSWITCH_GROUP_ON(FSWITCH_GROUP(i)) != 0) {
|
|
||||||
// In an always on group
|
|
||||||
g_model.functionSwitchLogicalState |= 1 << i; // Set bit
|
|
||||||
} else {
|
|
||||||
g_model.functionSwitchLogicalState ^= 1 << i; // Toggle bit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FSWITCH_GROUP(i) && physicalState == 1) {
|
bool physicalState = getFSPhysicalState(i);
|
||||||
// switch is in a group, other in group need to be turned off
|
if (physicalState != getFSPreviousPhysicalState(i)) {
|
||||||
for (uint8_t j = 0; j < NUM_FUNCTIONS_SWITCHES; j++) {
|
// FS was moved
|
||||||
if (i == j) continue;
|
inactivityTimerReset(ActivitySource::MainControls);
|
||||||
if (FSWITCH_GROUP(j) == FSWITCH_GROUP(i)) {
|
if ((g_model.getSwitchType(i) == SWITCH_2POS && physicalState) ||
|
||||||
g_model.functionSwitchLogicalState &= ~(1 << j); // clear state
|
(g_model.getSwitchType(i) == SWITCH_TOGGLE)) {
|
||||||
|
if (g_model.cfsGroupAlwaysOn(g_model.getSwitchGroup(i)) != 0) {
|
||||||
|
// In an always on group
|
||||||
|
g_model.cfsSetState(i, 1);
|
||||||
|
} else {
|
||||||
|
g_model.cfsSetState(i, g_model.cfsState(i) ^ 1); // Toggle bit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_model.getSwitchGroup(i) && physicalState) {
|
||||||
|
// switch is in a group, other in group need to be turned off
|
||||||
|
for (uint8_t j = 0; j < switchGetMaxSwitches(); j++) {
|
||||||
|
if ((i != j) && switchIsCustomSwitch(j)) {
|
||||||
|
if (g_model.getSwitchGroup(j) == g_model.getSwitchGroup(i)) {
|
||||||
|
g_model.cfsSetState(j, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fsPreviousState ^= 1 << i; // Toggle state
|
||||||
|
storageDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fsPreviousState ^= 1 << i; // Toggle state
|
if (!pwrPressed()) {
|
||||||
storageDirty(EE_MODEL);
|
if (g_model.cfsState(i))
|
||||||
}
|
setFSLedON(i);
|
||||||
|
else
|
||||||
if (!pwrPressed()) {
|
setFSLedOFF(i);
|
||||||
if (getFSLogicalState(i))
|
}
|
||||||
setFSLedON(i);
|
|
||||||
else
|
|
||||||
setFSLedOFF(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool groupHasSwitchOn(uint8_t group)
|
bool groupHasSwitchOn(uint8_t group)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1)
|
for (int j = 0; j < switchGetMaxSwitches(); j += 1)
|
||||||
if (FSWITCH_GROUP(j) == group && getFSLogicalState(j))
|
if (switchIsCustomSwitch(j) && g_model.getSwitchGroup(j) == group && g_model.cfsState(j))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int firstSwitchInGroup(uint8_t group)
|
int firstSwitchInGroup(uint8_t group)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1)
|
for (int j = 0; j < switchGetMaxSwitches(); j += 1)
|
||||||
if (FSWITCH_GROUP(j) == group)
|
if (switchIsCustomSwitch(j) && g_model.getSwitchGroup(j) == group)
|
||||||
return j;
|
return j;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -231,28 +218,30 @@ int firstSwitchInGroup(uint8_t group)
|
|||||||
int groupDefaultSwitch(uint8_t group)
|
int groupDefaultSwitch(uint8_t group)
|
||||||
{
|
{
|
||||||
bool allOff = true;
|
bool allOff = true;
|
||||||
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1) {
|
for (int j = 0; j < switchGetMaxSwitches(); j += 1) {
|
||||||
if (FSWITCH_GROUP(j) == group) {
|
if (switchIsCustomSwitch(j)) {
|
||||||
if (FSWITCH_STARTUP(j) == FS_START_ON)
|
if (g_model.getSwitchGroup(j) == group) {
|
||||||
return j;
|
if (g_model.getSwitchStart(j) == FS_START_ON)
|
||||||
if (FSWITCH_STARTUP(j) != FS_START_OFF)
|
return j;
|
||||||
allOff = false;
|
if (g_model.getSwitchStart(j) != FS_START_OFF)
|
||||||
|
allOff = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allOff)
|
if (allOff)
|
||||||
return NUM_FUNCTIONS_SWITCHES;
|
return switchGetMaxSwitches();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setGroupSwitchState(uint8_t group, int defaultSwitch)
|
void setGroupSwitchState(uint8_t group)
|
||||||
{
|
{
|
||||||
// Check rules for always on group
|
// Check rules for always on group
|
||||||
// - Toggle switch type not valid, change all switches to 2POS
|
// - Toggle switch type not valid, change all switches to 2POS
|
||||||
// - One switch must be turned on, turn on first switch if needed
|
// - One switch must be turned on, turn on first switch if needed
|
||||||
if (IS_FSWITCH_GROUP_ON(group)) {
|
if (g_model.cfsGroupAlwaysOn(group)) {
|
||||||
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1) {
|
for (int j = 0; j < switchGetMaxSwitches(); j += 1) {
|
||||||
if (FSWITCH_GROUP(j) == group) {
|
if (switchIsCustomSwitch(j) && g_model.getSwitchGroup(j) == group) {
|
||||||
FSWITCH_SET_CONFIG(j, SWITCH_2POS); // Toggle not valid
|
g_model.setSwitchType(j, SWITCH_2POS); // Toggle not valid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!groupHasSwitchOn(group)) {
|
if (!groupHasSwitchOn(group)) {
|
||||||
@@ -260,16 +249,14 @@ void setGroupSwitchState(uint8_t group, int defaultSwitch)
|
|||||||
if (sw >= 0)
|
if (sw >= 0)
|
||||||
setFSLogicalState(sw, 1); // Make sure a switch is on
|
setFSLogicalState(sw, 1); // Make sure a switch is on
|
||||||
}
|
}
|
||||||
if (groupDefaultSwitch(group) == NUM_FUNCTIONS_SWITCHES) {
|
if (groupDefaultSwitch(group) == switchGetMaxSwitches()) {
|
||||||
// Start state for all switches is off - set all to 'last'
|
// Start state for all switches is off - set all to 'last'
|
||||||
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1)
|
for (int j = 0; j < switchGetMaxSwitches(); j += 1)
|
||||||
if (FSWITCH_GROUP(j) == group)
|
if (switchIsCustomSwitch(j) && g_model.getSwitchGroup(j) == group)
|
||||||
FSWITCH_SET_STARTUP(j, FS_START_PREVIOUS);
|
g_model.setSwitchStart(j, FS_START_PREVIOUS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
uint8_t getFSLogicalState(uint8_t) { return false; }
|
|
||||||
#endif // FUNCTION_SWITCHES
|
#endif // FUNCTION_SWITCHES
|
||||||
|
|
||||||
div_t switchInfo(int switchPosition)
|
div_t switchInfo(int switchPosition)
|
||||||
@@ -284,9 +271,9 @@ int switchLookupIdx(char c)
|
|||||||
idx = 2; // SWx
|
idx = 2; // SWx
|
||||||
}
|
}
|
||||||
|
|
||||||
auto max_switches = switchGetMaxSwitches() + switchGetMaxFctSwitches();
|
auto max_switches = switchGetMaxAllSwitches();
|
||||||
for (int i = 0; i < max_switches; i++) {
|
for (int i = 0; i < max_switches; i++) {
|
||||||
const char *name = switchGetName(i);
|
const char *name = switchGetDefaultName(i);
|
||||||
if (name[idx] == c) return i;
|
if (name[idx] == c) return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,9 +284,9 @@ int switchLookupIdx(const char* name, size_t len)
|
|||||||
{
|
{
|
||||||
if (len < 2 || (name[0] != 'S' && name[0] != 'F')) return -1;
|
if (len < 2 || (name[0] != 'S' && name[0] != 'F')) return -1;
|
||||||
|
|
||||||
auto max_switches = switchGetMaxSwitches() + switchGetMaxFctSwitches();
|
auto max_switches = switchGetMaxAllSwitches();
|
||||||
for (int i = 0; i < max_switches; i++) {
|
for (int i = 0; i < max_switches; i++) {
|
||||||
const char *sw_name = switchGetCanonicalName(i);
|
const char *sw_name = switchGetDefaultName(i);
|
||||||
if (strncmp(sw_name, name, len) == 0) return i;
|
if (strncmp(sw_name, name, len) == 0) return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,44 +295,13 @@ int switchLookupIdx(const char* name, size_t len)
|
|||||||
|
|
||||||
char switchGetLetter(uint8_t idx)
|
char switchGetLetter(uint8_t idx)
|
||||||
{
|
{
|
||||||
if (idx >= switchGetMaxSwitches() + switchGetMaxFctSwitches())
|
if (idx >= switchGetMaxAllSwitches() + MAX_FLEX_SWITCHES)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
uint8_t c = 1;
|
|
||||||
if (idx >= switchGetMaxSwitches() || switchIsFlex(idx)) c = 2;
|
|
||||||
|
|
||||||
const char* name = switchGetName(idx);
|
const char* name = switchGetDefaultName(idx);
|
||||||
if (!name) return -1;
|
if (!name) return -1;
|
||||||
|
|
||||||
return name[c];
|
return name[strlen(name) - 1];
|
||||||
}
|
|
||||||
|
|
||||||
static char _switchNames[MAX_SWITCHES][LEN_SWITCH_NAME + 1] = { 0 };
|
|
||||||
|
|
||||||
void switchSetCustomName(uint8_t idx, const char* str, size_t len)
|
|
||||||
{
|
|
||||||
strncpy(_switchNames[idx], str, min<size_t>(LEN_SWITCH_NAME, len));
|
|
||||||
_switchNames[idx][LEN_SWITCH_NAME] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* switchGetCustomName(uint8_t idx)
|
|
||||||
{
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
if (idx >= switchGetMaxSwitches()) // Switch is a customisable switch
|
|
||||||
return g_model.switchNames[idx - switchGetMaxSwitches()];
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return _switchNames[idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool switchHasCustomName(uint8_t idx)
|
|
||||||
{
|
|
||||||
return *switchGetCustomName(idx) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* switchGetCanonicalName(uint8_t idx)
|
|
||||||
{
|
|
||||||
return switchGetName(idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* fsSwitchGroupGetCanonicalName(uint8_t idx)
|
const char* fsSwitchGroupGetCanonicalName(uint8_t idx)
|
||||||
@@ -412,7 +368,7 @@ static uint64_t checkSwitchPosition(uint8_t idx, bool startup)
|
|||||||
void getSwitchesPosition(bool startup)
|
void getSwitchesPosition(bool startup)
|
||||||
{
|
{
|
||||||
uint64_t newPos = 0;
|
uint64_t newPos = 0;
|
||||||
for (unsigned i = 0; i < switchGetMaxSwitches(); i++) {
|
for (unsigned i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (!SWITCH_EXISTS(i)) continue;
|
if (!SWITCH_EXISTS(i)) continue;
|
||||||
newPos |= checkSwitchPosition(i, startup);
|
newPos |= checkSwitchPosition(i, startup);
|
||||||
}
|
}
|
||||||
@@ -453,7 +409,7 @@ void getSwitchesPosition(bool startup)
|
|||||||
uint8_t getSwitchCount()
|
uint8_t getSwitchCount()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); ++i) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); ++i) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@@ -461,10 +417,11 @@ uint8_t getSwitchCount()
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(COLORLCD)
|
||||||
uint8_t switchGetMaxRow(uint8_t col)
|
uint8_t switchGetMaxRow(uint8_t col)
|
||||||
{
|
{
|
||||||
uint8_t lastrow = 0;
|
uint8_t lastrow = 0;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); ++i) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); ++i) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
auto switch_display = switchGetDisplayPosition(i);
|
auto switch_display = switchGetDisplayPosition(i);
|
||||||
if (switch_display.col == col)
|
if (switch_display.col == col)
|
||||||
@@ -473,6 +430,7 @@ uint8_t switchGetMaxRow(uint8_t col)
|
|||||||
}
|
}
|
||||||
return lastrow;
|
return lastrow;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
getvalue_t getValueForLogicalSwitch(mixsrc_t i)
|
getvalue_t getValueForLogicalSwitch(mixsrc_t i)
|
||||||
{
|
{
|
||||||
@@ -719,18 +677,16 @@ bool getSwitch(swsrc_t swtch, uint8_t flags)
|
|||||||
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
||||||
cs_idx -= SWSRC_FIRST_SWITCH;
|
cs_idx -= SWSRC_FIRST_SWITCH;
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
auto max_reg_pos = switchGetMaxSwitches() * 3;
|
div_t qr = div(cs_idx, 3);
|
||||||
if (cs_idx >= max_reg_pos && cs_idx - max_reg_pos < switchGetMaxFctSwitches() * 3) {
|
if (switchIsCustomSwitch(qr.quot)) {
|
||||||
cs_idx -= max_reg_pos;
|
auto value = g_model.cfsState(qr.quot);
|
||||||
div_t qr = div(cs_idx, 3);
|
|
||||||
auto value = getFSLogicalState(qr.quot);
|
|
||||||
result = qr.rem == 0 ? !value : (qr.rem == 2 ? value : false);
|
result = qr.rem == 0 ? !value : (qr.rem == 2 ? value : false);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
div_t qr = div(cs_idx, 3);
|
div_t qr = div(cs_idx, 3);
|
||||||
if (SWITCH_EXISTS(qr.quot)) {
|
if (SWITCH_EXISTS(qr.quot)) {
|
||||||
auto sw_cfg = (SwitchConfig)SWITCH_CONFIG(qr.quot);
|
auto sw_cfg = g_model.getSwitchType(qr.quot);
|
||||||
if (flags & GETSWITCH_MIDPOS_DELAY) {
|
if (flags & GETSWITCH_MIDPOS_DELAY) {
|
||||||
result = SWITCH_POSITION(cs_idx);
|
result = SWITCH_POSITION(cs_idx);
|
||||||
// Handle 2POS switch installed in 3POS slot
|
// Handle 2POS switch installed in 3POS slot
|
||||||
@@ -829,7 +785,6 @@ static inline uint8_t _bits_set(uint8_t val, uint8_t bits)
|
|||||||
}
|
}
|
||||||
|
|
||||||
swarnstate_t switches_states = 0;
|
swarnstate_t switches_states = 0;
|
||||||
uint8_t fsswitches_states = 0;
|
|
||||||
|
|
||||||
swsrc_t getMovedSwitch()
|
swsrc_t getMovedSwitch()
|
||||||
{
|
{
|
||||||
@@ -837,40 +792,28 @@ swsrc_t getMovedSwitch()
|
|||||||
swsrc_t result = 0;
|
swsrc_t result = 0;
|
||||||
|
|
||||||
// Switches
|
// Switches
|
||||||
auto max_reg_switches = switchGetMaxSwitches();
|
auto max_switches = switchGetMaxAllSwitches();
|
||||||
for (uint8_t i = 0; i < max_reg_switches; i++) {
|
for (uint8_t i = 0; i < max_switches; i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t) 0x07 << (i * 3));
|
swarnstate_t mask = ((swarnstate_t) 0x03 << (i * 2));
|
||||||
uint8_t prev = (switches_states & mask) >> (i * 3);
|
uint8_t prev = (switches_states & mask) >> (i * 2);
|
||||||
uint8_t next = (1024 + getValue(MIXSRC_FIRST_SWITCH + i)) / 1024 + 1;
|
uint8_t next;
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
if (switchIsCustomSwitch(i))
|
||||||
|
next = g_model.cfsState(i) ? 3 : 1;
|
||||||
|
else
|
||||||
|
next = (1024 + getValue(MIXSRC_FIRST_SWITCH + i)) / 1024 + 1;
|
||||||
|
#else
|
||||||
|
next = (1024 + getValue(MIXSRC_FIRST_SWITCH + i)) / 1024 + 1;
|
||||||
|
#endif
|
||||||
if (prev != next) {
|
if (prev != next) {
|
||||||
switches_states =
|
switches_states =
|
||||||
(switches_states & (~mask)) | ((swarnstate_t)(next) << (i * 3));
|
(switches_states & (~mask)) | ((swarnstate_t)(next) << (i * 2));
|
||||||
result = (3 * i) + next;
|
result = (3 * i) + next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
auto fsswitches_cur_state = getFSLogicalState();
|
|
||||||
auto fsswitches_xor = fsswitches_cur_state ^ fsswitches_states;
|
|
||||||
fsswitches_states = fsswitches_cur_state;
|
|
||||||
|
|
||||||
if (fsswitches_xor) {
|
|
||||||
// we have some change...
|
|
||||||
if (_bits_set(fsswitches_xor, switchGetMaxFctSwitches()) > 1) {
|
|
||||||
// multiple bits change: use the one that turned ON
|
|
||||||
fsswitches_xor &= fsswitches_cur_state;
|
|
||||||
} else {
|
|
||||||
// only one bit changed: use the one that changed
|
|
||||||
}
|
|
||||||
|
|
||||||
auto sw = __builtin_ctz(fsswitches_xor);
|
|
||||||
auto pos = (fsswitches_cur_state & fsswitches_xor) ? 2 : 0;
|
|
||||||
result = (max_reg_switches + sw) * 3 + pos + SWSRC_FIRST_SWITCH;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Multipos
|
// Multipos
|
||||||
for (int i = 0; i < MAX_POTS; i++) {
|
for (int i = 0; i < MAX_POTS; i++) {
|
||||||
if (IS_POT_MULTIPOS(i)) {
|
if (IS_POT_MULTIPOS(i)) {
|
||||||
@@ -894,17 +837,18 @@ swsrc_t getMovedSwitch()
|
|||||||
|
|
||||||
bool isSwitchWarningRequired(uint16_t &bad_pots)
|
bool isSwitchWarningRequired(uint16_t &bad_pots)
|
||||||
{
|
{
|
||||||
swarnstate_t states = g_model.switchWarning;
|
|
||||||
|
|
||||||
if (!mixerTaskRunning()) getADC();
|
if (!mixerTaskRunning()) getADC();
|
||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
|
|
||||||
bool warn = false;
|
bool warn = false;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); i++) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t)0x07 << (i * 3));
|
uint8_t warnState = g_model.getSwitchWarning(i);
|
||||||
if ((states & mask) && !((states & mask) == (switches_states & mask))) {
|
if (warnState) {
|
||||||
warn = true;
|
swarnstate_t swState = g_model.getSwitchStateForWarning(i);
|
||||||
|
if (warnState != swState) {
|
||||||
|
warn = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -943,7 +887,6 @@ void checkSwitches()
|
|||||||
void checkSwitches()
|
void checkSwitches()
|
||||||
{
|
{
|
||||||
swarnstate_t last_bad_switches = 0xff;
|
swarnstate_t last_bad_switches = 0xff;
|
||||||
swarnstate_t states = g_model.switchWarning;
|
|
||||||
uint16_t bad_pots = 0, last_bad_pots = 0xff;
|
uint16_t bad_pots = 0, last_bad_pots = 0xff;
|
||||||
|
|
||||||
#if defined(PWR_BUTTON_PRESS)
|
#if defined(PWR_BUTTON_PRESS)
|
||||||
@@ -968,17 +911,16 @@ void checkSwitches()
|
|||||||
int x = SWITCH_WARNING_LIST_X;
|
int x = SWITCH_WARNING_LIST_X;
|
||||||
int y = SWITCH_WARNING_LIST_Y;
|
int y = SWITCH_WARNING_LIST_Y;
|
||||||
int numWarnings = 0;
|
int numWarnings = 0;
|
||||||
for (int i = 0; i < switchGetMaxSwitches(); ++i) {
|
for (int i = 0; i < switchGetMaxAllSwitches(); ++i) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t)0x07 << (i*3));
|
uint8_t warnState = g_model.getSwitchWarning(i);
|
||||||
if (states & mask) {
|
if (warnState) {
|
||||||
LcdFlags attr =
|
swarnstate_t swState = g_model.getSwitchStateForWarning(i);
|
||||||
((states & mask) == (switches_states & mask)) ? 0 : INVERS;
|
if (warnState != swState) {
|
||||||
if (attr) {
|
|
||||||
if (++numWarnings < 6) {
|
if (++numWarnings < 6) {
|
||||||
const char* s = getSwitchWarnSymbol((states & mask) >> (i * 3));
|
const char* s = getSwitchWarnSymbol(warnState);
|
||||||
drawSource(x, y, MIXSRC_FIRST_SWITCH + i, attr);
|
drawSource(x, y, MIXSRC_FIRST_SWITCH + i, INVERS);
|
||||||
lcdDrawText(lcdNextPos, y, s, attr);
|
lcdDrawText(lcdNextPos, y, s, INVERS);
|
||||||
x = lcdNextPos + 3;
|
x = lcdNextPos + 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1219,10 +1161,10 @@ void setAllPreflightSwitchStates()
|
|||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
// Mask switches enabled for warnings
|
// Mask switches enabled for warnings
|
||||||
swarnstate_t sw_mask = 0;
|
swarnstate_t sw_mask = 0;
|
||||||
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
|
for(uint8_t i = 0; i < switchGetMaxAllSwitches(); i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i))
|
if (SWITCH_WARNING_ALLOWED(i))
|
||||||
if (g_model.switchWarning & (0x07 << (3 * i)))
|
if (g_model.getSwitchWarning(i))
|
||||||
sw_mask |= (0x07 << (3 * i));
|
sw_mask |= (0x03 << (2 * i));
|
||||||
}
|
}
|
||||||
g_model.switchWarning = switches_states & sw_mask;
|
g_model.switchWarning = switches_states & sw_mask;
|
||||||
AUDIO_WARNING1();
|
AUDIO_WARNING1();
|
||||||
|
|||||||
+5
-13
@@ -78,14 +78,8 @@ int switchLookupIdx(const char* name, size_t len);
|
|||||||
// note: no customizable switches
|
// note: no customizable switches
|
||||||
char switchGetLetter(uint8_t idx);
|
char switchGetLetter(uint8_t idx);
|
||||||
|
|
||||||
// note: no customizable switches
|
|
||||||
const char* switchGetCanonicalName(uint8_t idx);
|
|
||||||
|
|
||||||
// customizable switches supported
|
// customizable switches supported
|
||||||
const char* fsSwitchGroupGetCanonicalName(uint8_t idx);
|
const char* fsSwitchGroupGetCanonicalName(uint8_t idx);
|
||||||
void switchSetCustomName(uint8_t idx, const char* str, size_t len);
|
|
||||||
const char* switchGetCustomName(uint8_t idx);
|
|
||||||
bool switchHasCustomName(uint8_t idx);
|
|
||||||
uint8_t getSwitchCountInFSGroup(uint8_t index);
|
uint8_t getSwitchCountInFSGroup(uint8_t index);
|
||||||
|
|
||||||
SwitchConfig switchGetMaxType(uint8_t idx);
|
SwitchConfig switchGetMaxType(uint8_t idx);
|
||||||
@@ -96,20 +90,18 @@ void logicalSwitchesInit(bool force);
|
|||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
void setFSStartupPosition();
|
void setFSStartupPosition();
|
||||||
void evalFunctionSwitches();
|
void evalFunctionSwitches();
|
||||||
uint8_t getFSLogicalState(uint8_t index);
|
|
||||||
void setFSLogicalState(uint8_t index, uint8_t value);
|
void setFSLogicalState(uint8_t index, uint8_t value);
|
||||||
bool groupHasSwitchOn(uint8_t group);
|
bool groupHasSwitchOn(uint8_t group);
|
||||||
int firstSwitchInGroup(uint8_t group);
|
int firstSwitchInGroup(uint8_t group);
|
||||||
int groupDefaultSwitch(uint8_t group);
|
int groupDefaultSwitch(uint8_t group);
|
||||||
void setGroupSwitchState(uint8_t group, int defaultSwitch = -1);
|
void setGroupSwitchState(uint8_t group);
|
||||||
uint8_t getFSPhysicalState(uint8_t index);
|
bool getFSPhysicalState(uint8_t index);
|
||||||
extern uint8_t functionSwitchFunctionState;
|
|
||||||
|
|
||||||
//led_driver.cpp
|
//led_driver.cpp
|
||||||
void fsLedOff(uint8_t);
|
void fsLedOff(uint8_t index);
|
||||||
void fsLedOn(uint8_t);
|
void fsLedOn(uint8_t index);
|
||||||
bool fsLedState(uint8_t index);
|
bool fsLedState(uint8_t index);
|
||||||
void fsLedRGB(uint8_t, uint32_t color);
|
void fsLedRGB(uint8_t index, uint32_t color);
|
||||||
uint32_t fsGetLedRGB(uint8_t index);
|
uint32_t fsGetLedRGB(uint8_t index);
|
||||||
uint8_t getRGBColorIndex(uint32_t color);
|
uint8_t getRGBColorIndex(uint32_t color);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
SwitchHwPos stm32_switch_get_position(const stm32_switch_t* sw)
|
SwitchHwPos stm32_switch_get_position(const stm32_switch_t* sw)
|
||||||
{
|
{
|
||||||
bool inv = sw->flags & SWITCH_HW_INVERTED;
|
bool inv = sw->inverted;
|
||||||
SwitchHwPos ret = SWITCH_HW_UP;
|
SwitchHwPos ret = SWITCH_HW_UP;
|
||||||
|
|
||||||
switch (sw->type) {
|
switch (sw->type) {
|
||||||
|
|||||||
@@ -21,20 +21,29 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "hal.h"
|
||||||
#include "stm32_hal_ll.h"
|
#include "stm32_hal_ll.h"
|
||||||
#include "hal/switch_driver.h"
|
#include "hal/switch_driver.h"
|
||||||
|
#include "edgetx_constants.h"
|
||||||
|
|
||||||
struct stm32_switch_t
|
struct stm32_switch_t
|
||||||
{
|
{
|
||||||
const char* name;
|
const char* name;
|
||||||
|
|
||||||
GPIO_TypeDef* GPIOx_high;
|
GPIO_TypeDef* GPIOx_high;
|
||||||
uint32_t Pin_high;
|
uint32_t Pin_high;
|
||||||
|
|
||||||
GPIO_TypeDef* GPIOx_low;
|
GPIO_TypeDef* GPIOx_low;
|
||||||
uint32_t Pin_low;
|
uint32_t Pin_low;
|
||||||
|
|
||||||
SwitchHwType type;
|
SwitchHwType type;
|
||||||
uint8_t flags;
|
bool inverted;
|
||||||
|
SwitchConfig defaultType;
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
bool isCustomSwitch;
|
||||||
|
uint8_t customSwitchIdx;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
SwitchHwPos stm32_switch_get_position(const stm32_switch_t* sw);
|
SwitchHwPos stm32_switch_get_position(const stm32_switch_t* sw);
|
||||||
|
|||||||
@@ -302,19 +302,6 @@ void bluetoothDisable();
|
|||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
#define NUM_FUNCTIONS_SWITCHES 6
|
#define NUM_FUNCTIONS_SWITCHES 6
|
||||||
#define NUM_FUNCTIONS_GROUPS 3
|
#define NUM_FUNCTIONS_GROUPS 3
|
||||||
#define DEFAULT_FS_CONFIG \
|
|
||||||
(SWITCH_2POS << 10) + (SWITCH_2POS << 8) + (SWITCH_2POS << 6) + \
|
|
||||||
(SWITCH_2POS << 4) + (SWITCH_2POS << 2) + (SWITCH_2POS << 0)
|
|
||||||
|
|
||||||
#define DEFAULT_FS_GROUPS \
|
|
||||||
(1 << 10) + (1 << 8) + (1 << 6) + (1 << 4) + (1 << 2) + \
|
|
||||||
(1 << 0) // Set all FS to group 1 to act like a 6pos
|
|
||||||
|
|
||||||
#define DEFAULT_FS_STARTUP_CONFIG \
|
|
||||||
((FS_START_PREVIOUS << 10) + (FS_START_PREVIOUS << 8) + \
|
|
||||||
(FS_START_PREVIOUS << 6) + (FS_START_PREVIOUS << 4) + \
|
|
||||||
(FS_START_PREVIOUS << 2) + \
|
|
||||||
(FS_START_PREVIOUS << 0)) // keep last state by default
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define NUM_FUNCTIONS_SWITCHES 0
|
#define NUM_FUNCTIONS_SWITCHES 0
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user