Skip to content

ez_tune: apply the expo setting instead of the rate setting - #11928

Open
Raffi1202 wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
Raffi1202:fix/ez-tune-expo
Open

Raffi1202 wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
Raffi1202:fix/ez-tune-expo

Conversation

@Raffi1202

@Raffi1202 Raffi1202 commented Sep 10, 2026

Copy link
Copy Markdown

Problem

No issue was filed; found while writing the EZ-Tune documentation page (iNavFlight/iNavFlight.github.io#21). With EZ-Tune enabled, the expo slider (ez_expo) in the Configurator does nothing: the stick curve stays the same however it is set, although the Configurator draws a preview curve for it. Moving the rate slider (ez_rate) changes the expo as well, with nothing on screen saying so.

Cause

src/main/flight/ez_tune.c:143-144 on maintenance-10.x: ezTuneUpdate() computes stabilized.rcExpo8 and stabilized.rcYawExpo8 from ezTune()->rate instead of ezTune()->expo. The three lines above set the axis rates from the same field, so the expo lines read as a copy-paste slip. On that branch ezTune()->expo is read in only one other place, src/main/fc/fc_msp.c:1948, which sends it back over MSP2_INAV_EZ_TUNE; the setting never reaches the control profile. The same two lines exist on release/9.1 (src/main/flight/ez_tune.c:143-144) and the diff applies there cleanly.

Change

Two lines: the rcExpo8 and rcYawExpo8 assignments read ezTune()->expo instead of ezTune()->rate. The mapping scaleRange(..., 0, 200, 40, 100) is unchanged and is the one the Configurator uses for its expo preview (tabs/pid_tuning.js:107). ez_rate and ez_expo both default to 100, so the applied expo at defaults stays 70 for roll/pitch and yaw. A profile with ez_rate away from 100 gets a different expo on its next ezTuneUpdate(); that is the corrected behaviour and worth a release-note line.

Test

Not run on hardware or SITL. Cause verified by reading src/main/flight/ez_tune.c:143-144 and src/main/fc/fc_msp.c:1948 on maintenance-10.x. The upstream "Build firmware" run for 78aebbc is waiting for maintainer approval: https://github.com/iNavFlight/inav/actions/runs/34533382666.

Flash / RAM

Not measured yet. The upstream firmware CI has not been released for this PR, so no size report exists.

Docs

No documentation change needed: docs/Settings.md is generated from settings.yaml, which is unchanged, and its ez_expo entry ("EzTune expo") already describes the corrected behaviour. There is no EZ-Tune page under docs/ on maintenance-10.x; the user-facing page is iNavFlight/iNavFlight.github.io#21.

ezTuneUpdate() derived rcExpo8 and rcYawExpo8 from ezTune()->rate:

  stabilized.rcExpo8 = scaleRange(ezTune()->rate, 0, 200, 40, 100);

The two lines directly above it set the rates from the same field, so
this reads as a copy-paste slip. The consequence is that ez_expo has no
effect at all - it is stored, carried over MSP2_INAV_EZ_TUNE in both
directions and offered in the Configurator, but never reaches the
control profile - while moving the rate slider silently changed the
expo curve as well.

The Configurator confirms the intent. tabs/pid_tuning.js draws the
EZ-Tune expo preview with

  scaleRange($('#ez_tune_expo').val(), 0, 200, 40, 100)

which is the same formula against the same range, fed from the expo
slider. The curve shown to the user was therefore the one the firmware
was supposed to apply, not the one it did apply.

Both settings default to 100, so the applied expo at defaults is
unchanged at 70, which is also the rc_expo default. Only a setup that
moved the rate slider away from 100 sees a different expo, and that is
the behaviour being corrected.
@qodo-code-review

Copy link
Copy Markdown
Contributor

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Apply EZ-Tune expo setting to control profile expo

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Applies the EZ-Tune expo slider to roll/pitch and yaw expo values.
• Keeps the rate slider limited to axis rates, eliminating unintended expo changes.
• Preserves the default expo value of 70 when both settings remain 100.
Diagram

graph TD
  R["Rate setting"] -->|rate| U["ezTuneUpdate"] -->|maps| RV["Axis rates"] -->|writes| C["Control profile"]
  E["Expo setting"] -->|expo| U -->|maps| EV["Expo curves"] -->|writes| C
Loading
High-Level Assessment

Using the dedicated expo field is the optimal correction because it restores the existing separation between rate and expo controls while preserving the established scaling and defaults. Changing the mapping formula or Configurator behavior would unnecessarily alter intended semantics.

Files changed (1) +2 / -2

Bug fix (1) +2 / -2
ez_tune.cSource control-profile expo from the EZ-Tune expo setting +2/-2

Source control-profile expo from the EZ-Tune expo setting

• Changes roll/pitch and yaw expo calculations to use 'ezTune()->expo' instead of 'ezTune()->rate'. This makes the expo slider effective and prevents rate adjustments from silently changing stick expo.

src/main/flight/ez_tune.c

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant