fix(radio): Better iteration through mixers on display, sanitize invalid sources (#3999)
* fix: mixer lines with empty source Fixes #3367 * Fix color mixes display. --------- Co-authored-by: Phil Mitchell <phil.a.mitchell@gmail.com>
This commit is contained in:
co-authored by
Phil Mitchell
parent
c502dbeaee
commit
47ff7284fd
@@ -22,6 +22,7 @@
|
||||
#include "opentx.h"
|
||||
#include "timers_driver.h"
|
||||
#include "tasks/mixer_task.h"
|
||||
#include "mixes.h"
|
||||
|
||||
#if defined(USBJ_EX)
|
||||
#include "usb_joystick.h"
|
||||
@@ -106,7 +107,7 @@ void postRadioSettingsLoad()
|
||||
#endif
|
||||
}
|
||||
|
||||
static void sortMixerLines()
|
||||
static bool sortMixerLines()
|
||||
{
|
||||
// simple bubble sort
|
||||
unsigned passes = 0;
|
||||
@@ -132,9 +133,16 @@ static void sortMixerLines()
|
||||
++passes;
|
||||
} while(swaps > 0);
|
||||
|
||||
if (passes > 1) {
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
// anything above 1 means that
|
||||
// we changed something
|
||||
return passes > 1;
|
||||
}
|
||||
|
||||
static void sanitizeMixerLines()
|
||||
{
|
||||
bool dirty = sortMixerLines();
|
||||
updateMixCount();
|
||||
if (dirty) storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void postModelLoad(bool alarms)
|
||||
@@ -226,7 +234,7 @@ if(g_model.rssiSource) {
|
||||
}
|
||||
|
||||
loadCurves();
|
||||
sortMixerLines();
|
||||
sanitizeMixerLines();
|
||||
|
||||
#if defined(GUI)
|
||||
if (alarms) {
|
||||
|
||||
Reference in New Issue
Block a user