feat(cpn): Trainer modes more closely mimic firmware (#3981)
This commit is contained in:
@@ -574,6 +574,15 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
|||||||
else
|
else
|
||||||
return 250000; // less than 400K
|
return 250000; // less than 400K
|
||||||
|
|
||||||
|
case HasTrainerModuleCPPM:
|
||||||
|
return (getCapability(board, HasTrainerModuleSBUS) || IS_FAMILY_HORUS_OR_T16(board));
|
||||||
|
|
||||||
|
case HasTrainerModuleSBUS:
|
||||||
|
return ((IS_TARANIS_X9LITE(board) || (IS_TARANIS_XLITE(board) && !IS_TARANIS_X9LITES(board)) ||
|
||||||
|
IS_TARANIS_X9DP_2019(board) || IS_TARANIS_X7_ACCESS(board) || IS_RADIOMASTER_ZORRO(board) ||
|
||||||
|
IS_RADIOMASTER_TX12_MK2(board) || IS_RADIOMASTER_BOXER(board)) ||
|
||||||
|
(getCapability(board, HasExternalModuleSupport) && (IS_TARANIS(board) && !IS_FAMILY_T12(board))));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,10 @@ namespace Board {
|
|||||||
HasInternalModuleSupport,
|
HasInternalModuleSupport,
|
||||||
HasExternalModuleSupport,
|
HasExternalModuleSupport,
|
||||||
HasAudioMuteGPIO,
|
HasAudioMuteGPIO,
|
||||||
SportMaxBaudRate
|
SportMaxBaudRate,
|
||||||
|
HasIntModuleHeartbeatGPIO,
|
||||||
|
HasTrainerModuleCPPM,
|
||||||
|
HasTrainerModuleSBUS,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SwitchInfo
|
struct SwitchInfo
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ static const YamlLookupTable trainerModeLut = {
|
|||||||
{ TRAINER_MODE_SLAVE_JACK, "SLAVE" },
|
{ TRAINER_MODE_SLAVE_JACK, "SLAVE" },
|
||||||
{ TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE, "MASTER_SBUS_EXT" },
|
{ TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE, "MASTER_SBUS_EXT" },
|
||||||
{ TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, "MASTER_CPPM_EXT" },
|
{ TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, "MASTER_CPPM_EXT" },
|
||||||
{ TRAINER_MODE_MASTER_BATTERY_COMPARTMENT, "MASTER_BATT_COMP" },
|
{ TRAINER_MODE_MASTER_SERIAL, "MASTER_BATT_COMP" },
|
||||||
{ TRAINER_MODE_MASTER_BLUETOOTH, "MASTER_BT" },
|
{ TRAINER_MODE_MASTER_BLUETOOTH, "MASTER_BT" },
|
||||||
{ TRAINER_MODE_SLAVE_BLUETOOTH, "SLAVE_BT" },
|
{ TRAINER_MODE_SLAVE_BLUETOOTH, "SLAVE_BT" },
|
||||||
{ TRAINER_MODE_MULTI, "MASTER_MULTI" },
|
{ TRAINER_MODE_MULTI, "MASTER_MULTI" },
|
||||||
|
|||||||
@@ -1625,8 +1625,8 @@ QString ModelData::trainerModeToString(int value)
|
|||||||
return tr("Master/SBUS Module");
|
return tr("Master/SBUS Module");
|
||||||
case TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE:
|
case TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE:
|
||||||
return tr("Master/CPPM Module");
|
return tr("Master/CPPM Module");
|
||||||
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
|
case TRAINER_MODE_MASTER_SERIAL:
|
||||||
return tr("Master/Battery");
|
return tr("Master/Serial");
|
||||||
case TRAINER_MODE_MASTER_BLUETOOTH:
|
case TRAINER_MODE_MASTER_BLUETOOTH:
|
||||||
return tr("Master/Bluetooth");
|
return tr("Master/Bluetooth");
|
||||||
case TRAINER_MODE_SLAVE_BLUETOOTH:
|
case TRAINER_MODE_SLAVE_BLUETOOTH:
|
||||||
@@ -1638,35 +1638,55 @@ QString ModelData::trainerModeToString(int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
bool ModelData::isTrainerModeAvailable(const GeneralSettings & generalSettings, const Firmware * firmware, const int value)
|
bool ModelData::isTrainerModeAvailable(const GeneralSettings & generalSettings, const Firmware * firmware, const int value)
|
||||||
{
|
{
|
||||||
if (value < TRAINER_MODE_FIRST || value > TRAINER_MODE_LAST)
|
if (value < TRAINER_MODE_FIRST || value > TRAINER_MODE_LAST)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool ret = true;
|
|
||||||
const Board::Type board = firmware->getBoard();
|
const Board::Type board = firmware->getBoard();
|
||||||
|
|
||||||
if (!IS_TARANIS(board) ||
|
if (value == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE &&
|
||||||
IS_ACCESS_RADIO(board, Firmware::getCurrentVariant()->getId())) {
|
IS_TARANIS_X9E(board) &&
|
||||||
if (value >= TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE &&
|
generalSettings.bluetoothMode)
|
||||||
value <= TRAINER_MODE_MASTER_BATTERY_COMPARTMENT)
|
return false;
|
||||||
ret = false;
|
|
||||||
} else if (generalSettings.serialPort[GeneralSettings::SP_AUX1] !=
|
|
||||||
UART_MODE_SBUS_TRAINER &&
|
|
||||||
value == TRAINER_MODE_MASTER_BATTERY_COMPARTMENT)
|
|
||||||
ret = false;
|
|
||||||
|
|
||||||
if (generalSettings.bluetoothMode !=
|
if (value == TRAINER_MODE_MASTER_SERIAL &&
|
||||||
GeneralSettings::BLUETOOTH_MODE_TRAINER &&
|
(generalSettings.serialPort[GeneralSettings::SP_AUX1] != GeneralSettings::AUX_SERIAL_SBUS_TRAINER &&
|
||||||
value >= TRAINER_MODE_MASTER_BLUETOOTH &&
|
generalSettings.serialPort[GeneralSettings::SP_AUX2] != GeneralSettings::AUX_SERIAL_SBUS_TRAINER))
|
||||||
value <= TRAINER_MODE_SLAVE_BLUETOOTH)
|
return false;
|
||||||
ret = false;
|
|
||||||
|
|
||||||
return ret;
|
if ((value == TRAINER_MODE_MASTER_BLUETOOTH || value == TRAINER_MODE_SLAVE_BLUETOOTH) &&
|
||||||
|
!IS_TARANIS_X9E(board) &&
|
||||||
|
generalSettings.bluetoothMode != GeneralSettings::BLUETOOTH_MODE_TRAINER)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ((value == TRAINER_MODE_MASTER_JACK || value == TRAINER_MODE_SLAVE_JACK) &&
|
||||||
|
((IS_TARANIS_XLITE(board) && !IS_TARANIS_X9LITES(board)) || IS_IFLIGHT_COMMANDO8(board)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (value == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE &&
|
||||||
|
!Boards::getCapability(board, Board::HasTrainerModuleCPPM))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (value == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE &&
|
||||||
|
!Boards::getCapability(board, Board::HasTrainerModuleSBUS))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ((value == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || value == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE) &&
|
||||||
|
(Boards::getCapability(board, Board::HasTrainerModuleCPPM) ||
|
||||||
|
Boards::getCapability(board, Board::HasTrainerModuleSBUS)) &&
|
||||||
|
moduleData[1].protocol != PULSES_OFF)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (value == TRAINER_MODE_MULTI &&
|
||||||
|
((!Boards::getCapability(board, Board::HasInternalModuleSupport) &&
|
||||||
|
!Boards::getCapability(board, Board::HasExternalModuleSupport)) ||
|
||||||
|
(moduleData[0].protocol != PULSES_MULTIMODULE && moduleData[1].protocol != PULSES_MULTIMODULE)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
AbstractStaticItemModel * ModelData::trainerModeItemModel(const GeneralSettings & generalSettings, const Firmware * firmware)
|
AbstractStaticItemModel * ModelData::trainerModeItemModel(const GeneralSettings & generalSettings, const Firmware * firmware)
|
||||||
{
|
{
|
||||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ enum TrainerMode {
|
|||||||
TRAINER_MODE_SLAVE_JACK,
|
TRAINER_MODE_SLAVE_JACK,
|
||||||
TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
|
TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
|
||||||
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
|
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
|
||||||
TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
|
TRAINER_MODE_MASTER_SERIAL,
|
||||||
TRAINER_MODE_MASTER_BLUETOOTH,
|
TRAINER_MODE_MASTER_BLUETOOTH,
|
||||||
TRAINER_MODE_SLAVE_BLUETOOTH,
|
TRAINER_MODE_SLAVE_BLUETOOTH,
|
||||||
TRAINER_MODE_MULTI,
|
TRAINER_MODE_MULTI,
|
||||||
@@ -327,8 +327,8 @@ class ModelData {
|
|||||||
|
|
||||||
QString trainerModeToString() const;
|
QString trainerModeToString() const;
|
||||||
static QString trainerModeToString(const int value);
|
static QString trainerModeToString(const int value);
|
||||||
static bool isTrainerModeAvailable(const GeneralSettings & generalSettings, const Firmware * firmware, const int value);
|
bool isTrainerModeAvailable(const GeneralSettings & generalSettings, const Firmware * firmware, const int value);
|
||||||
static AbstractStaticItemModel * trainerModeItemModel(const GeneralSettings & generalSettings, const Firmware * firmware);
|
AbstractStaticItemModel * trainerModeItemModel(const GeneralSettings & generalSettings, const Firmware * firmware);
|
||||||
unsigned int getFuncSwitchConfig(unsigned int index) const;
|
unsigned int getFuncSwitchConfig(unsigned int index) const;
|
||||||
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);
|
||||||
|
|||||||
@@ -233,27 +233,27 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
|
|||||||
ModelPanel(parent, model, generalSettings, firmware),
|
ModelPanel(parent, model, generalSettings, firmware),
|
||||||
module(module),
|
module(module),
|
||||||
moduleIdx(moduleIdx),
|
moduleIdx(moduleIdx),
|
||||||
ui(new Ui::Module)
|
ui(new Ui::Module),
|
||||||
|
trainerModeItemModel(nullptr)
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->label_module->setText(ModuleData::indexToString(moduleIdx, firmware));
|
ui->label_module->setText(ModuleData::indexToString(moduleIdx, firmware));
|
||||||
if (moduleIdx < 0) {
|
if (isTrainerModule(moduleIdx)) {
|
||||||
ui->formLayout_col1->setSpacing(0);
|
ui->formLayout_col1->setSpacing(0);
|
||||||
if (!IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
if (!IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||||
ui->label_trainerMode->hide();
|
ui->label_trainerMode->hide();
|
||||||
ui->trainerMode->hide();
|
ui->trainerMode->hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (panelFilteredItemModels)
|
updateTrainerModeItemModel();
|
||||||
ui->trainerMode->setModel(panelFilteredItemModels->getItemModel(FIM_TRAINERMODE));
|
|
||||||
ui->trainerMode->setField(model.trainerMode);
|
ui->trainerMode->setField(model.trainerMode);
|
||||||
connect(ui->trainerMode, &AutoComboBox::currentDataChanged, this, [=] () {
|
connect(ui->trainerMode, &AutoComboBox::currentDataChanged, this, [=] () {
|
||||||
update();
|
update();
|
||||||
emit updateItemModels();
|
emit updateItemModels();
|
||||||
emit modified();
|
emit modified();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,16 +263,16 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panelFilteredItemModels) {
|
if (panelFilteredItemModels) {
|
||||||
if (moduleIdx >= 0) {
|
if (!isTrainerModule(moduleIdx)) {
|
||||||
int id = panelFilteredItemModels->registerItemModel(new FilteredItemModel(ModuleData::protocolItemModel(generalSettings), moduleIdx + 1/*flag cannot be 0*/), QString("Module Protocol %1").arg(moduleIdx));
|
int id = panelFilteredItemModels->registerItemModel(new FilteredItemModel(ModuleData::protocolItemModel(generalSettings), moduleIdx + 1/*flag cannot be 0*/), QString("Module Protocol %1").arg(moduleIdx));
|
||||||
panelFilteredItemModels->getItemModel(id)->setSortCaseSensitivity(Qt::CaseInsensitive);
|
panelFilteredItemModels->getItemModel(id)->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
panelFilteredItemModels->getItemModel(id)->sort(0);
|
panelFilteredItemModels->getItemModel(id)->sort(0);
|
||||||
ui->protocol->setModel(panelFilteredItemModels->getItemModel(id));
|
ui->protocol->setModel(panelFilteredItemModels->getItemModel(id));
|
||||||
|
|
||||||
if (ui->protocol->findData(module.protocol) < 0) {
|
if (ui->protocol->findData(module.protocol) < 0) {
|
||||||
const QString moduleIdxDesc = moduleIdx == 0 ? tr("internal") : tr("external");
|
const QString moduleIdxDesc = isInternalModule(moduleIdx) ? tr("internal") : tr("external");
|
||||||
const QString compareDesc = moduleIdx == 0 ? tr("hardware") : tr("profile");
|
const QString compareDesc = isInternalModule(moduleIdx) ? tr("hardware") : tr("profile");
|
||||||
const QString intModuleDesc = moduleIdx == 0 ? ModuleData::typeToString(generalSettings.internalModule) : "";
|
const QString intModuleDesc = isInternalModule(moduleIdx) ? ModuleData::typeToString(generalSettings.internalModule) : "";
|
||||||
QString msg = tr("Warning: The %1 module protocol <b>%2</b> is incompatible with the <b>%3 %1 module %4</b> and has been set to <b>OFF</b>!");
|
QString msg = tr("Warning: The %1 module protocol <b>%2</b> is incompatible with the <b>%3 %1 module %4</b> and has been set to <b>OFF</b>!");
|
||||||
msg = msg.arg(moduleIdxDesc).arg(module.protocolToString(module.protocol)).arg(compareDesc).arg(intModuleDesc);
|
msg = msg.arg(moduleIdxDesc).arg(module.protocolToString(module.protocol)).arg(compareDesc).arg(intModuleDesc);
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
|
|||||||
ui->protocol->setField(module.protocol, this);
|
ui->protocol->setField(module.protocol, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moduleIdx == 0) {
|
if (isInternalModule(moduleIdx)) {
|
||||||
int id = panelFilteredItemModels->registerItemModel(new FilteredItemModel(GeneralSettings::antennaModeItemModel(true)), FIM_ANTENNAMODE);
|
int id = panelFilteredItemModels->registerItemModel(new FilteredItemModel(GeneralSettings::antennaModeItemModel(true)), FIM_ANTENNAMODE);
|
||||||
ui->antennaMode->setModel(panelFilteredItemModels->getItemModel(id));
|
ui->antennaMode->setModel(panelFilteredItemModels->getItemModel(id));
|
||||||
}
|
}
|
||||||
@@ -434,7 +434,7 @@ void ModulePanel::update()
|
|||||||
unsigned int mask = 0;
|
unsigned int mask = 0;
|
||||||
unsigned int max_rx_num = 63;
|
unsigned int max_rx_num = 63;
|
||||||
|
|
||||||
if (moduleIdx >= 0) {
|
if (!isTrainerModule(moduleIdx)) {
|
||||||
mask |= MASK_PROTOCOL;
|
mask |= MASK_PROTOCOL;
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case PULSES_PXX_R9M:
|
case PULSES_PXX_R9M:
|
||||||
@@ -461,7 +461,7 @@ void ModulePanel::update()
|
|||||||
else if (protocol==PULSES_ACCESS_ISRM || protocol==PULSES_ACCESS_R9M ||
|
else if (protocol==PULSES_ACCESS_ISRM || protocol==PULSES_ACCESS_R9M ||
|
||||||
protocol==PULSES_ACCESS_R9M_LITE || protocol==PULSES_ACCESS_R9M_LITE_PRO)
|
protocol==PULSES_ACCESS_R9M_LITE || protocol==PULSES_ACCESS_R9M_LITE_PRO)
|
||||||
mask |= MASK_RX_NUMBER | MASK_ACCESS;
|
mask |= MASK_RX_NUMBER | MASK_ACCESS;
|
||||||
if (moduleIdx == 0 &&
|
if (isInternalModule(moduleIdx) &&
|
||||||
(protocol==PULSES_PXX_XJT_X16 ||
|
(protocol==PULSES_PXX_XJT_X16 ||
|
||||||
protocol==PULSES_PXX_XJT_D8 || protocol==PULSES_PXX_XJT_LR12) &&
|
protocol==PULSES_PXX_XJT_D8 || protocol==PULSES_PXX_XJT_LR12) &&
|
||||||
HAS_EXTERNAL_ANTENNA(board) && generalSettings.antennaMode == GeneralSettings::ANTENNA_MODE_PER_MODEL)
|
HAS_EXTERNAL_ANTENNA(board) && generalSettings.antennaMode == GeneralSettings::ANTENNA_MODE_PER_MODEL)
|
||||||
@@ -553,7 +553,7 @@ void ModulePanel::update()
|
|||||||
mask |= MASK_FAILSAFES;
|
mask |= MASK_FAILSAFES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moduleIdx > 0)
|
if (isExternalModule(moduleIdx))
|
||||||
ui->telemetryBaudrate->setVisible(mask & MASK_BAUDRATE);
|
ui->telemetryBaudrate->setVisible(mask & MASK_BAUDRATE);
|
||||||
else
|
else
|
||||||
ui->telemetryBaudrate->setVisible(false);
|
ui->telemetryBaudrate->setVisible(false);
|
||||||
@@ -814,6 +814,7 @@ void ModulePanel::onProtocolChanged(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit protocolChanged();
|
||||||
emit updateItemModels();
|
emit updateItemModels();
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
@@ -1178,6 +1179,18 @@ void ModulePanel::onClearAccessRxClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModulePanel::updateTrainerModeItemModel()
|
||||||
|
{
|
||||||
|
if (isTrainerModule(moduleIdx)) {
|
||||||
|
if (trainerModeItemModel)
|
||||||
|
delete trainerModeItemModel;
|
||||||
|
|
||||||
|
trainerModeItemModel = new FilteredItemModel(model->trainerModeItemModel(generalSettings, firmware));
|
||||||
|
ui->trainerMode->setModel(trainerModeItemModel);
|
||||||
|
ui->trainerMode->updateValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
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),
|
||||||
@@ -1409,7 +1422,6 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||||||
panelItemModels->registerItemModel(TimerData::countdownStartItemModel());
|
panelItemModels->registerItemModel(TimerData::countdownStartItemModel());
|
||||||
panelItemModels->registerItemModel(TimerData::persistentItemModel());
|
panelItemModels->registerItemModel(TimerData::persistentItemModel());
|
||||||
panelItemModels->registerItemModel(TimerData::modeItemModel());
|
panelItemModels->registerItemModel(TimerData::modeItemModel());
|
||||||
panelFilteredModels->registerItemModel(new FilteredItemModel(ModelData::trainerModeItemModel(generalSettings, firmware)), FIM_TRAINERMODE);
|
|
||||||
panelItemModels->registerItemModel(TimerData::showElapsedItemModel());
|
panelItemModels->registerItemModel(TimerData::showElapsedItemModel());
|
||||||
Board::Type board = firmware->getBoard();
|
Board::Type board = firmware->getBoard();
|
||||||
|
|
||||||
@@ -1658,6 +1670,9 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||||||
ui->modulesLayout->addWidget(modules[CPN_MAX_MODULES]);
|
ui->modulesLayout->addWidget(modules[CPN_MAX_MODULES]);
|
||||||
connect(modules[CPN_MAX_MODULES], &ModulePanel::modified, this, &SetupPanel::modified);
|
connect(modules[CPN_MAX_MODULES], &ModulePanel::modified, this, &SetupPanel::modified);
|
||||||
connect(modules[CPN_MAX_MODULES], &ModulePanel::updateItemModels, this, &SetupPanel::onModuleUpdateItemModels);
|
connect(modules[CPN_MAX_MODULES], &ModulePanel::updateItemModels, this, &SetupPanel::onModuleUpdateItemModels);
|
||||||
|
for (int i = firmware->getCapability(NumFirstUsableModule); i < firmware->getCapability(NumModules); i++) {
|
||||||
|
connect(modules[i], &ModulePanel::protocolChanged, modules[CPN_MAX_MODULES], &ModulePanel::updateTrainerModeItemModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disableMouseScrolling();
|
disableMouseScrolling();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AutoLineEdit;
|
class AutoLineEdit;
|
||||||
|
class FilteredItemModel;
|
||||||
|
|
||||||
class TimerPanel : public ModelPanel
|
class TimerPanel : public ModelPanel
|
||||||
{
|
{
|
||||||
@@ -79,11 +80,13 @@ class ModulePanel : public ModelPanel
|
|||||||
public slots:
|
public slots:
|
||||||
void onExtendedLimitsToggled();
|
void onExtendedLimitsToggled();
|
||||||
void onFailsafeModified(unsigned index);
|
void onFailsafeModified(unsigned index);
|
||||||
|
void updateTrainerModeItemModel();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void channelsRangeChanged();
|
void channelsRangeChanged();
|
||||||
void failsafeModified(unsigned index);
|
void failsafeModified(unsigned index);
|
||||||
void updateItemModels();
|
void updateItemModels();
|
||||||
|
void protocolChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setupFailsafes();
|
void setupFailsafes();
|
||||||
@@ -133,6 +136,10 @@ class ModulePanel : public ModelPanel
|
|||||||
QMap<int, ChannelFailsafeWidgetsGroup> failsafeGroupsMap;
|
QMap<int, ChannelFailsafeWidgetsGroup> failsafeGroupsMap;
|
||||||
static quint8 failsafesValueDisplayType; // FailsafeValueDisplayTypes
|
static quint8 failsafesValueDisplayType; // FailsafeValueDisplayTypes
|
||||||
void updateFailsafeUI(unsigned channel, quint8 updtSb);
|
void updateFailsafeUI(unsigned channel, quint8 updtSb);
|
||||||
|
FilteredItemModel *trainerModeItemModel;
|
||||||
|
static bool isTrainerModule(int index) { return index < 0; }
|
||||||
|
static bool isInternalModule(int index) { return index == 0; }
|
||||||
|
static bool isExternalModule(int index) { return index > 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class FunctionSwitchesPanel : public ModelPanel
|
class FunctionSwitchesPanel : public ModelPanel
|
||||||
|
|||||||
Reference in New Issue
Block a user