mixer: fix preview image not showing reversed on page load#2582
Open
sensei-hacker wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
Open
mixer: fix preview image not showing reversed on page load#2582sensei-hacker wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
sensei-hacker wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
Conversation
On initial tab load, $mixerPreset.trigger('change') calls
updateMotorDirection() synchronously before Settings.configureInputs()
has populated the motor_direction_inverted radio buttons via async MSP
requests. This meant the default (props-in) image was always shown even
when the FC had reversed motor direction configured.
Fix: accept the settingsPromise passed by Settings.processHtml and
re-run updateMotorDirection() once it resolves, so the correct image
is shown after the settings values arrive. The change event handlers
are unaffected.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Review Summary by QodoFix mixer preview image not showing reversed on load
WalkthroughsDescription• Fix preview image not showing reversed on initial page load • Accept settingsPromise parameter and re-run updateMotorDirection after async MSP requests complete • Ensures motor_direction_inverted setting is applied before image is rendered • Matches existing async timing pattern used in receiver.js and configuration.js Diagramflowchart LR
A["Page Load"] --> B["processHtml called"]
B --> C["trigger preset change"]
C --> D["updateMotorDirection runs early"]
D --> E["Wrong image shown"]
B --> F["configureInputs async MSP requests"]
F --> G["settingsPromise resolves"]
G --> H["updateMotorDirection runs again"]
H --> I["Correct image shown"]
File Changes1. tabs/mixer.js
|
Contributor
Code Review by Qodo
1. Async callback after tab cleanup
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the Mixer tab, when the FC has
motor_direction_invertedset to ON, the props-out (reversed) preview image was not shown on initial page load — only the props-in image appeared. Toggling the radio button manually would correctly swap it, but the on-load state was incorrect.Root cause
Settings.processHtmlcallsconfigureInputs()to populatedata-settinginputs via async MSP requests, then immediately calls the tab callback without waiting for those requests to complete. InsideprocessHtml,$mixerPreset.trigger('change')fires the preset change handler synchronously, which callsupdateMotorDirection(). At that point themotor_direction_invertedradio buttons have not been set yet (still at their HTML default), so the wrong image is loaded.Changes
tabs/mixer.js: Accept thesettingsPromiseparameter thatSettings.processHtmlalready passes to every tab callback, and callupdateMotorDirection()again once it resolves so the correct image is shown after the MSP setting values arrive.This matches the existing pattern used in
receiver.jsandconfiguration.jsfor the same class of async timing issue.Testing
configureInputs()is async, callback fires before radio buttons are populated.then()fires after radio buttons are setmotor_direction_inverted = ONon physical FC (RP2350_PICO, INAV 9.0.0) to reproduce; fix confirmed correct by code review