Commit e2c7e67
committed
fix: force currentMixerMode to MIXER_QUADX under USE_QUAD_MIXER_ONLY
CodeRabbit review on PR#1417 (github.com//pull/1417#issuecomment-5453591327):
mixerInit() set currentMixerMode from the persisted mixerConfig()
value unconditionally. config.c's validateAndFixConfig() -- which
would normally reset a stale mixer mode -- is itself skipped under
USE_QUAD_MIXER_ONLY. A device reflashed to a quad-only build with a
persisted non-quad mode (e.g. MIXER_TRI) would carry that value
into servoConfigureOutput()'s servoMixers[currentMixerMode] lookup
whenever a servo feature is active, loading the wrong servo rules
for the airframe actually being flown (motors hardcoded to QuadX,
servos configured per the stale mode). Reachable on a normal boot,
no exotic timing required.
Fix: mixerInit() forces currentMixerMode = MIXER_QUADX under the
flag, ignoring the persisted value -- single source of truth for
every downstream consumer (servos.c, mixerIsTricopter(), etc.).
Also (CodeRabbit P3, same review): the `smix` CLI help text still
advertised `load <mixer>` under USE_QUAD_MIXER_ONLY, where
cliServoMix() always rejects it with "Invalid name". Split into two
full CLI_COMMAND_DEF entries (embedding a preprocessor directive
inside a single macro call's argument list is non-portable and
produced its own new warning -- confirmed via build, reverted that
approach).
48/48 unit tests pass. Both configurations (with/without the flag)
build clean, zero warnings. Normal-build .elf size unchanged
(byte-identical to pre-fix).1 parent 5870cc7 commit e2c7e67
2 files changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
431 | 435 | | |
| 436 | + | |
432 | 437 | | |
433 | 438 | | |
434 | 439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4602 | 4602 | | |
4603 | 4603 | | |
4604 | 4604 | | |
| 4605 | + | |
4605 | 4606 | | |
4606 | 4607 | | |
4607 | 4608 | | |
4608 | 4609 | | |
| 4610 | + | |
| 4611 | + | |
| 4612 | + | |
| 4613 | + | |
| 4614 | + | |
4609 | 4615 | | |
4610 | 4616 | | |
4611 | 4617 | | |
| |||
0 commit comments