1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

Optimize rc modes activation conditions processing

Analyze the rc modes activation conditions and only process configured entries. Previously the entire possible list was processed even though typically only a handful are configured.

Reduces the RX task processing time by about 25% (~44us to ~33us) with an average setup of 3 modes configured (F405, SBUS). Processing time savings will diminish as the user configures more modes. But typically far fewer than the maximum of 20 will be configured.
This commit is contained in:
Bruce Luckcuck 2019-02-04 21:07:56 -05:00
parent 8c78ac507b
commit 42af168854
11 changed files with 65 additions and 14 deletions

View file

@ -942,7 +942,7 @@ static void printAux(uint8_t dumpMask, const modeActivationCondition_t *modeActi
bool equalsDefault = false;
if (defaultModeActivationConditions) {
const modeActivationCondition_t *macDefault = &defaultModeActivationConditions[i];
equalsDefault = !memcmp(mac, macDefault, sizeof(*mac));
equalsDefault = !isModeActivationConditionConfigured(mac, macDefault);
const box_t *box = findBoxByBoxId(macDefault->modeId);
const box_t *linkedTo = findBoxByBoxId(macDefault->linkedTo);
if (box) {
@ -1028,6 +1028,7 @@ static void cliAux(char *cmdline)
} else if (validArgumentCount != 6) {
memset(mac, 0, sizeof(modeActivationCondition_t));
}
analyzeModeActivationConditions();
cliPrintLinef( "aux %u %u %u %u %u %u %u",
i,
mac->modeId,