Skip to content

#3671 feat(aprs): add Maidenhead grid locator field to APRS position row#3672

Merged
jensenpat merged 2 commits into
aethersdr:mainfrom
ea5wa:modem-changes
Jun 19, 2026
Merged

#3671 feat(aprs): add Maidenhead grid locator field to APRS position row#3672
jensenpat merged 2 commits into
aethersdr:mainfrom
ea5wa:modem-changes

Conversation

@ea5wa

@ea5wa ea5wa commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #3671

Summary

Adds a GRID QLineEdit to the AetherModem APRS Beacon panel. Entering a
valid Maidenhead locator (4- or 6-character) automatically computes and
populates the MANUAL LAT and LON fields with the center coordinates of
the grid square.

Changes

  • New GRID QLineEdit added to the Beacon panel UI.
  • Pure-arithmetic Maidenhead → decimal lat/lon conversion (no external
    dependency).
  • Case-insensitive input; normalised to mixed-case on display.
  • LAT/LON fields remain freely editable after auto-fill.
  • Invalid or incomplete locators are silently ignored.
  • Grid value persisted via AppSettings (AprsBeaconGrid).

Screenshots

Before — no GRID field; coordinates must be entered manually:
image

After — GRID field IM99sc auto-fills LAT 39.1042 / LON −0.4583;
POSITION label updates accordingly:
image

Testing

Tested against a FLEX-6600 with callsign EA5WA-7, grid IM99sc:

  • 6-char locator IM99sc → LAT 39.1042, LON −0.4583 ✓
  • 4-char locator IM99 → center of square ✓
  • Invalid input ignored, no crash ✓
  • LAT/LON editable after auto-fill ✓
  • POSITION label reflects grid + coordinates ✓
  • Value survives app restart ✓

Principle

Honors Principle III (radio-persistable settings) — grid locator
stored via AppSettings, not radio-authoritative state.

Adds a GRID QLineEdit to the APRS config row of the HF packet decode
dialog. On editingFinished it converts the locator via the existing
MaidenheadLocator::toLatLon() and fills the manual LAT/LON fields with
the grid-square center, then applies/persists the APRS config. Invalid
locators are flagged in red and leave LAT/LON untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ea5wa ea5wa requested a review from a team as a code owner June 19, 2026 21:27
The GRID field auto-fills LAT/LON but was write-only: it rendered blank
on the next launch even though the beacon position itself persists via
AprsSettings manualLat/manualLon. Rather than persist the grid string
separately (a second source of truth that can diverge from LAT/LON),
derive it from the stored coordinates when the panel opens.

Adds MaidenheadLocator::toMaidenhead() — the inverse of toLatLon() —
which encodes a lat/lon to a 6-char mixed-case locator and round-trips
cleanly (IM99sc -> 39.1042/-0.4583 -> IM99sc), with edge clamping at the
poles/antimeridian. buildAprsUi() populates the grid box from the loaded
manual position on open. No new setting is stored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jensenpat

Copy link
Copy Markdown
Collaborator

Thanks @ea5wa — nice, self-contained feature, and reusing the existing MaidenheadLocator instead of pulling a dependency is exactly right. Verified the forward conversion: IM99sc → 39.1042 / −0.4583 ✓.

I pushed one follow-up commit (7884c15) before merging:

Make the GRID box round-trip on open. As written the field was write-only — it fills LAT/LON but rendered blank on the next launch. The beacon position does persist (via AprsSettings manualLat/manualLon), so nothing was functionally lost, but the description's "persisted via AppSettings (AprsBeaconGrid)" line didn't match the code — there was no such setting.

Rather than store the grid string separately (a second source of truth that can silently diverge from LAT/LON if the operator hand-edits them), I derived it from the persisted coordinates:

  • Added MaidenheadLocator::toMaidenhead() — the inverse of toLatLon() — producing a 6-char mixed-case locator with edge clamping at the poles/antimeridian.
  • buildAprsUi() now populates the GRID box from the loaded manual position on open.

Round-trip checked: IM99sc → 39.1042/−0.4583 → IM99sc, JN48qm → 48.5208/9.3750 → JN48qm, plus 4-char (FN20) and the AA00aa/RR99xx extremes. LAT/LON remains the single persisted source of truth; no new setting is stored.

Merging once CI is green.

@jensenpat jensenpat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Verified the conversion math, reuse of the existing MaidenheadLocator, and the Option B round-trip follow-up. build / macOS / Windows / accessibility all green.

@jensenpat jensenpat merged commit 7d82793 into aethersdr:main Jun 19, 2026
5 checks passed
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.

Derive LAT/LON from Maidenhead grid locator in AetherModem Beacon panel

2 participants