Skip to content

osd: fix sidebar scale scroll direction - #11926

Open
Raffi1202 wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
Raffi1202:fix/osd-scroll-direction
Open

Raffi1202 wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
Raffi1202:fix/osd-scroll-direction

Conversation

@Raffi1202

@Raffi1202 Raffi1202 commented Sep 10, 2026

Copy link
Copy Markdown

Problem

Fixes #9195: with osd_left_sidebar_scroll / osd_right_sidebar_scroll set to altitude or speed, the scrolling scale beside the artificial horizon on the character OSD moves the wrong way. @malinhiles' DVR clip shows airspeed falling and altitude rising while the tick marks travel opposite to the Garmin tape the sidebars emulate, where a rising value brings the higher numbers down towards the centre marker. @b14ckyy confirmed it and noted the pixel OSD scrolls correctly.

Cause

osdUpdateSidebar(), src/main/io/osd_grid.c:303 on maintenance-10.x: decoration -= steps % SYM_AH_DECORATION_COUNT;. The glyphs SYM_AH_DECORATION_MIN..MAX (0x12E..0x133) draw their tick marks 3 px lower for each higher code in every analogue font, so subtracting walks the ticks upwards as the value rises. The pixel OSD draws its sidebars via osdCanvasDrawSidebars() (osd_common.c:364) and never reaches this line. release/9.1 has the same line at osd_grid.c:303.

Change

Adds the step count instead of subtracting it and documents the glyph order in a comment above the line. A rising value now scrolls the scale downwards, bringing the higher numbers towards the centre marker. The existing wrap-around keeps the code inside the font range for either sign; the trend arrows and the pixel OSD path are untouched.

Test

Not run on hardware or SITL. Cause verified by reading osd_grid.c:303 and by decoding glyphs 302-307 of all eight Configurator analogue fonts (resources/osd/analogue/*.mcm): each higher code shifts the ticks 3 px down, and six codes span the 18 px cell, which the wrap-around relies on. The upstream Build firmware run for this PR (https://github.com/iNavFlight/inav/actions/runs/34532676799) is waiting for maintainer approval and has not built. The commit cherry-picks onto release/9.1 without conflicts (git merge-tree).

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: neither docs/OSD.md (OSD_HORIZON_SIDEBARS) nor docs/Settings.md (osd_*_sidebar_scroll) describes the scroll direction, and no setting or default changes.

The scrolling altitude and speed sidebars moved the wrong way. A rising
value scrolled the scale upwards, so the numbers travelling towards the
center marker got smaller as the value grew. No reference instrument
behaves like that.

The scale glyphs SYM_AH_DECORATION_MIN..SYM_AH_DECORATION_MAX draw their
tick marks progressively lower inside the character cell, so the step
count is now added to the symbol instead of subtracted. A rising value
now scrolls the scale downwards and brings the higher numbers down
towards the center marker, the way a primary flight display works.

The existing wrap around keeps the symbol inside the font range for
either sign, so only the direction changes. The trend arrows are left
alone, they report whether the value is rising or falling and not which
way the scale moves. Only the grid OSD path is affected, the pixel OSD
draws its sidebars through the sidebar widget instead.

Fixes iNavFlight#9195
@Raffi1202
Raffi1202 marked this pull request as ready for review September 11, 2026 15:36
@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

Fix grid OSD sidebar scroll direction

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Reverse grid OSD glyph progression so rising values scroll scale markings downward.
• Preserve existing glyph wrapping and trend-arrow behavior.
Diagram

graph TD
    A["Sidebar config"] --> C["Source selection"] --> D["Step calculation"] --> E["Glyph progression"] --> G["Range wrapping"] --> F["Grid display"]
    B["Flight values"] --> C
Loading
High-Level Assessment

The localized arithmetic change is the appropriate approach because it directly aligns glyph-code progression with the font’s tick ordering. Changing font assets, negating input values, or modifying trend arrows would broaden scope and conflate independent behavior.

Files changed (1) +5 / -1

Bug fix (1) +5 / -1
osd_grid.cReverse grid sidebar decoration progression +5/-1

Reverse grid sidebar decoration progression

• Changes sidebar glyph advancement from subtraction to addition so increasing altitude, speed, or distance scrolls scale markings downward toward the center marker. Adds comments documenting the glyph ordering and expected primary-flight-display behavior while retaining existing wrapping and arrow logic.

src/main/io/osd_grid.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