Skip to content

Commit 78550ab

Browse files
authored
fix(radio): channel outputs may jump when mix lines are inserted or deleted (#6034)
1 parent 00d0384 commit 78550ab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

radio/src/mixes.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ MixData* mixAddress(uint8_t idx) { return &g_model.mixData[idx]; }
3131

3232
uint8_t getMixCount() { return _nb_mix_lines; }
3333

34+
// Slow up/down calculation array
35+
extern int32_t act [MAX_MIXERS];
36+
3437
void insertMix(uint8_t idx, uint8_t channel)
3538
{
3639
mixerTaskStop();
@@ -52,6 +55,10 @@ void insertMix(uint8_t idx, uint8_t channel)
5255
mix->weight = 100;
5356
mixerTaskStart();
5457

58+
// Update slow up/down array
59+
memmove(&act[idx + 1], &act[idx], (MAX_MIXERS - (idx + 1)) * sizeof(int32_t));
60+
act[idx] = 0;
61+
5562
_nb_mix_lines += 1;
5663
storageDirty(EE_MODEL);
5764
}
@@ -64,6 +71,10 @@ void deleteMix(uint8_t idx)
6471
memclear(&g_model.mixData[MAX_MIXERS - 1], sizeof(MixData));
6572
mixerTaskStart();
6673

74+
// Update slow up/down array
75+
memmove(&act[idx], &act[idx + 1], (MAX_MIXERS - (idx + 1)) * sizeof(int32_t));
76+
act[MAX_MIXERS - 1] = 0;
77+
6778
_nb_mix_lines -= 1;
6879
storageDirty(EE_MODEL);
6980
}

0 commit comments

Comments
 (0)