Skip to content

fix(web): handle imperial altitude conversion in fixed position - #1414

Closed
RuffR1d3r wants to merge 1 commit into
meshtastic:mainfrom
RuffR1d3r:fix/altitude-imperial-conversion
Closed

fix(web): handle imperial altitude conversion in fixed position#1414
RuffR1d3r wants to merge 1 commit into
meshtastic:mainfrom
RuffR1d3r:fix/altitude-imperial-conversion

Conversation

@RuffR1d3r

@RuffR1d3r RuffR1d3r commented Aug 26, 2026

Copy link
Copy Markdown

Fixes #1051

Fixed position altitude now respects Display Units.

  • Canonical storage stays meters (firmware Position.altitude int32)
  • Position.tsx converts meters→feet for display and feet→meters on submit
  • Browser location button also converts
  • New unitConversion.ts helpers, 6 tests covering 1025 ft ↔ 312 m round-trip

Testing:

  • pnpm vitest run 247/247 (6 new)
  • pnpm tsc --noEmit 44/44
  • Manual: 1025 ft entered as imperial → 312 m stored → 1024 ft displayed (1 ft rounding loss documented, firmware int32)

Summary by CodeRabbit

  • New Features

    • Added altitude conversion between meters and feet based on the selected display unit.
    • Position forms now convert altitude values correctly when loading current location data and submitting updates.
    • Altitude inputs now use whole-unit increments for easier entry.
  • Bug Fixes

    • Improved altitude conversion accuracy, including values below sea level and firmware precision limits.

Fixes meshtastic#1051

- Add unitConversion helpers (meters<->feet) with pure functions
- Position form now converts display units (feet) to canonical meters
  on submit and back on display, handling browser location too
- Fixes: 1025 ft now correctly stores as 312m and displays as 1024 ft
  instead of requiring manual meter entry while label says Feet

Signed-off-by: RuffR1d3r <76077201+RuffR1d3r@users.noreply.github.com>
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

@RuffR1d3r is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d7eab25-102f-4fcb-831f-5349e432de64

📥 Commits

Reviewing files that changed from the base of the PR and between cffd35f and 2868a3b.

📒 Files selected for processing (3)
  • apps/web/src/components/PageComponents/Settings/Position.tsx
  • apps/web/src/core/utils/unitConversion.test.ts
  • apps/web/src/core/utils/unitConversion.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Altitude conversion utilities now support imperial display units. Position values convert between meters and feet when displayed or submitted. The altitude input uses whole-unit increments, with tests covering normal, round-trip, zero, and negative values.

Changes

Altitude unit handling

Layer / File(s) Summary
Conversion utilities and validation
apps/web/src/core/utils/unitConversion.ts, apps/web/src/core/utils/unitConversion.test.ts
Adds meter-foot conversion constants and functions. Tests cover standard values, round trips, zero, and negative altitudes.
Position altitude display and submission
apps/web/src/components/PageComponents/Settings/Position.tsx
Converts browser and initial position altitudes for imperial displays. Converts fixed-position feet input back to meters before protobuf assignment. Changes the altitude step to whole units.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 2868a

The PR converts fixed-position altitude between display units and canonical meters on read, submit, and browser-location updates; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

A rabbit hops where altitudes rise,

Meters turn to feet beneath the skies.
Fixed heights return in meters true,
Whole steps guide the form anew.
Tests check valleys, peaks, and zero too.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the web fix for imperial altitude conversion in fixed-position settings.
Description check ✅ Passed The description explains the problem, links issue #1051, lists the main changes, and reports automated and manual testing. It omits the template checklist and screenshots, but those omissions are non-…
Linked Issues check ✅ Passed The changes satisfy issue #1051 by converting displayed imperial altitude values to meters before storage, converting stored meters for display, and converting browser geolocation values. Tests cover …
Out of Scope Changes check ✅ Passed The modified component, conversion utilities, and focused tests directly support the fixed-position altitude conversion objective. No unrelated changes are identified.
Full details: Description check

Explanation

The description explains the problem, links issue #1051, lists the main changes, and reports automated and manual testing. It omits the template checklist and screenshots, but those omissions are non-critical.

Full details: Linked Issues check

Explanation

The changes satisfy issue #1051 by converting displayed imperial altitude values to meters before storage, converting stored meters for display, and converting browser geolocation values. Tests cover the reported 1025 ft to 312 m case.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RuffR1d3r RuffR1d3r closed this Aug 27, 2026
@RuffR1d3r

Copy link
Copy Markdown
Author

Duplicate of #1412 (danditomaso's batch) which already fixes #1051 altitude conversion. Closing to avoid review noise.

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.

[Bug]: Fixed altitude entry (no GPS) prompts for feet but treats value as meters.

1 participant