mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 08:45:24 +03:00
Fixes #1052
This commit is contained in:
parent
c1d57f0b0c
commit
573858552c
3 changed files with 18 additions and 3 deletions
|
@ -1003,6 +1003,17 @@ ExpoData * ModelData::insertInput(const int idx)
|
||||||
return &expoData[idx];
|
return &expoData[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ModelData::isInputValid(const unsigned int idx) const
|
||||||
|
{
|
||||||
|
for (int i=0; i<C9X_MAX_EXPOS; i++) {
|
||||||
|
const ExpoData * expo = &expoData[i];
|
||||||
|
if (expo->mode == 0) break;
|
||||||
|
if (expo->chn == idx)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ModelData::removeInput(const int idx)
|
void ModelData::removeInput(const int idx)
|
||||||
{
|
{
|
||||||
memmove(&expoData[idx], &expoData[idx+1], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
memmove(&expoData[idx], &expoData[idx+1], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||||
|
|
|
@ -939,6 +939,8 @@ class ModelData {
|
||||||
ExpoData * insertInput(const int idx);
|
ExpoData * insertInput(const int idx);
|
||||||
void removeInput(const int idx);
|
void removeInput(const int idx);
|
||||||
|
|
||||||
|
bool isInputValid(const unsigned int idx) const;
|
||||||
|
|
||||||
bool used;
|
bool used;
|
||||||
char name[12+1];
|
char name[12+1];
|
||||||
uint8_t modelVoice;
|
uint8_t modelVoice;
|
||||||
|
|
|
@ -548,11 +548,13 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
|
||||||
if (flags & POPULATE_VIRTUAL_INPUTS) {
|
if (flags & POPULATE_VIRTUAL_INPUTS) {
|
||||||
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
|
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
|
||||||
for (int i=0; i<virtualInputs; i++) {
|
for (int i=0; i<virtualInputs; i++) {
|
||||||
|
if (model.isInputValid(i)) {
|
||||||
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model);
|
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model);
|
||||||
b->addItem(item.toString(), item.toValue());
|
b->addItem(item.toString(), item.toValue());
|
||||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & POPULATE_SOURCES) {
|
if (flags & POPULATE_SOURCES) {
|
||||||
for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) {
|
for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue