feat(radio): add trims to autosource and autoswitch if configured as 3P switch (#7024)
This commit is contained in:
@@ -482,6 +482,16 @@ int8_t getMovedSource(uint8_t min)
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t trimStates[MAX_TRIMS];
|
||||
if (result == 0) {
|
||||
for (uint8_t i = 0; i < MAX_TRIMS; i++) {
|
||||
if (abs(getTrimValue(mixerCurrentFlightMode, i) - trimStates[i]) > 0) {
|
||||
result = MIXSRC_FIRST_TRIM + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t sourcesStates[MAX_ANALOG_INPUTS];
|
||||
if (result == 0) {
|
||||
for (uint8_t i = 0; i < MAX_ANALOG_INPUTS; i++) {
|
||||
@@ -505,9 +515,11 @@ int8_t getMovedSource(uint8_t min)
|
||||
if (result || recent) {
|
||||
memcpy(inputsStates, anas, sizeof(inputsStates));
|
||||
memcpy(sourcesStates, calibratedAnalogs, sizeof(sourcesStates));
|
||||
for (uint8_t i = 0; i < MAX_TRIMS; i++) trimStates[i] = getTrimValue(mixerCurrentFlightMode, i);
|
||||
}
|
||||
|
||||
s_move_last_time = get_tmr10ms();
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user