Skip to content

Commit

Permalink
fix(color): New inputs disappear until restart
Browse files Browse the repository at this point in the history
Cherrypick of EdgeTX#4317 and EdgeTX#4330

Co-authored-by: philmoz <philmoz@users.noreply.github.com>
  • Loading branch information
2 people authored and MRC3742 committed Dec 22, 2023
1 parent 4d78e07 commit 85063f2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions radio/src/gui/colorlcd/model_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,22 @@ void ModelInputsPage::newInput()
menu->setTitle(STR_MENU_INPUTS);

uint8_t chn = 0;
uint8_t index = 0;
ExpoData* line = g_model.expoData;

// search for unused channels
for (uint8_t i = 0; i < MAX_EXPOS; i++) {
for (uint8_t i = 0; i < MAX_EXPOS && chn < MAX_INPUTS; i++) {
if (!EXPO_VALID(line) || (line->chn > chn)) {
if (chn >= MAX_INPUTS) break;
std::string name(getSourceString(chn+1));
menu->addLineBuffered(name.c_str(), [=]() { insertInput(chn, i); });
uint8_t chnEnd = EXPO_VALID(line) ? line->chn : chn + 1;
for (; chn < chnEnd; chn += 1) {
std::string name(getSourceString(chn+1));
menu->addLineBuffered(name.c_str(), [=]() { insertInput(chn, index); });
}
}
if (EXPO_VALID(line))
if (EXPO_VALID(line)) {
chn = line->chn + 1;
else
chn += 1;
index += 1;
}
++line;
}

Expand Down

0 comments on commit 85063f2

Please sign in to comment.