fix: enforce customisable switch rules when configuring (#4994)
This commit is contained in:
@@ -1697,106 +1697,195 @@ AbstractStaticItemModel * ModelData::trainerModeItemModel(const GeneralSettings
|
|||||||
return mdl;
|
return mdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int ModelData::getFuncSwitchConfig(unsigned int index) const
|
||||||
|
{
|
||||||
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
|
return Helpers::getBitmappedValue(functionSwitchConfig, index, 2);
|
||||||
|
else
|
||||||
|
return FUNC_SWITCH_CONFIG_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int ModelData::getFuncSwitchConfig(unsigned int index) const
|
void ModelData::setFuncSwitchConfig(unsigned int index, unsigned int value)
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
return Helpers::getBitmappedValue(functionSwitchConfig, index, 2);
|
Helpers::setBitmappedValue(functionSwitchConfig, value, index, 2);
|
||||||
else
|
}
|
||||||
return FUNC_SWITCH_CONFIG_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelData::setFuncSwitchConfig(unsigned int index, unsigned int value)
|
// static
|
||||||
{
|
QString ModelData::funcSwitchConfigToString(unsigned int value)
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
{
|
||||||
Helpers::setBitmappedValue(functionSwitchConfig, value, index, 2);
|
switch (value) {
|
||||||
}
|
case FUNC_SWITCH_CONFIG_NONE:
|
||||||
|
return tr("NONE");
|
||||||
|
case FUNC_SWITCH_CONFIG_TOGGLE:
|
||||||
|
return tr("TOGGLE");
|
||||||
|
case FUNC_SWITCH_CONFIG_2POS:
|
||||||
|
return tr("2POS");
|
||||||
|
default:
|
||||||
|
return CPN_STR_UNKNOWN_ITEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString ModelData::funcSwitchConfigToString(unsigned int value)
|
AbstractStaticItemModel * ModelData::funcSwitchConfigItemModel()
|
||||||
{
|
{
|
||||||
switch (value) {
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
case FUNC_SWITCH_CONFIG_NONE:
|
mdl->setName(AIM_MODELDATA_FUNCSWITCHCONFIG);
|
||||||
return tr("NONE");
|
for (unsigned int i = FUNC_SWITCH_CONFIG_FIRST; i <= FUNC_SWITCH_CONFIG_LAST; i++) {
|
||||||
case FUNC_SWITCH_CONFIG_TOGGLE:
|
mdl->appendToItemList(funcSwitchConfigToString(i), i);
|
||||||
return tr("TOGGLE");
|
}
|
||||||
case FUNC_SWITCH_CONFIG_2POS:
|
mdl->loadItemList();
|
||||||
return tr("2POS");
|
return mdl;
|
||||||
default:
|
}
|
||||||
return CPN_STR_UNKNOWN_ITEM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
AbstractStaticItemModel * ModelData::funcSwitchGroupStartSwitchModel(int switchcnt)
|
||||||
AbstractStaticItemModel * ModelData::funcSwitchConfigItemModel()
|
{
|
||||||
{
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
mdl->setName(AIM_MODELDATA_FUNCSWITCHGROUPSTARTSWITCH);
|
||||||
mdl->setName(AIM_MODELDATA_FUNCSWITCHCONFIG);
|
|
||||||
|
|
||||||
for (unsigned int i = FUNC_SWITCH_CONFIG_FIRST; i <= FUNC_SWITCH_CONFIG_LAST; i++) {
|
mdl->appendToItemList(tr("Restore"), 0);
|
||||||
mdl->appendToItemList(funcSwitchConfigToString(i), i);
|
for (unsigned int i = 1; i <= switchcnt; i += 1) {
|
||||||
}
|
mdl->appendToItemList(tr("SW") + QString::number(i), i);
|
||||||
|
}
|
||||||
|
mdl->appendToItemList(tr("Off"), switchcnt + 1);
|
||||||
|
|
||||||
mdl->loadItemList();
|
mdl->loadItemList();
|
||||||
return mdl;
|
return mdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ModelData::getFuncSwitchGroup(unsigned int index) const
|
AbstractStaticItemModel * ModelData::funcSwitchGroupsModel()
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
return Helpers::getBitmappedValue(functionSwitchGroup, index, 2);
|
mdl->setName(AIM_MODELDATA_FUNCSWITCHGROUPS);
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelData::setFuncSwitchGroup(unsigned int index, unsigned int value)
|
mdl->appendToItemList(tr("---"), 0);
|
||||||
{
|
for (unsigned int i = 1; i <= 3; i += 1) {
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
mdl->appendToItemList(tr("Group ") + QString::number(i), i);
|
||||||
Helpers::setBitmappedValue(functionSwitchGroup, value, index, 2);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int ModelData::getFuncSwitchAlwaysOnGroup(unsigned int index) const
|
mdl->loadItemList();
|
||||||
{
|
return mdl;
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION) {
|
}
|
||||||
unsigned int grp = getFuncSwitchGroup(index);
|
|
||||||
unsigned int switchcnt = Boards::getCapability(getCurrentFirmware()->getBoard(), Board::FunctionSwitches);
|
|
||||||
return Helpers::getBitmappedValue(functionSwitchGroup, grp, 1, 2 * switchcnt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelData::setFuncSwitchAlwaysOnGroup(unsigned int index, unsigned int value)
|
unsigned int ModelData::getFuncSwitchGroup(unsigned int index) const
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION) {
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
unsigned int grp = getFuncSwitchGroup(index);
|
return Helpers::getBitmappedValue(functionSwitchGroup, index, 2);
|
||||||
unsigned int switchcnt = Boards::getCapability(getCurrentFirmware()->getBoard(), Board::FunctionSwitches);
|
else
|
||||||
Helpers::setBitmappedValue(functionSwitchGroup, value, grp, 1, 2 * switchcnt);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int ModelData::getFuncSwitchStart(unsigned int index) const
|
void ModelData::setFuncSwitchGroup(unsigned int index, unsigned int value)
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
return Helpers::getBitmappedValue(functionSwitchStartConfig, index, 2);
|
Helpers::setBitmappedValue(functionSwitchGroup, value, index, 2);
|
||||||
else
|
}
|
||||||
return FUNC_SWITCH_START_INACTIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelData::setFuncSwitchStart(unsigned int index, unsigned int value)
|
unsigned int ModelData::getFuncSwitchAlwaysOnGroup(unsigned int group) const
|
||||||
{
|
{
|
||||||
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
if (group > 0 && group < 4) {
|
||||||
Helpers::setBitmappedValue(functionSwitchStartConfig, value, index, 2);
|
unsigned int switchcnt = Boards::getCapability(getCurrentFirmware()->getBoard(), Board::FunctionSwitches);
|
||||||
}
|
return Helpers::getBitmappedValue(functionSwitchGroup, group, 1, 2 * switchcnt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int ModelData::getFuncSwitchAlwaysOnGroupForSwitch(unsigned int index) const
|
||||||
|
{
|
||||||
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
|
return getFuncSwitchAlwaysOnGroup(getFuncSwitchGroup(index));
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::setFuncSwitchAlwaysOnGroup(unsigned int group, unsigned int value)
|
||||||
|
{
|
||||||
|
if (group > 0 && group < 4) {
|
||||||
|
unsigned int switchcnt = Boards::getCapability(getCurrentFirmware()->getBoard(), Board::FunctionSwitches);
|
||||||
|
Helpers::setBitmappedValue(functionSwitchGroup, value, group, 1, 2 * switchcnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int ModelData::getFuncSwitchStart(unsigned int index) const
|
||||||
|
{
|
||||||
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
|
return Helpers::getBitmappedValue(functionSwitchStartConfig, index, 2);
|
||||||
|
else
|
||||||
|
return FUNC_SWITCH_START_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::setFuncSwitchStart(unsigned int index, unsigned int value)
|
||||||
|
{
|
||||||
|
if (index < CPN_MAX_SWITCHES_FUNCTION)
|
||||||
|
Helpers::setBitmappedValue(functionSwitchStartConfig, value, index, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ModelData::getFuncGroupSwitchCount(unsigned int group, int switchcnt) const
|
||||||
|
{
|
||||||
|
int grpSwitchCount = 0;
|
||||||
|
for (int i = 0; i < switchcnt; i += 1) {
|
||||||
|
if (getFuncSwitchGroup(i) == group) {
|
||||||
|
grpSwitchCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return grpSwitchCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int ModelData::getFuncGroupSwitchStart(unsigned int group, int switchcnt) const
|
||||||
|
{
|
||||||
|
bool allDown = true;
|
||||||
|
for (int i = 0; i < switchcnt; i += 1) {
|
||||||
|
if (getFuncSwitchGroup(i) == group) {
|
||||||
|
if (getFuncSwitchStart(i) == FUNC_SWITCH_START_ON)
|
||||||
|
return i + 1;
|
||||||
|
if (getFuncSwitchStart(i) != FUNC_SWITCH_START_OFF)
|
||||||
|
allDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allDown && getFuncGroupSwitchCount(group, switchcnt) > 0) return switchcnt + 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::setFuncGroupSwitchStart(unsigned int group, unsigned int value, int switchcnt)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < switchcnt; i += 1) {
|
||||||
|
if (getFuncSwitchGroup(i) == group)
|
||||||
|
setFuncSwitchStart(i, value ? ModelData::FUNC_SWITCH_START_OFF : ModelData::FUNC_SWITCH_START_PREVIOUS);
|
||||||
|
}
|
||||||
|
if (value > 0 && value <= switchcnt) {
|
||||||
|
setFuncSwitchStart(value - 1, ModelData::FUNC_SWITCH_START_ON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelData::setGroupSwitchState(uint8_t group, int switchcnt)
|
||||||
|
{
|
||||||
|
// Check rules for always on group
|
||||||
|
// - Toggle switch type not valid, change all switches to 2POS
|
||||||
|
// - One switch must be turned on, turn on first switch if needed
|
||||||
|
if (getFuncSwitchAlwaysOnGroup(group)) {
|
||||||
|
for (int j = 0; j < switchcnt; j += 1) {
|
||||||
|
if (getFuncSwitchGroup(j) == group) {
|
||||||
|
setFuncSwitchConfig(j, FUNC_SWITCH_CONFIG_2POS); // Toggle not valid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getFuncGroupSwitchStart(group, switchcnt) == switchcnt + 1) {
|
||||||
|
// Start state for all switches is off - set all to 'last'
|
||||||
|
for (int j = 0; j < switchcnt; j += 1)
|
||||||
|
if (getFuncSwitchGroup(j) == group)
|
||||||
|
setFuncSwitchStart(j, FUNC_SWITCH_START_PREVIOUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
QString ModelData::funcSwitchStartToString(unsigned int value)
|
QString ModelData::funcSwitchStartToString(unsigned int value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case FUNC_SWITCH_START_INACTIVE:
|
case FUNC_SWITCH_START_OFF:
|
||||||
return tr("Inactive");
|
return tr("Off");
|
||||||
case FUNC_SWITCH_START_ACTIVE:
|
case FUNC_SWITCH_START_ON:
|
||||||
return tr("Active");
|
return tr("On");
|
||||||
case FUNC_SWITCH_START_PREVIOUS:
|
case FUNC_SWITCH_START_PREVIOUS:
|
||||||
return tr("Restore");
|
return tr("Restore");
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ class AbstractStaticItemModel;
|
|||||||
constexpr char AIM_MODELDATA_TRAINERMODE[] {"modeldata.trainermode"};
|
constexpr char AIM_MODELDATA_TRAINERMODE[] {"modeldata.trainermode"};
|
||||||
constexpr char AIM_MODELDATA_FUNCSWITCHCONFIG[] {"modeldata.funcswitchconfig"};
|
constexpr char AIM_MODELDATA_FUNCSWITCHCONFIG[] {"modeldata.funcswitchconfig"};
|
||||||
constexpr char AIM_MODELDATA_FUNCSWITCHSTART[] {"modeldata.funcswitchstart"};
|
constexpr char AIM_MODELDATA_FUNCSWITCHSTART[] {"modeldata.funcswitchstart"};
|
||||||
|
constexpr char AIM_MODELDATA_FUNCSWITCHGROUPSTARTSWITCH[] = {"modeldata.funcswitchgroupstartswitch"};
|
||||||
|
constexpr char AIM_MODELDATA_FUNCSWITCHGROUPS[] = {"modeldata.funcswitchgroups"};
|
||||||
|
|
||||||
class RSSIAlarmData {
|
class RSSIAlarmData {
|
||||||
public:
|
public:
|
||||||
@@ -214,10 +216,9 @@ class ModelData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum FunctionSwitchStart {
|
enum FunctionSwitchStart {
|
||||||
FUNC_SWITCH_START_ACTIVE,
|
FUNC_SWITCH_START_ON,
|
||||||
FUNC_SWITCH_START_FIRST = FUNC_SWITCH_START_ACTIVE,
|
FUNC_SWITCH_START_FIRST = FUNC_SWITCH_START_ON,
|
||||||
FUNC_SWITCH_START_INACTIVE,
|
FUNC_SWITCH_START_OFF,
|
||||||
//FUNC_SWITCH_START_FIRST = FUNC_SWITCH_START_INACTIVE,
|
|
||||||
FUNC_SWITCH_START_PREVIOUS,
|
FUNC_SWITCH_START_PREVIOUS,
|
||||||
FUNC_SWITCH_START_LAST = FUNC_SWITCH_START_PREVIOUS
|
FUNC_SWITCH_START_LAST = FUNC_SWITCH_START_PREVIOUS
|
||||||
};
|
};
|
||||||
@@ -331,15 +332,22 @@ class ModelData {
|
|||||||
void setFuncSwitchConfig(unsigned int index, unsigned int value);
|
void setFuncSwitchConfig(unsigned int index, unsigned int 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 * funcSwitchGroupsModel();
|
||||||
|
|
||||||
unsigned int getFuncSwitchGroup(unsigned int index) const;
|
unsigned int getFuncSwitchGroup(unsigned int index) const;
|
||||||
void setFuncSwitchGroup(unsigned int index, unsigned int value);
|
void setFuncSwitchGroup(unsigned int index, unsigned int value);
|
||||||
|
|
||||||
unsigned int getFuncSwitchAlwaysOnGroup(unsigned int index) const;
|
unsigned int getFuncSwitchAlwaysOnGroup(unsigned int group) const;
|
||||||
void setFuncSwitchAlwaysOnGroup(unsigned int index, unsigned int value);
|
unsigned int getFuncSwitchAlwaysOnGroupForSwitch(unsigned int index) const;
|
||||||
|
void setFuncSwitchAlwaysOnGroup(unsigned int group, unsigned int value);
|
||||||
|
void setGroupSwitchState(uint8_t group, int switchcnt);
|
||||||
|
|
||||||
unsigned int getFuncSwitchStart(unsigned int index) const;
|
unsigned int getFuncSwitchStart(unsigned int index) const;
|
||||||
void setFuncSwitchStart(unsigned int index, unsigned int value);
|
void setFuncSwitchStart(unsigned int index, unsigned int value);
|
||||||
|
int getFuncGroupSwitchCount(unsigned int group, int switchcnt) const;
|
||||||
|
unsigned int getFuncGroupSwitchStart(unsigned int group, int switchcnt) const;
|
||||||
|
void setFuncGroupSwitchStart(unsigned int group, unsigned int value, int switchcnt);
|
||||||
static QString funcSwitchStartToString(unsigned int value);
|
static QString funcSwitchStartToString(unsigned int value);
|
||||||
static AbstractStaticItemModel * funcSwitchStartItemModel();
|
static AbstractStaticItemModel * funcSwitchStartItemModel();
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
constexpr char FIM_TIMERSWITCH[] {"Timer Switch"};
|
constexpr char FIM_TIMERSWITCH[] {"Timer Switch"};
|
||||||
constexpr char FIM_THRSOURCE[] {"Throttle Source"};
|
constexpr char FIM_THRSOURCE[] {"Throttle Source"};
|
||||||
constexpr char FIM_TRAINERMODE[] {"Trainer Mode"};
|
// constexpr char FIM_TRAINERMODE[] {"Trainer Mode"};
|
||||||
constexpr char FIM_ANTENNAMODE[] {"Antenna Mode"};
|
constexpr char FIM_ANTENNAMODE[] {"Antenna Mode"};
|
||||||
constexpr char FIM_HATSMODE[] {"Hats Mode"};
|
constexpr char FIM_HATSMODE[] {"Hats Mode"};
|
||||||
|
|
||||||
@@ -1246,14 +1246,42 @@ void ModulePanel::updateTrainerModeItemModel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
bool FilteredGroupSwitchesModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
||||||
|
{
|
||||||
|
if (sourceRow == 0) return true;
|
||||||
|
if (sourceRow == m_switchcnt + 1) {
|
||||||
|
if (m_model->getFuncSwitchAlwaysOnGroup(m_group) || m_model->getFuncGroupSwitchCount(m_group, m_switchcnt) == 0)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (m_model->getFuncSwitchGroup(sourceRow - 1) == m_group)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilteredSwitchGroupsModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
||||||
|
{
|
||||||
|
if (sourceRow == 0) return true;
|
||||||
|
if (m_model->getFuncSwitchConfig(m_switch) == ModelData::FUNC_SWITCH_CONFIG_NONE) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilteredSwitchConfigsModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
||||||
|
{
|
||||||
|
if (sourceRow == ModelData::FUNC_SWITCH_CONFIG_NONE || sourceRow == ModelData::FUNC_SWITCH_CONFIG_2POS) return true;
|
||||||
|
return !m_model->getFuncSwitchAlwaysOnGroupForSwitch(m_switch);
|
||||||
|
}
|
||||||
|
|
||||||
FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||||
ModelPanel(parent, model, generalSettings, firmware),
|
ModelPanel(parent, model, generalSettings, firmware),
|
||||||
ui(new Ui::FunctionSwitches)
|
ui(new Ui::FunctionSwitches)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
AbstractStaticItemModel *fsConfig = ModelData::funcSwitchConfigItemModel();
|
fsConfig = ModelData::funcSwitchConfigItemModel();
|
||||||
AbstractStaticItemModel *fsStart = ModelData::funcSwitchStartItemModel();
|
AbstractStaticItemModel *fsStart = ModelData::funcSwitchStartItemModel();
|
||||||
|
AbstractStaticItemModel *fsGroups = ModelData::funcSwitchGroupsModel();
|
||||||
|
|
||||||
Board::Type board = firmware->getBoard();
|
Board::Type board = firmware->getBoard();
|
||||||
|
|
||||||
@@ -1261,6 +1289,8 @@ FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model
|
|||||||
|
|
||||||
switchcnt = Boards::getCapability(board, Board::FunctionSwitches);
|
switchcnt = Boards::getCapability(board, Board::FunctionSwitches);
|
||||||
|
|
||||||
|
fsGroupStart = ModelData::funcSwitchGroupStartSwitchModel(switchcnt);
|
||||||
|
|
||||||
for (int i = 0; i < switchcnt; i++) {
|
for (int i = 0; i < switchcnt; i++) {
|
||||||
QLabel * lblSwitchId = new QLabel(this);
|
QLabel * lblSwitchId = new QLabel(this);
|
||||||
lblSwitchId->setText(tr("SW%1").arg(i + 1));
|
lblSwitchId->setText(tr("SW%1").arg(i + 1));
|
||||||
@@ -1272,19 +1302,19 @@ FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model
|
|||||||
|
|
||||||
QComboBox * cboConfig = new QComboBox(this);
|
QComboBox * cboConfig = new QComboBox(this);
|
||||||
cboConfig->setProperty("index", i);
|
cboConfig->setProperty("index", i);
|
||||||
cboConfig->setModel(fsConfig);
|
auto configFilter = new FilteredSwitchConfigsModel(fsConfig, i, &model);
|
||||||
|
cboConfig->setModel(configFilter);
|
||||||
|
filterSwitchConfigs << configFilter;
|
||||||
|
|
||||||
QComboBox * cboStartPosn = new QComboBox(this);
|
QComboBox * cboStartPosn = new QComboBox(this);
|
||||||
cboStartPosn->setProperty("index", i);
|
cboStartPosn->setProperty("index", i);
|
||||||
cboStartPosn->setModel(fsStart);
|
cboStartPosn->setModel(fsStart);
|
||||||
|
|
||||||
QSpinBox * sbGroup = new QSpinBox(this);
|
QComboBox * cboGroup = new QComboBox(this);
|
||||||
sbGroup->setProperty("index", i);
|
cboGroup->setProperty("index", i);
|
||||||
sbGroup->setMaximum(3);
|
auto groupFilter = new FilteredSwitchGroupsModel(fsGroups, i, &model);
|
||||||
sbGroup->setSpecialValueText("-");
|
cboGroup->setModel(groupFilter);
|
||||||
|
filterSwitchGroups << groupFilter;
|
||||||
QCheckBox * cbAlwaysOnGroup = new QCheckBox(this);
|
|
||||||
cbAlwaysOnGroup->setProperty("index", i);
|
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
int coloffset = 1;
|
int coloffset = 1;
|
||||||
@@ -1292,20 +1322,43 @@ FunctionSwitchesPanel::FunctionSwitchesPanel(QWidget * parent, ModelData & model
|
|||||||
ui->gridSwitches->addWidget(aleName, row++, i + coloffset);
|
ui->gridSwitches->addWidget(aleName, row++, i + coloffset);
|
||||||
ui->gridSwitches->addWidget(cboConfig, row++, i + coloffset);
|
ui->gridSwitches->addWidget(cboConfig, row++, i + coloffset);
|
||||||
ui->gridSwitches->addWidget(cboStartPosn, row++, i + coloffset);
|
ui->gridSwitches->addWidget(cboStartPosn, row++, i + coloffset);
|
||||||
ui->gridSwitches->addWidget(sbGroup, row++, i + coloffset);
|
ui->gridSwitches->addWidget(cboGroup, row++, i + coloffset);
|
||||||
ui->gridSwitches->addWidget(cbAlwaysOnGroup, row++, i + coloffset);
|
|
||||||
|
|
||||||
connect(aleName, &AutoLineEdit::currentDataChanged, this, &FunctionSwitchesPanel::on_nameEditingFinished);
|
connect(aleName, &AutoLineEdit::currentDataChanged, this, &FunctionSwitchesPanel::on_nameEditingFinished);
|
||||||
connect(cboConfig, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_configCurrentIndexChanged);
|
connect(cboConfig, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_configCurrentIndexChanged);
|
||||||
connect(cboStartPosn, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_startPosnCurrentIndexChanged);
|
connect(cboStartPosn, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_startPosnCurrentIndexChanged);
|
||||||
connect(sbGroup, QOverload<int>::of(&QSpinBox::valueChanged), this, &FunctionSwitchesPanel::on_groupChanged);
|
connect(cboGroup, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_groupChanged);
|
||||||
connect(cbAlwaysOnGroup, &QCheckBox::toggled, this, &FunctionSwitchesPanel::on_alwaysOnGroupChanged);
|
|
||||||
|
|
||||||
aleNames << aleName;
|
aleNames << aleName;
|
||||||
cboConfigs << cboConfig;
|
cboConfigs << cboConfig;
|
||||||
cboStartupPosns << cboStartPosn;
|
cboStartupPosns << cboStartPosn;
|
||||||
sbGroups << sbGroup;
|
cboGroups << cboGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i += 1) {
|
||||||
|
QLabel * lblGroupId = new QLabel(this);
|
||||||
|
lblGroupId->setText(tr("Group %1").arg(i + 1));
|
||||||
|
|
||||||
|
QCheckBox * cbAlwaysOnGroup = new QCheckBox(this);
|
||||||
|
cbAlwaysOnGroup->setProperty("index", i);
|
||||||
|
|
||||||
|
QComboBox * cboStartPosn = new QComboBox(this);
|
||||||
|
cboStartPosn->setProperty("index", i);
|
||||||
|
auto filter = new FilteredGroupSwitchesModel(fsGroupStart, i + 1, &model, switchcnt);
|
||||||
|
cboStartPosn->setModel(filter);
|
||||||
|
filterGroupSwitches << filter;
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
int coloffset = 1;
|
||||||
|
ui->gridGroups->addWidget(lblGroupId, row++, i + coloffset);
|
||||||
|
ui->gridGroups->addWidget(cbAlwaysOnGroup, row++, i + coloffset);
|
||||||
|
ui->gridGroups->addWidget(cboStartPosn, row++, i + coloffset);
|
||||||
|
|
||||||
|
connect(cbAlwaysOnGroup, &QCheckBox::toggled, this, &FunctionSwitchesPanel::on_alwaysOnGroupChanged);
|
||||||
|
connect(cboStartPosn, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FunctionSwitchesPanel::on_groupStartPosnCurrentIndexChanged);
|
||||||
|
|
||||||
cbAlwaysOnGroups << cbAlwaysOnGroup;
|
cbAlwaysOnGroups << cbAlwaysOnGroup;
|
||||||
|
cboGroupStartupPosns << cboStartPosn;
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
@@ -1319,38 +1372,31 @@ FunctionSwitchesPanel::~FunctionSwitchesPanel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FunctionSwitchesPanel::update()
|
void FunctionSwitchesPanel::update()
|
||||||
{
|
|
||||||
for (int i = 0; i < switchcnt; i++) {
|
|
||||||
update(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FunctionSwitchesPanel::update(int index)
|
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
for (int i = 0; i < switchcnt; i++) {
|
for (int i = 0; i < switchcnt; i++) {
|
||||||
|
filterSwitchConfigs[i]->invalidate();
|
||||||
|
filterSwitchGroups[i]->invalidate();
|
||||||
|
|
||||||
aleNames[i]->update();
|
aleNames[i]->update();
|
||||||
cboConfigs[i]->setCurrentIndex(model->getFuncSwitchConfig(i));
|
cboConfigs[i]->setCurrentIndex(filterSwitchConfigs[i]->mapFromSource(fsConfig->index(model->getFuncSwitchConfig(i), 0)).row());
|
||||||
cboStartupPosns[i]->setCurrentIndex(model->getFuncSwitchStart(i));
|
cboStartupPosns[i]->setCurrentIndex(model->getFuncSwitchStart(i));
|
||||||
unsigned int grp = model->getFuncSwitchGroup(i);
|
unsigned int grp = model->getFuncSwitchGroup(i);
|
||||||
sbGroups[i]->setValue(grp);
|
cboGroups[i]->setCurrentIndex(grp);
|
||||||
cbAlwaysOnGroups[i]->setChecked(model->getFuncSwitchAlwaysOnGroup(i));
|
|
||||||
|
|
||||||
if (cboConfigs[i]->currentIndex() < 2)
|
cboStartupPosns[i]->setEnabled(cboConfigs[i]->currentIndex() >= ModelData::FUNC_SWITCH_CONFIG_2POS && (grp == 0));
|
||||||
cboStartupPosns[i]->setEnabled(false);
|
|
||||||
else
|
|
||||||
cboStartupPosns[i]->setEnabled(true);
|
|
||||||
|
|
||||||
if (cboConfigs[i]->currentIndex() < 1)
|
cboGroups[i]->setEnabled(cboConfigs[i]->currentIndex() >= ModelData::FUNC_SWITCH_CONFIG_TOGGLE);
|
||||||
sbGroups[i]->setEnabled(false);
|
}
|
||||||
else
|
|
||||||
sbGroups[i]->setEnabled(true);
|
|
||||||
|
|
||||||
if (!(sbGroups[i]->isEnabled()) || grp < 1)
|
for (int i = 0; i < 3; i += 1) {
|
||||||
cbAlwaysOnGroups[i]->setEnabled(false);
|
filterGroupSwitches[i]->invalidate();
|
||||||
else
|
|
||||||
cbAlwaysOnGroups[i]->setEnabled(true);
|
model->setGroupSwitchState(i + 1, switchcnt);
|
||||||
|
|
||||||
|
cbAlwaysOnGroups[i]->setChecked(model->getFuncSwitchAlwaysOnGroup(i + 1));
|
||||||
|
cboGroupStartupPosns[i]->setCurrentIndex(filterGroupSwitches[i]->mapFromSource(fsGroupStart->index(model->getFuncGroupSwitchStart(i + 1, switchcnt), 0)).row());
|
||||||
}
|
}
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
@@ -1372,14 +1418,16 @@ void FunctionSwitchesPanel::on_configCurrentIndexChanged(int index)
|
|||||||
if (cb && !lock) {
|
if (cb && !lock) {
|
||||||
lock = true;
|
lock = true;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
unsigned int i = sender()->property("index").toInt(&ok);
|
unsigned int sw = sender()->property("index").toInt(&ok);
|
||||||
if (ok && model->getFuncSwitchConfig(i) != (unsigned int)index) {
|
unsigned int config = filterSwitchConfigs[sw]->mapToSource(filterSwitchConfigs[sw]->index(index, 0)).row();
|
||||||
model->setFuncSwitchConfig(i, index);
|
if (ok && model->getFuncSwitchConfig(sw) != config) {
|
||||||
if (index < 2)
|
model->setFuncSwitchConfig(sw, config);
|
||||||
model->setFuncSwitchStart(i, ModelData::FUNC_SWITCH_START_INACTIVE);
|
if (config != ModelData::FUNC_SWITCH_CONFIG_2POS) {
|
||||||
if (index < 1)
|
model->setFuncSwitchStart(sw, ModelData::FUNC_SWITCH_START_PREVIOUS);
|
||||||
model->setFuncSwitchGroup(i, 0);
|
if ((config == ModelData::FUNC_SWITCH_CONFIG_NONE) || model->getFuncSwitchAlwaysOnGroupForSwitch(sw))
|
||||||
update(i);
|
model->setFuncSwitchGroup(sw, 0);
|
||||||
|
}
|
||||||
|
update();
|
||||||
emit modified();
|
emit modified();
|
||||||
emit updateDataModels();
|
emit updateDataModels();
|
||||||
}
|
}
|
||||||
@@ -1397,9 +1445,31 @@ void FunctionSwitchesPanel::on_startPosnCurrentIndexChanged(int index)
|
|||||||
if (cb && !lock) {
|
if (cb && !lock) {
|
||||||
lock = true;
|
lock = true;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
unsigned int i = sender()->property("index").toInt(&ok);
|
unsigned int sw = sender()->property("index").toInt(&ok);
|
||||||
if (ok && model->getFuncSwitchStart(i) != (unsigned int)index) {
|
if (ok && model->getFuncSwitchStart(sw) != (unsigned int)index) {
|
||||||
model->setFuncSwitchStart(i, index);
|
model->setFuncSwitchStart(sw, index);
|
||||||
|
update();
|
||||||
|
emit modified();
|
||||||
|
}
|
||||||
|
lock = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FunctionSwitchesPanel::on_groupStartPosnCurrentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
if (!sender())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QComboBox * cb = qobject_cast<QComboBox *>(sender());
|
||||||
|
|
||||||
|
if (cb && !lock) {
|
||||||
|
lock = true;
|
||||||
|
bool ok = false;
|
||||||
|
unsigned int grp = sender()->property("index").toInt(&ok);
|
||||||
|
unsigned int sw = filterGroupSwitches[grp]->mapToSource(filterGroupSwitches[grp]->index(index, 0)).row();
|
||||||
|
if (ok && model->getFuncGroupSwitchStart(grp + 1, switchcnt) != sw) {
|
||||||
|
model->setFuncGroupSwitchStart(grp + 1, sw, switchcnt);
|
||||||
|
update();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
lock = false;
|
lock = false;
|
||||||
@@ -1411,15 +1481,27 @@ void FunctionSwitchesPanel::on_groupChanged(int value)
|
|||||||
if (!sender())
|
if (!sender())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QSpinBox * sb = qobject_cast<QSpinBox *>(sender());
|
QComboBox * cb = qobject_cast<QComboBox *>(sender());
|
||||||
|
|
||||||
if (sb && !lock) {
|
if (cb && !lock) {
|
||||||
lock = true;
|
lock = true;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int i = sender()->property("index").toInt(&ok);
|
int sw = sender()->property("index").toInt(&ok);
|
||||||
if (ok && model->getFuncSwitchGroup(i) != (unsigned int)value) {
|
unsigned int grp = filterSwitchGroups[sw]->mapToSource(filterSwitchGroups[sw]->index(value, 0)).row();
|
||||||
model->setFuncSwitchGroup(i, (unsigned int)value);
|
if (ok && model->getFuncSwitchGroup(sw) != grp) {
|
||||||
update(i);
|
unsigned oldGrp = model->getFuncSwitchGroup(sw);
|
||||||
|
if (model->getFuncSwitchAlwaysOnGroup(grp)) {
|
||||||
|
if (model->getFuncSwitchConfig(sw) == ModelData::FUNC_SWITCH_CONFIG_TOGGLE)
|
||||||
|
model->setFuncSwitchConfig(sw, ModelData::FUNC_SWITCH_CONFIG_2POS);
|
||||||
|
}
|
||||||
|
if ((grp == 0) || (model->getFuncGroupSwitchStart(grp, switchcnt) == 0))
|
||||||
|
model->setFuncSwitchStart(sw, ModelData::FUNC_SWITCH_START_PREVIOUS);
|
||||||
|
else
|
||||||
|
model->setFuncSwitchStart(sw, ModelData::FUNC_SWITCH_START_OFF);
|
||||||
|
model->setFuncSwitchGroup(sw, grp);
|
||||||
|
if (oldGrp > 0)
|
||||||
|
model->setFuncGroupSwitchStart(oldGrp, model->getFuncGroupSwitchStart(oldGrp, switchcnt), switchcnt);
|
||||||
|
update();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
lock = false;
|
lock = false;
|
||||||
@@ -1436,10 +1518,22 @@ void FunctionSwitchesPanel::on_alwaysOnGroupChanged(int value)
|
|||||||
if (cb && !lock) {
|
if (cb && !lock) {
|
||||||
lock = true;
|
lock = true;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int i = sender()->property("index").toInt(&ok);
|
int grp = sender()->property("index").toInt(&ok) + 1;
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
model->setFuncSwitchAlwaysOnGroup(i, (unsigned int)value);
|
model->setFuncSwitchAlwaysOnGroup(grp, (unsigned int)value);
|
||||||
|
if (value) {
|
||||||
|
for (int i = 0; i < switchcnt; i += 1) {
|
||||||
|
if ((model->getFuncSwitchGroup(i) == grp) && (model->getFuncSwitchConfig(i) == ModelData::FUNC_SWITCH_CONFIG_TOGGLE))
|
||||||
|
model->setFuncSwitchConfig(i, ModelData::FUNC_SWITCH_CONFIG_2POS);
|
||||||
|
}
|
||||||
|
if (model->getFuncGroupSwitchStart(grp, switchcnt) == switchcnt + 1) {
|
||||||
|
for (int i = 0; i < switchcnt; i += 1) {
|
||||||
|
if (model->getFuncSwitchGroup(i) == grp)
|
||||||
|
model->setFuncSwitchStart(i, ModelData::FUNC_SWITCH_START_PREVIOUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
update();
|
update();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include "compounditemmodels.h"
|
#include "compounditemmodels.h"
|
||||||
#include "filtereditemmodels.h"
|
#include "filtereditemmodels.h"
|
||||||
|
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
constexpr char MIMETYPE_TIMER[] = "application/x-companion-timer";
|
constexpr char MIMETYPE_TIMER[] = "application/x-companion-timer";
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@@ -142,6 +144,103 @@ class ModulePanel : public ModelPanel
|
|||||||
static bool isExternalModule(int index) { return index > 0; }
|
static bool isExternalModule(int index) { return index > 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FilteredGroupSwitchesModel: public QSortFilterProxyModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit FilteredGroupSwitchesModel(AbstractItemModel * sourceModel, int group, ModelData * model, int switchcnt) :
|
||||||
|
QSortFilterProxyModel(nullptr),
|
||||||
|
m_group(group),
|
||||||
|
m_switchcnt(switchcnt),
|
||||||
|
m_model(model)
|
||||||
|
{
|
||||||
|
setFilterKeyColumn(0);
|
||||||
|
setDynamicSortFilter(true);
|
||||||
|
setSourceModel(sourceModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit FilteredGroupSwitchesModel(AbstractItemModel * sourceModel) :
|
||||||
|
FilteredGroupSwitchesModel(sourceModel, 0, nullptr, 0) {}
|
||||||
|
virtual ~FilteredGroupSwitchesModel() {};
|
||||||
|
|
||||||
|
void setGroup(int group) { m_group = group; }
|
||||||
|
int getGroup() const { return m_group; }
|
||||||
|
void setSwitchcnt(int n) { m_switchcnt = n; }
|
||||||
|
int getSwitchcnt() const { return m_switchcnt; }
|
||||||
|
void setModel(ModelData* model) { m_model = model; }
|
||||||
|
ModelData* getModel() const { return m_model; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_group = 0;
|
||||||
|
int m_switchcnt = 0;
|
||||||
|
ModelData* m_model = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FilteredSwitchGroupsModel: public QSortFilterProxyModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit FilteredSwitchGroupsModel(AbstractItemModel * sourceModel, int sw, ModelData * model) :
|
||||||
|
QSortFilterProxyModel(nullptr),
|
||||||
|
m_switch(sw),
|
||||||
|
m_model(model)
|
||||||
|
{
|
||||||
|
setFilterKeyColumn(0);
|
||||||
|
setDynamicSortFilter(true);
|
||||||
|
setSourceModel(sourceModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit FilteredSwitchGroupsModel(AbstractItemModel * sourceModel) :
|
||||||
|
FilteredSwitchGroupsModel(sourceModel, 0, nullptr) {}
|
||||||
|
virtual ~FilteredSwitchGroupsModel() {};
|
||||||
|
|
||||||
|
void setSwitch(int group) { m_switch = group; }
|
||||||
|
int getSwitch() const { return m_switch; }
|
||||||
|
void setModel(ModelData* model) { m_model = model; }
|
||||||
|
ModelData* getModel() const { return m_model; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_switch = 0;
|
||||||
|
ModelData* m_model = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FilteredSwitchConfigsModel: public QSortFilterProxyModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit FilteredSwitchConfigsModel(AbstractItemModel * sourceModel, int sw, ModelData * model) :
|
||||||
|
QSortFilterProxyModel(nullptr),
|
||||||
|
m_switch(sw),
|
||||||
|
m_model(model)
|
||||||
|
{
|
||||||
|
setFilterKeyColumn(0);
|
||||||
|
setDynamicSortFilter(true);
|
||||||
|
setSourceModel(sourceModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit FilteredSwitchConfigsModel(AbstractItemModel * sourceModel) :
|
||||||
|
FilteredSwitchConfigsModel(sourceModel, 0, nullptr) {}
|
||||||
|
virtual ~FilteredSwitchConfigsModel() {};
|
||||||
|
|
||||||
|
void setSwitch(int group) { m_switch = group; }
|
||||||
|
int getSwitch() const { return m_switch; }
|
||||||
|
void setModel(ModelData* model) { m_model = model; }
|
||||||
|
ModelData* getModel() const { return m_model; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_switch = 0;
|
||||||
|
ModelData* m_model = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
class FunctionSwitchesPanel : public ModelPanel
|
class FunctionSwitchesPanel : public ModelPanel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -150,8 +249,7 @@ class FunctionSwitchesPanel : public ModelPanel
|
|||||||
FunctionSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
|
FunctionSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
|
||||||
virtual ~FunctionSwitchesPanel();
|
virtual ~FunctionSwitchesPanel();
|
||||||
|
|
||||||
virtual void update();
|
void update();
|
||||||
void update(int index);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateDataModels();
|
void updateDataModels();
|
||||||
@@ -160,6 +258,7 @@ class FunctionSwitchesPanel : public ModelPanel
|
|||||||
void on_nameEditingFinished();
|
void on_nameEditingFinished();
|
||||||
void on_configCurrentIndexChanged(int index);
|
void on_configCurrentIndexChanged(int index);
|
||||||
void on_startPosnCurrentIndexChanged(int index);
|
void on_startPosnCurrentIndexChanged(int index);
|
||||||
|
void on_groupStartPosnCurrentIndexChanged(int index);
|
||||||
void on_groupChanged(int value);
|
void on_groupChanged(int value);
|
||||||
void on_alwaysOnGroupChanged(int value);
|
void on_alwaysOnGroupChanged(int value);
|
||||||
|
|
||||||
@@ -168,9 +267,15 @@ class FunctionSwitchesPanel : public ModelPanel
|
|||||||
QVector<AutoLineEdit *> aleNames;
|
QVector<AutoLineEdit *> aleNames;
|
||||||
QVector<QComboBox *> cboConfigs;
|
QVector<QComboBox *> cboConfigs;
|
||||||
QVector<QComboBox *> cboStartupPosns;
|
QVector<QComboBox *> cboStartupPosns;
|
||||||
QVector<QSpinBox *> sbGroups;
|
QVector<QComboBox *> cboGroups;
|
||||||
QVector<QCheckBox *> cbAlwaysOnGroups;
|
QVector<QCheckBox *> cbAlwaysOnGroups;
|
||||||
|
QVector<QComboBox *> cboGroupStartupPosns;
|
||||||
|
QVector<FilteredGroupSwitchesModel *> filterGroupSwitches;
|
||||||
|
QVector<FilteredSwitchGroupsModel *> filterSwitchGroups;
|
||||||
|
QVector<FilteredSwitchConfigsModel *> filterSwitchConfigs;
|
||||||
int switchcnt;
|
int switchcnt;
|
||||||
|
AbstractStaticItemModel *fsConfig;
|
||||||
|
AbstractStaticItemModel *fsGroupStart;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetupPanel : public ModelPanel
|
class SetupPanel : public ModelPanel
|
||||||
|
|||||||
@@ -63,13 +63,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lblType">
|
|
||||||
<property name="text">
|
|
||||||
<string>Type</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lblName">
|
<widget class="QLabel" name="lblName">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -77,6 +70,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="lblType">
|
||||||
|
<property name="text">
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="lblStartupPosn">
|
<widget class="QLabel" name="lblStartupPosn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -97,17 +97,71 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
</layout>
|
||||||
<widget class="QLabel" name="lblAlwaysOnGroup">
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayoutGroups">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lblGroups">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Switch Groups</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridGroups">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="groupId">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lblAlwaysOn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Always On</string>
|
<string>Always On</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="lblStartSwitch">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacerGroups">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -1002,7 +1002,7 @@ QString MultiModelPrinter::printFunctionSwitches()
|
|||||||
columns.appendRowStart(tr("Always On"), 20);
|
columns.appendRowStart(tr("Always On"), 20);
|
||||||
|
|
||||||
for (int i = 0; i < numFS; i++) {
|
for (int i = 0; i < numFS; i++) {
|
||||||
COMPARECELLWIDTH((model->getFuncSwitchAlwaysOnGroup((unsigned int)i) == 0 ? "No" : "Yes"), colwidth);
|
COMPARECELLWIDTH((model->getFuncSwitchAlwaysOnGroupForSwitch((unsigned int)i) == 0 ? "No" : "Yes"), colwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
columns.appendRowEnd();
|
columns.appendRowEnd();
|
||||||
|
|||||||
@@ -80,7 +80,15 @@ 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_FS_STARTUP,
|
ITEM_MODEL_SETUP_GROUP1_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON,
|
||||||
|
ITEM_MODEL_SETUP_GROUP1_START,
|
||||||
|
ITEM_MODEL_SETUP_GROUP2_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_GROUP2_ALWAYS_ON,
|
||||||
|
ITEM_MODEL_SETUP_GROUP2_START,
|
||||||
|
ITEM_MODEL_SETUP_GROUP3_LABEL,
|
||||||
|
ITEM_MODEL_SETUP_GROUP3_ALWAYS_ON,
|
||||||
|
ITEM_MODEL_SETUP_GROUP3_START,
|
||||||
#endif
|
#endif
|
||||||
ITEM_MODEL_SETUP_EXTENDED_LIMITS,
|
ITEM_MODEL_SETUP_EXTENDED_LIMITS,
|
||||||
ITEM_MODEL_SETUP_EXTENDED_TRIMS,
|
ITEM_MODEL_SETUP_EXTENDED_TRIMS,
|
||||||
@@ -248,6 +256,7 @@ uint8_t THROTTLE_ROW(uint8_t value)
|
|||||||
return HIDDEN_ROW;
|
return HIDDEN_ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
uint8_t FS_ROW(uint8_t value)
|
uint8_t FS_ROW(uint8_t value)
|
||||||
{
|
{
|
||||||
if (expandState.functionSwitches)
|
if (expandState.functionSwitches)
|
||||||
@@ -255,6 +264,11 @@ uint8_t FS_ROW(uint8_t value)
|
|||||||
return HIDDEN_ROW;
|
return 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 G3_ROW(int8_t value) { return (firstSwitchInGroup(3) >= 0) ? value : HIDDEN_ROW; }
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t VIEWOPT_ROW(uint8_t value)
|
uint8_t VIEWOPT_ROW(uint8_t value)
|
||||||
{
|
{
|
||||||
if (expandState.viewOpt)
|
if (expandState.viewOpt)
|
||||||
@@ -356,7 +370,15 @@ inline uint8_t TIMER_ROW(uint8_t timer, uint8_t value)
|
|||||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
FS_ROW(NAVIGATION_LINE_BY_LINE|3), \
|
||||||
FS_ROW(NAVIGATION_LINE_BY_LINE|(NUM_FUNCTIONS_SWITCHES-1)),
|
FS_ROW(G1_ROW(LABEL())), \
|
||||||
|
FS_ROW(G1_ROW(0)), \
|
||||||
|
FS_ROW(G1_ROW(0)), \
|
||||||
|
FS_ROW(G2_ROW(LABEL())), \
|
||||||
|
FS_ROW(G2_ROW(0)), \
|
||||||
|
FS_ROW(G2_ROW(0)), \
|
||||||
|
FS_ROW(G3_ROW(LABEL())), \
|
||||||
|
FS_ROW(G3_ROW(0)), \
|
||||||
|
FS_ROW(G3_ROW(0)),
|
||||||
#else
|
#else
|
||||||
#define FUNCTION_SWITCHES_ROWS
|
#define FUNCTION_SWITCHES_ROWS
|
||||||
#endif
|
#endif
|
||||||
@@ -544,7 +566,7 @@ inline uint8_t USB_JOYSTICK_APPLYROW()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
static const char* _fct_sw_start[] = { STR_CHAR_UP, STR_CHAR_DOWN, "=" };
|
static const char* _fct_sw_start[] = { STR_CHAR_DOWN, STR_CHAR_UP, "=" };
|
||||||
#endif
|
#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)
|
||||||
@@ -553,6 +575,31 @@ uint8_t viewOptChoice(coord_t y, const char* title, uint8_t value, uint8_t attr,
|
|||||||
return editChoice(96, y, nullptr, STR_ADCFILTERVALUES, value, 0, 2, attr, event);
|
return editChoice(96, y, nullptr, STR_ADCFILTERVALUES, value, 0, 2, attr, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
int cfsIndex;
|
||||||
|
uint8_t cfsGroup;
|
||||||
|
|
||||||
|
bool checkCFSTypeAvailable(int val)
|
||||||
|
{
|
||||||
|
int group = FSWITCH_GROUP(cfsIndex);
|
||||||
|
if (group > 0 && IS_FSWITCH_GROUP_ON(group) && val == SWITCH_TOGGLE)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkCFSGroupAvailable(int group)
|
||||||
|
{
|
||||||
|
if (FSWITCH_CONFIG(cfsIndex) == SWITCH_TOGGLE && group && IS_FSWITCH_GROUP_ON(group))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkCFSSwitchAvailable(int sw)
|
||||||
|
{
|
||||||
|
return (sw == 0) || (sw == NUM_FUNCTIONS_SWITCHES + 1) || (FSWITCH_GROUP(sw - 1) == cfsGroup);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void menuModelSetup(event_t event)
|
void menuModelSetup(event_t event)
|
||||||
{
|
{
|
||||||
int8_t old_editMode = s_editMode;
|
int8_t old_editMode = s_editMode;
|
||||||
@@ -781,8 +828,8 @@ void menuModelSetup(event_t event)
|
|||||||
timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event, INDENT_WIDTH);
|
timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event, INDENT_WIDTH);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if defined(FUNCTION_SWITCHES)
|
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
case ITEM_MODEL_SETUP_LABEL:
|
case ITEM_MODEL_SETUP_LABEL:
|
||||||
expandState.functionSwitches = expandableSection(y, STR_FUNCTION_SWITCHES, expandState.functionSwitches, attr, event);
|
expandState.functionSwitches = expandableSection(y, STR_FUNCTION_SWITCHES, expandState.functionSwitches, attr, event);
|
||||||
break;
|
break;
|
||||||
@@ -795,61 +842,107 @@ void menuModelSetup(event_t event)
|
|||||||
case ITEM_MODEL_SETUP_SW6:
|
case ITEM_MODEL_SETUP_SW6:
|
||||||
{
|
{
|
||||||
int index = k - ITEM_MODEL_SETUP_SW1;
|
int index = k - ITEM_MODEL_SETUP_SW1;
|
||||||
int config = FSWITCH_CONFIG(index);
|
|
||||||
lcdDrawSizedText(INDENT_WIDTH, y, STR_CHAR_SWITCH, 2, menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawSizedText(INDENT_WIDTH, y, STR_CHAR_SWITCH, 2, menuHorizontalPosition < 0 ? attr : 0);
|
||||||
lcdDrawText(lcdNextPos, y, switchGetName(index+switchGetMaxSwitches()), menuHorizontalPosition < 0 ? attr : 0);
|
lcdDrawText(lcdNextPos, y, switchGetName(index+switchGetMaxSwitches()), menuHorizontalPosition < 0 ? attr : 0);
|
||||||
|
|
||||||
if (ZEXIST(g_model.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
if (ZEXIST(g_model.switchNames[index]) || (attr && s_editMode > 0 && menuHorizontalPosition == 0))
|
||||||
editName(35, y, g_model.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0, 0, old_editMode);
|
editName(35, y, g_model.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0, 0, old_editMode);
|
||||||
else
|
else
|
||||||
lcdDrawMMM(35, y, menuHorizontalPosition == 0 ? attr : 0);
|
lcdDrawMMM(35, y, menuHorizontalPosition == 0 ? attr : 0);
|
||||||
config = editChoice(30 + 5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_2POS, menuHorizontalPosition == 1 ? attr : 0, event);
|
|
||||||
if (attr && checkIncDec_Ret) {
|
|
||||||
swconfig_t mask = (swconfig_t)0x03 << (2*index);
|
|
||||||
g_model.functionSwitchConfig = (g_model.functionSwitchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
|
|
||||||
}
|
|
||||||
|
|
||||||
config = FSWITCH_GROUP(index);
|
cfsIndex = index;
|
||||||
config = editChoice(30 + 13 * FW, y, "", STR_FSGROUPS, config, 0, 3, menuHorizontalPosition == 2 ? attr : 0, event);
|
int config = FSWITCH_CONFIG(index);
|
||||||
if (attr && checkIncDec_Ret && menuHorizontalPosition == 2) {
|
config = editChoice(30 + 5*FW, y, "", STR_SWTYPES, config, SWITCH_NONE, SWITCH_2POS, menuHorizontalPosition == 1 ? attr : 0, event, 0, checkCFSTypeAvailable);
|
||||||
swconfig_t mask = (swconfig_t) 0x03 << (2 * index);
|
if (attr && checkIncDec_Ret && menuHorizontalPosition == 1) {
|
||||||
g_model.functionSwitchGroup = (g_model.functionSwitchGroup & ~mask) | ((swconfig_t(config) & 0x03) << (2 * index));
|
FSWITCH_SET_CONFIG(index, config);
|
||||||
}
|
if (config == SWITCH_TOGGLE) {
|
||||||
|
FSWITCH_SET_STARTUP(index, FS_START_PREVIOUS); // Toggle switches do not have startup position
|
||||||
if (FSWITCH_GROUP(index)) {
|
|
||||||
uint8_t groupeAlwaysOn = IS_FSWITCH_GROUP_ON(config);
|
|
||||||
groupeAlwaysOn = editCheckBox(groupeAlwaysOn, 30 + 15 * FW, y, "", menuHorizontalPosition == 3 ? attr : 0, event);
|
|
||||||
if (attr && checkIncDec_Ret && menuHorizontalPosition == 3) {
|
|
||||||
swconfig_t mask = (swconfig_t) 0x01 << (2 * NUM_FUNCTIONS_SWITCHES + config);
|
|
||||||
g_model.functionSwitchGroup = (g_model.functionSwitchGroup & ~mask) | (groupeAlwaysOn << (2 * NUM_FUNCTIONS_SWITCHES + config));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (attr && menuHorizontalPosition == 3) { // Non visible checkbox
|
|
||||||
|
if (config != SWITCH_NONE) {
|
||||||
|
uint8_t group = FSWITCH_GROUP(index);
|
||||||
|
group = editChoice(30 + 13 * FW, y, "", STR_FSGROUPS, group, 0, 3, menuHorizontalPosition == 2 ? attr : 0, event, 0, checkCFSGroupAvailable);
|
||||||
|
if (attr && checkIncDec_Ret && menuHorizontalPosition == 2) {
|
||||||
|
int oldGroup = FSWITCH_GROUP(index);
|
||||||
|
if (groupHasSwitchOn(group))
|
||||||
|
setFSLogicalState(index, 0);
|
||||||
|
FSWITCH_SET_GROUP(index, group);
|
||||||
|
if (group > 0) {
|
||||||
|
FSWITCH_SET_STARTUP(index, groupDefaultSwitch(group) == -1 ? FS_START_PREVIOUS : FS_START_OFF);
|
||||||
|
if (config == SWITCH_TOGGLE && IS_FSWITCH_GROUP_ON(group))
|
||||||
|
FSWITCH_SET_CONFIG(index, SWITCH_2POS);
|
||||||
|
setGroupSwitchState(group, index);
|
||||||
|
} else {
|
||||||
|
FSWITCH_SET_STARTUP(index, FS_START_PREVIOUS);
|
||||||
|
}
|
||||||
|
setGroupSwitchState(oldGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config != SWITCH_TOGGLE && group == 0) {
|
||||||
|
int startPos = FSWITCH_STARTUP(index);
|
||||||
|
lcdDrawText(30 + 15 * FW, y, _fct_sw_start[startPos], attr && (menuHorizontalPosition == 3) ? (s_editMode ? INVERS + BLINK : INVERS) : 0);
|
||||||
|
if (attr && menuHorizontalPosition == 3) {
|
||||||
|
startPos = checkIncDec(event, startPos, FS_START_ON, FS_START_PREVIOUS, EE_MODEL);
|
||||||
|
FSWITCH_SET_STARTUP(index, startPos);
|
||||||
|
}
|
||||||
|
} else if (attr && menuHorizontalPosition == 3) {
|
||||||
|
repeatLastCursorMove(event);
|
||||||
|
}
|
||||||
|
} else if (attr && menuHorizontalPosition >= 2) {
|
||||||
repeatLastCursorMove(event);
|
repeatLastCursorMove(event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ITEM_MODEL_SETUP_FS_STARTUP:
|
case ITEM_MODEL_SETUP_GROUP1_LABEL:
|
||||||
{
|
case ITEM_MODEL_SETUP_GROUP2_LABEL:
|
||||||
const char* s;
|
case ITEM_MODEL_SETUP_GROUP3_LABEL:
|
||||||
lcdDrawText(INDENT_WIDTH, y, STR_START, menuHorizontalPosition < 0 ? attr : 0);
|
{
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
int group = (k - ITEM_MODEL_SETUP_GROUP1_LABEL) / 3 + 1;
|
||||||
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
lcdDrawText(INDENT_WIDTH, y, STR_GROUP);
|
||||||
s = _fct_sw_start[(g_model.functionSwitchStartConfig >> 2 * i) & 0x03];
|
lcdDrawNumber(lcdNextPos, y, group, 0);
|
||||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN - (2 + FW) + i * 2 * FW, y, i + 1, 0);
|
}
|
||||||
lcdDrawText(lcdNextPos, y, s, attr && (menuHorizontalPosition == i) ? (s_editMode ? INVERS + BLINK : INVERS) : 0);
|
break;
|
||||||
if (attr && menuHorizontalPosition == i) {
|
|
||||||
CHECK_INCDEC_MODELVAR(event, startPos, 0, 2);
|
case ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON:
|
||||||
}
|
case ITEM_MODEL_SETUP_GROUP2_ALWAYS_ON:
|
||||||
|
case ITEM_MODEL_SETUP_GROUP3_ALWAYS_ON:
|
||||||
|
{
|
||||||
|
uint8_t group = (k - ITEM_MODEL_SETUP_GROUP1_ALWAYS_ON) / 3 + 1;
|
||||||
|
lcdDrawText(INDENT_WIDTH * 2, y, STR_GROUP_ALWAYS_ON);
|
||||||
|
int groupAlwaysOn = IS_FSWITCH_GROUP_ON(group);
|
||||||
|
groupAlwaysOn = editCheckBox(groupAlwaysOn, MODEL_SETUP_2ND_COLUMN, y, nullptr, attr, event);
|
||||||
if (attr && checkIncDec_Ret) {
|
if (attr && checkIncDec_Ret) {
|
||||||
swconfig_t mask = (swconfig_t)0x03 << (2*i);
|
SET_FSWITCH_GROUP_ON(group, groupAlwaysOn);
|
||||||
g_model.functionSwitchStartConfig = (g_model.functionSwitchStartConfig & ~mask) | ((swconfig_t(startPos) & 0x03) << (2*i));
|
setGroupSwitchState(group);
|
||||||
storageDirty(EE_MODEL);
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ITEM_MODEL_SETUP_GROUP1_START:
|
||||||
|
case ITEM_MODEL_SETUP_GROUP2_START:
|
||||||
|
case ITEM_MODEL_SETUP_GROUP3_START:
|
||||||
|
{
|
||||||
|
uint8_t group = (k - ITEM_MODEL_SETUP_GROUP1_START) / 3 + 1;
|
||||||
|
lcdDrawText(INDENT_WIDTH * 2, y, STR_START);
|
||||||
|
int sw = groupDefaultSwitch(group) + 1;
|
||||||
|
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 (attr && checkIncDec_Ret) {
|
||||||
|
for (int i = 0; i < NUM_FUNCTIONS_SWITCHES; i += 1) {
|
||||||
|
if (FSWITCH_GROUP(i) == group) {
|
||||||
|
FSWITCH_SET_STARTUP(i, sw ? FS_START_OFF : FS_START_PREVIOUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sw > 0 && sw <= NUM_FUNCTIONS_SWITCHES) {
|
||||||
|
FSWITCH_SET_STARTUP(sw - 1, FS_START_ON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ITEM_MODEL_SETUP_EXTENDED_LIMITS:
|
case ITEM_MODEL_SETUP_EXTENDED_LIMITS:
|
||||||
g_model.extendedLimits = editCheckBox(g_model.extendedLimits, MODEL_SETUP_2ND_COLUMN, y, STR_ELIMITS, attr, event);
|
g_model.extendedLimits = editCheckBox(g_model.extendedLimits, MODEL_SETUP_2ND_COLUMN, y, STR_ELIMITS, attr, event);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ void menuRadioDiagFS(event_t event)
|
|||||||
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++) {
|
for(uint8_t i=0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
||||||
coord_t y = 2*FH + i*FH;
|
coord_t y = 2*FH + i*FH + 1;
|
||||||
lcdDrawTextIndented(y, STR_CHAR_SWITCH);
|
lcdDrawTextIndented(y, STR_CHAR_SWITCH);
|
||||||
lcdDrawText(lcdNextPos, y, switchGetName(i+switchGetMaxSwitches()), 0);
|
lcdDrawText(lcdNextPos, y, switchGetName(i+switchGetMaxSwitches()), 0);
|
||||||
lcdDrawNumber(FS_1ST_COLUMN + 2, y, getFSPhysicalState(i));
|
lcdDrawText(FS_1ST_COLUMN + 7, y, getFSPhysicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||||
lcdDrawNumber(FS_2ND_COLUMN + 5, y, getFSLogicalState(i));
|
lcdDrawText(FS_2ND_COLUMN + 5, y, getFSLogicalState(i) ? STR_CHAR_DOWN : STR_CHAR_UP);
|
||||||
lcdDrawNumber(FS_3RD_COLUMN + 5, y, getFSLedState(i));
|
lcdDrawText(FS_3RD_COLUMN, y, STR_OFFON[getFSLedState(i)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -95,8 +95,13 @@
|
|||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
#define FSW_CFG_BITS 2
|
#define FSW_CFG_BITS 2
|
||||||
#define FSWITCH_CONFIG(x) (bfGet<swconfig_t>(g_model.functionSwitchConfig, FSW_CFG_BITS * (x), FSW_CFG_BITS))
|
#define FSWITCH_CONFIG(x) (bfGet<swconfig_t>(g_model.functionSwitchConfig, 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_CONFIG(x,v) g_model.functionSwitchConfig = bfSet<swconfig_t>(g_model.functionSwitchConfig, 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 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 IS_SWITCH_FS(x) (x >= switchGetMaxSwitches() && x < (switchGetMaxSwitches() + switchGetMaxFctSwitches()))
|
||||||
#define SWITCH_EXISTS(x) (IS_SWITCH_FS(x) ? true : (SWITCH_CONFIG(x) != SWITCH_NONE))
|
#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_3POS(x) (IS_SWITCH_FS(x) ? (FSWITCH_CONFIG(x - switchGetMaxSwitches()) == SWITCH_3POS) : (SWITCH_CONFIG(x) == SWITCH_3POS))
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ enum FlexAnalogConfig {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum fsStartPositionType {
|
enum fsStartPositionType {
|
||||||
FS_START_UP,
|
FS_START_ON,
|
||||||
FS_START_DOWN,
|
FS_START_OFF,
|
||||||
FS_START_PREVIOUS
|
FS_START_PREVIOUS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+67
-2
@@ -91,11 +91,11 @@ void setFSStartupPosition()
|
|||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
||||||
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
||||||
switch(startPos) {
|
switch(startPos) {
|
||||||
case FS_START_DOWN:
|
case FS_START_OFF:
|
||||||
g_model.functionSwitchLogicalState &= ~(1 << i); // clear state
|
g_model.functionSwitchLogicalState &= ~(1 << i); // clear state
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FS_START_UP:
|
case FS_START_ON:
|
||||||
g_model.functionSwitchLogicalState |= 1 << i;
|
g_model.functionSwitchLogicalState |= 1 << i;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -117,6 +117,14 @@ uint8_t getFSLogicalState(uint8_t index)
|
|||||||
return (uint8_t )(bfSingleBitGet(getFSLogicalState(), index) >> (index));
|
return (uint8_t )(bfSingleBitGet(getFSLogicalState(), index) >> (index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setFSLogicalState(uint8_t index, uint8_t value)
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
g_model.functionSwitchLogicalState |= 1 << index; // Set bit
|
||||||
|
else
|
||||||
|
g_model.functionSwitchLogicalState &= ~(1 << index); // clear state
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t getFSPhysicalState(uint8_t index)
|
uint8_t getFSPhysicalState(uint8_t index)
|
||||||
{
|
{
|
||||||
index += switchGetMaxSwitches();
|
index += switchGetMaxSwitches();
|
||||||
@@ -172,6 +180,63 @@ void evalFunctionSwitches()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool groupHasSwitchOn(uint8_t group)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1)
|
||||||
|
if (FSWITCH_GROUP(j) == group && getFSLogicalState(j))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int firstSwitchInGroup(uint8_t group)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1)
|
||||||
|
if (FSWITCH_GROUP(j) == group)
|
||||||
|
return j;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int groupDefaultSwitch(uint8_t group)
|
||||||
|
{
|
||||||
|
bool allOff = true;
|
||||||
|
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1) {
|
||||||
|
if (FSWITCH_GROUP(j) == group) {
|
||||||
|
if (FSWITCH_STARTUP(j) == FS_START_ON)
|
||||||
|
return j;
|
||||||
|
if (FSWITCH_STARTUP(j) != FS_START_OFF)
|
||||||
|
allOff = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allOff)
|
||||||
|
return NUM_FUNCTIONS_SWITCHES;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setGroupSwitchState(uint8_t group, int defaultSwitch)
|
||||||
|
{
|
||||||
|
// Check rules for always on group
|
||||||
|
// - Toggle switch type not valid, change all switches to 2POS
|
||||||
|
// - One switch must be turned on, turn on first switch if needed
|
||||||
|
if (IS_FSWITCH_GROUP_ON(group)) {
|
||||||
|
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1) {
|
||||||
|
if (FSWITCH_GROUP(j) == group) {
|
||||||
|
FSWITCH_SET_CONFIG(j, SWITCH_2POS); // Toggle not valid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!groupHasSwitchOn(group)) {
|
||||||
|
int sw = firstSwitchInGroup(group);
|
||||||
|
if (sw >= 0)
|
||||||
|
setFSLogicalState(sw, 1); // Make sure a switch is on
|
||||||
|
}
|
||||||
|
if (groupDefaultSwitch(group) == NUM_FUNCTIONS_SWITCHES) {
|
||||||
|
// Start state for all switches is off - set all to 'last'
|
||||||
|
for (int j = 0; j < NUM_FUNCTIONS_SWITCHES; j += 1)
|
||||||
|
if (FSWITCH_GROUP(j) == group)
|
||||||
|
FSWITCH_SET_STARTUP(j, FS_START_PREVIOUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
uint8_t getFSLogicalState(uint8_t) { return false; }
|
uint8_t getFSLogicalState(uint8_t) { return false; }
|
||||||
#endif // FUNCTION_SWITCHES
|
#endif // FUNCTION_SWITCHES
|
||||||
|
|||||||
@@ -84,3 +84,12 @@ const char* switchGetCustomName(uint8_t idx);
|
|||||||
bool switchHasCustomName(uint8_t idx);
|
bool switchHasCustomName(uint8_t idx);
|
||||||
|
|
||||||
SwitchConfig switchGetMaxType(uint8_t idx);
|
SwitchConfig switchGetMaxType(uint8_t idx);
|
||||||
|
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
|
uint8_t getFSLogicalState(uint8_t index);
|
||||||
|
void setFSLogicalState(uint8_t index, uint8_t value);
|
||||||
|
bool groupHasSwitchOn(uint8_t group);
|
||||||
|
int firstSwitchInGroup(uint8_t group);
|
||||||
|
int groupDefaultSwitch(uint8_t group);
|
||||||
|
void setGroupSwitchState(uint8_t group, int defaultSwitch = -1);
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ ISTR(PPM_POL);
|
|||||||
ISTR(SBUS_INVERSION_VALUES);
|
ISTR(SBUS_INVERSION_VALUES);
|
||||||
ISTR(SPORT_MODES);
|
ISTR(SPORT_MODES);
|
||||||
ISTR(FSGROUPS);
|
ISTR(FSGROUPS);
|
||||||
|
ISTR(FSSWITCHES);
|
||||||
ISTR(ADCFILTERVALUES);
|
ISTR(ADCFILTERVALUES);
|
||||||
ISTR(TIMER_DIR);
|
ISTR(TIMER_DIR);
|
||||||
ISTR(PREFLIGHT_POTSLIDER_CHECK);
|
ISTR(PREFLIGHT_POTSLIDER_CHECK);
|
||||||
@@ -160,7 +161,11 @@ const char STR_PPMFRAME[] = TR_PPMFRAME;
|
|||||||
const char STR_REFRESHRATE[] = TR_REFRESHRATE;
|
const char STR_REFRESHRATE[] = TR_REFRESHRATE;
|
||||||
const char STR_MS[] = TR_MS;
|
const char STR_MS[] = TR_MS;
|
||||||
const char STR_SWITCH[] = TR_SWITCH;
|
const char STR_SWITCH[] = TR_SWITCH;
|
||||||
|
#if defined(FUNCTION_SWITCHES)
|
||||||
const char STR_FUNCTION_SWITCHES[] = TR_FUNCTION_SWITCHES;
|
const char STR_FUNCTION_SWITCHES[] = TR_FUNCTION_SWITCHES;
|
||||||
|
const char STR_GROUP[] = TR_GROUP;
|
||||||
|
const char STR_GROUP_ALWAYS_ON[] = TR_GROUP_ALWAYS_ON;
|
||||||
|
#endif
|
||||||
const char STR_ADJUST_GVAR[] = TR_ADJUST_GVAR;
|
const char STR_ADJUST_GVAR[] = TR_ADJUST_GVAR;
|
||||||
const char STR_PLAY_TRACK[] = TR_PLAY_TRACK;
|
const char STR_PLAY_TRACK[] = TR_PLAY_TRACK;
|
||||||
const char STR_PLAY_VALUE[] = TR_PLAY_VALUE;
|
const char STR_PLAY_VALUE[] = TR_PLAY_VALUE;
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ extern const char* const STR_MULTI_DSM_CLONE[];
|
|||||||
extern const char* const STR_MULTI_WBUS_MODE[];
|
extern const char* const STR_MULTI_WBUS_MODE[];
|
||||||
extern const char* const STR_SPORT_MODES[];
|
extern const char* const STR_SPORT_MODES[];
|
||||||
extern const char* const STR_FSGROUPS[];
|
extern const char* const STR_FSGROUPS[];
|
||||||
|
extern const char* const STR_FSSWITCHES[];
|
||||||
|
|
||||||
extern const char STR_AFHDS3_ONE_TO_ONE_TELEMETRY[];
|
extern const char STR_AFHDS3_ONE_TO_ONE_TELEMETRY[];
|
||||||
extern const char STR_AFHDS3_ONE_TO_MANY[];
|
extern const char STR_AFHDS3_ONE_TO_MANY[];
|
||||||
@@ -293,6 +294,8 @@ extern const char STR_REFRESHRATE[];
|
|||||||
extern const char STR_MS[];
|
extern const char STR_MS[];
|
||||||
extern const char STR_SWITCH[];
|
extern const char STR_SWITCH[];
|
||||||
extern const char STR_FUNCTION_SWITCHES[];
|
extern const char STR_FUNCTION_SWITCHES[];
|
||||||
|
extern const char STR_GROUP[];
|
||||||
|
extern const char STR_GROUP_ALWAYS_ON[];
|
||||||
extern const char STR_ADJUST_GVAR[];
|
extern const char STR_ADJUST_GVAR[];
|
||||||
extern const char STR_PLAY_TRACK[];
|
extern const char STR_PLAY_TRACK[];
|
||||||
extern const char STR_PLAY_VALUE[];
|
extern const char STR_PLAY_VALUE[];
|
||||||
|
|||||||
@@ -280,6 +280,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "开关"
|
#define TR_SWITCH "开关"
|
||||||
#define TR_FUNCTION_SWITCHES "可自定义开关"
|
#define TR_FUNCTION_SWITCHES "可自定义开关"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "微调"
|
#define TR_TRIMS "微调"
|
||||||
#define TR_FADEIN "渐入"
|
#define TR_FADEIN "渐入"
|
||||||
|
|||||||
@@ -295,6 +295,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Spínač"
|
#define TR_SWITCH "Spínač"
|
||||||
#define TR_FUNCTION_SWITCHES "Nastavitelné přepínače"
|
#define TR_FUNCTION_SWITCHES "Nastavitelné přepínače"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trimy"
|
#define TR_TRIMS "Trimy"
|
||||||
#define TR_FADEIN "Přechod Zap"
|
#define TR_FADEIN "Přechod Zap"
|
||||||
|
|||||||
@@ -288,6 +288,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Kontakt"
|
#define TR_SWITCH "Kontakt"
|
||||||
#define TR_FUNCTION_SWITCHES "Kontakter der kan tilpasses"
|
#define TR_FUNCTION_SWITCHES "Kontakter der kan tilpasses"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Udløser"
|
#define TR_SF_SWITCH "Udløser"
|
||||||
#define TR_TRIMS "Trim"
|
#define TR_TRIMS "Trim"
|
||||||
#define TR_FADEIN "Tone ind"
|
#define TR_FADEIN "Tone ind"
|
||||||
|
|||||||
@@ -286,6 +286,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH TR("Schalt.", "Schalter")
|
#define TR_SWITCH TR("Schalt.", "Schalter")
|
||||||
#define TR_FUNCTION_SWITCHES "Anpassbare Schalter"
|
#define TR_FUNCTION_SWITCHES "Anpassbare Schalter"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trimmer"
|
#define TR_TRIMS "Trimmer"
|
||||||
#define TR_FADEIN "Langs. Ein"
|
#define TR_FADEIN "Langs. Ein"
|
||||||
|
|||||||
@@ -285,6 +285,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Switch"
|
#define TR_SWITCH "Switch"
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable Switches"
|
#define TR_FUNCTION_SWITCHES "Customizable Switches"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trims"
|
#define TR_TRIMS "Trims"
|
||||||
#define TR_FADEIN "Fade in"
|
#define TR_FADEIN "Fade in"
|
||||||
|
|||||||
@@ -283,6 +283,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH TR("Interr.", "Interruptor")
|
#define TR_SWITCH TR("Interr.", "Interruptor")
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trims"
|
#define TR_TRIMS "Trims"
|
||||||
#define TR_FADEIN "Inicio"
|
#define TR_FADEIN "Inicio"
|
||||||
|
|||||||
@@ -297,6 +297,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Switch"
|
#define TR_SWITCH "Switch"
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trims"
|
#define TR_TRIMS "Trims"
|
||||||
#define TR_FADEIN "Fade In"
|
#define TR_FADEIN "Fade In"
|
||||||
|
|||||||
@@ -289,6 +289,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "מתג"
|
#define TR_SWITCH "מתג"
|
||||||
#define TR_FUNCTION_SWITCHES "מפסקים בהתאמה אישית"
|
#define TR_FUNCTION_SWITCHES "מפסקים בהתאמה אישית"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "הדק"
|
#define TR_SF_SWITCH "הדק"
|
||||||
#define TR_TRIMS "קיזוזים"
|
#define TR_TRIMS "קיזוזים"
|
||||||
#define TR_FADEIN "Fade in"
|
#define TR_FADEIN "Fade in"
|
||||||
|
|||||||
@@ -285,6 +285,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Inter."
|
#define TR_SWITCH "Inter."
|
||||||
#define TR_FUNCTION_SWITCHES "Interruttori personalizzabili"
|
#define TR_FUNCTION_SWITCHES "Interruttori personalizzabili"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trims"
|
#define TR_TRIMS "Trims"
|
||||||
#define TR_FADEIN "Diss.In"
|
#define TR_FADEIN "Diss.In"
|
||||||
|
|||||||
@@ -284,6 +284,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "スイッチ"
|
#define TR_SWITCH "スイッチ"
|
||||||
#define TR_FUNCTION_SWITCHES "カスタマイズ スイッチ"
|
#define TR_FUNCTION_SWITCHES "カスタマイズ スイッチ"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "トリガー"
|
#define TR_SF_SWITCH "トリガー"
|
||||||
#define TR_TRIMS "トリム"
|
#define TR_TRIMS "トリム"
|
||||||
#define TR_FADEIN "フェードイン"
|
#define TR_FADEIN "フェードイン"
|
||||||
|
|||||||
@@ -282,6 +282,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH TR("Schak.", "Schakelaar")
|
#define TR_SWITCH TR("Schak.", "Schakelaar")
|
||||||
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
#define TR_FUNCTION_SWITCHES "Customizable switches"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trims"
|
#define TR_TRIMS "Trims"
|
||||||
#define TR_FADEIN "Fade in"
|
#define TR_FADEIN "Fade in"
|
||||||
|
|||||||
@@ -282,6 +282,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Przełą"
|
#define TR_SWITCH "Przełą"
|
||||||
#define TR_FUNCTION_SWITCHES "Ustawiane przełączniki"
|
#define TR_FUNCTION_SWITCHES "Ustawiane przełączniki"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trymy"
|
#define TR_TRIMS "Trymy"
|
||||||
#define TR_FADEIN "Pojawia"
|
#define TR_FADEIN "Pojawia"
|
||||||
|
|||||||
@@ -288,6 +288,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Chave"
|
#define TR_SWITCH "Chave"
|
||||||
#define TR_FUNCTION_SWITCHES "Chaves customizáveis"
|
#define TR_FUNCTION_SWITCHES "Chaves customizáveis"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Disparo"
|
#define TR_SF_SWITCH "Disparo"
|
||||||
#define TR_TRIMS "Trims"
|
#define TR_TRIMS "Trims"
|
||||||
#define TR_FADEIN "Aparecer"
|
#define TR_FADEIN "Aparecer"
|
||||||
|
|||||||
@@ -287,6 +287,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Тумблер"
|
#define TR_SWITCH "Тумблер"
|
||||||
#define TR_FUNCTION_SWITCHES "Настр тумблеры"
|
#define TR_FUNCTION_SWITCHES "Настр тумблеры"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Триггер"
|
#define TR_SF_SWITCH "Триггер"
|
||||||
#define TR_TRIMS "тримы"
|
#define TR_TRIMS "тримы"
|
||||||
#define TR_FADEIN "Затух входа"
|
#define TR_FADEIN "Затух входа"
|
||||||
|
|||||||
@@ -298,6 +298,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Brytare"
|
#define TR_SWITCH "Brytare"
|
||||||
#define TR_FUNCTION_SWITCHES "Anpassningsbara brytare"
|
#define TR_FUNCTION_SWITCHES "Anpassningsbara brytare"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "Trimmar"
|
#define TR_TRIMS "Trimmar"
|
||||||
#define TR_FADEIN "Tona in"
|
#define TR_FADEIN "Tona in"
|
||||||
|
|||||||
@@ -285,6 +285,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "開關"
|
#define TR_SWITCH "開關"
|
||||||
#define TR_FUNCTION_SWITCHES "可自定義開關"
|
#define TR_FUNCTION_SWITCHES "可自定義開關"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Trigger"
|
#define TR_SF_SWITCH "Trigger"
|
||||||
#define TR_TRIMS "微調"
|
#define TR_TRIMS "微調"
|
||||||
#define TR_FADEIN "漸入"
|
#define TR_FADEIN "漸入"
|
||||||
|
|||||||
@@ -287,6 +287,8 @@
|
|||||||
#define TR_MS "ms"
|
#define TR_MS "ms"
|
||||||
#define TR_SWITCH "Перемикач"
|
#define TR_SWITCH "Перемикач"
|
||||||
#define TR_FUNCTION_SWITCHES "Користувацькі перемикачі"
|
#define TR_FUNCTION_SWITCHES "Користувацькі перемикачі"
|
||||||
|
#define TR_GROUP "Group"
|
||||||
|
#define TR_GROUP_ALWAYS_ON "Always on"
|
||||||
#define TR_SF_SWITCH "Тригери"
|
#define TR_SF_SWITCH "Тригери"
|
||||||
#define TR_TRIMS "Трим."
|
#define TR_TRIMS "Трим."
|
||||||
#define TR_FADEIN "Вх.Згасання"
|
#define TR_FADEIN "Вх.Згасання"
|
||||||
|
|||||||
@@ -314,6 +314,7 @@
|
|||||||
#define STR_CHAR_BW_DEGREE '@'
|
#define STR_CHAR_BW_DEGREE '@'
|
||||||
|
|
||||||
#define TR_FSGROUPS "-","1","2","3"
|
#define TR_FSGROUPS "-","1","2","3"
|
||||||
|
#define TR_FSSWITCHES "=", "SW1", "SW2", "SW3", "SW4", "SW5", "SW6", TR_OFF
|
||||||
|
|
||||||
//
|
//
|
||||||
// HoTT Telemetry sensor names by Hott device
|
// HoTT Telemetry sensor names by Hott device
|
||||||
|
|||||||
Reference in New Issue
Block a user