Raphaelcoeffic/fix 6765 2.3 (#6795)
* match module as well, not just protocol * check unique RX# based on protocol (#6781)
This commit is contained in:
committed by
Bertrand Songis
parent
e9186e0c54
commit
526d892d6f
@@ -722,20 +722,22 @@ void TreeModel::refresh()
|
|||||||
}
|
}
|
||||||
int protocol;
|
int protocol;
|
||||||
QString rxs;
|
QString rxs;
|
||||||
for (unsigned j=0; j<CPN_MAX_MODULES; j++) {
|
unsigned moduleIdx = 0;
|
||||||
protocol = model.moduleData[j].protocol;
|
for (auto const& moduleData: model.moduleData) {
|
||||||
|
protocol = moduleData.protocol;
|
||||||
// These are the only RXs that allow nominating RX # but changing RX or copying models can leave residual configuration which can cause issues
|
// These are the only RXs that allow nominating RX # but changing RX or copying models can leave residual configuration which can cause issues
|
||||||
// if (protocol == PULSES_PXX_XJT_X16 || protocol == PULSES_PXX_XJT_LR12 || protocol == PULSES_PXX_R9M || protocol == PULSES_DSMX || protocol == PULSES_MULTIMODULE) {
|
// if (protocol == PULSES_PXX_XJT_X16 || protocol == PULSES_PXX_XJT_LR12 || protocol == PULSES_PXX_R9M || protocol == PULSES_DSMX || protocol == PULSES_MULTIMODULE) {
|
||||||
if (protocol != PULSES_OFF && model.moduleData[j].modelId > 0) {
|
if (protocol != PULSES_OFF && moduleData.modelId > 0) {
|
||||||
if (!rxs.isEmpty()) {
|
if (!rxs.isEmpty()) {
|
||||||
rxs.append(", ");
|
rxs.append(", ");
|
||||||
}
|
}
|
||||||
unsigned mdlidx = model.moduleData[j].modelId;
|
unsigned mdlidx = moduleData.modelId;
|
||||||
rxs.append(QString("%1").arg(uint(mdlidx), 2, 10, QChar('0')));
|
rxs.append(QString("%1").arg(uint(mdlidx), 2, 10, QChar('0')));
|
||||||
if (!isModelIdUnique(mdlidx)) {
|
if (!isModelIdUnique(mdlidx, moduleIdx, protocol)) {
|
||||||
current->setHighlightRX(true);
|
current->setHighlightRX(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
moduleIdx++;
|
||||||
}
|
}
|
||||||
current->setData(currentColumn++, rxs);
|
current->setData(currentColumn++, rxs);
|
||||||
}
|
}
|
||||||
@@ -746,17 +748,16 @@ void TreeModel::refresh()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TreeModel::isModelIdUnique(unsigned modelIdx)
|
bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned module, unsigned protocol)
|
||||||
{
|
{
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (unsigned i=0; i<radioData->models.size(); i++) {
|
for (auto const& model: radioData->models) {
|
||||||
ModelData & model = radioData->models[i];
|
|
||||||
if (!model.isEmpty()) {
|
if (!model.isEmpty()) {
|
||||||
for (unsigned j=0; j<CPN_MAX_MODULES; j++) {
|
unsigned moduleIdx = 0;
|
||||||
if (model.moduleData[j].protocol != PULSES_OFF && model.moduleData[j].modelId == modelIdx) {
|
const ModuleData& moduleData = model.moduleData[module];
|
||||||
if (++cnt > 1) {
|
if (moduleData.protocol == protocol && moduleData.modelId == modelIdx) {
|
||||||
return false;
|
if (++cnt > 1) {
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class TreeModel : public QAbstractItemModel
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TreeItem * getItem(const QModelIndex & index) const;
|
TreeItem * getItem(const QModelIndex & index) const;
|
||||||
bool isModelIdUnique(unsigned modelId);
|
bool isModelIdUnique(unsigned modelId, unsigned module, unsigned protocol);
|
||||||
|
|
||||||
TreeItem * rootItem;
|
TreeItem * rootItem;
|
||||||
RadioData * radioData;
|
RadioData * radioData;
|
||||||
|
|||||||
Reference in New Issue
Block a user