Skip to content

feat(settings): implement set_ham_mode HamParameters admin message#5780

Draft
jamesarich wants to merge 3 commits into
release/2.8.0from
feat/hamparameters
Draft

feat(settings): implement set_ham_mode HamParameters admin message#5780
jamesarich wants to merge 3 commits into
release/2.8.0from
feat/hamparameters

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Closes #5759

What

Implements the set_ham_mode AdminMessage for licensed amateur radio (ham) onboarding, with iOS feature parity (Meshtastic-Apple UserConfig.swift):

  • UI (UserConfigItemList.kt): when the "Licensed amateur radio (Ham)" toggle is ON for the locally connected node, the Long Name field is repurposed as Call sign (max 8 chars, supporting text explains the constraint); toggling ON clears an over-long name so the user enters a callsign. Remote nodes are unaffected.
  • Routing (RadioConfigViewModel.saveUserConfig): the licensed toggle's OFF→ON transition sends AdminMessage(set_ham_mode = HamParameters(call_sign, short_name)); all other saves (including subsequent edits while licensed) use the existing set_owner path so other owner fields still propagate and the node doesn't reboot on every save.
  • Send path (AdminControllerAdminControllerImpl): new setHamMode vertical mirroring setOwner. The impl echoes the node's current LoRa tx_power/override_frequency into the message — firmware's handleSetHamMode applies those fields verbatim, so sending zeros would wipe a ham's custom overrides. It also enforces the local-node-only contract (ignores remote destinations) and optimistically updates the node DB pending the device's authoritative NodeInfo.

long_name in HamParameters is deliberately omitted: it doesn't exist at the pinned protobufs 2.7.25 (meshtastic/protobufs#941 is still open). The extension point is marked with a comment; Renovate will auto-bump the pin when a release containing #941 ships.

Why

Ham mode enablement for the 2.8 release — feature parity with iOS, which already implements this. The firmware consumes set_ham_mode for ham onboarding (sets owner from callsign, disables encryption, applies LoRa overrides, reboots).

Test Plan

  • New unit tests: 5 ViewModel routing tests (mutual exclusivity, remote-node guard, null-myNodeInfo guard, transition-vs-state routing), 3 controller tests (payload incl. echoed LoRa values + optimistic node update, proto-default fallback, remote-destination guard), 1 use-case delegation test.
  • spotlessCheck detekt assembleDebug test allTests kmpSmokeCompile all green locally (one pre-existing network-flaky test in core:data noted, unrelated).
  • Manual verification on device recommended: toggle relabel/8-char limit, save disabled on blank callsign, clear-on-toggle with Discard as undo.

Note for reviewers: the response dialog can time out after a successful set_ham_mode because the firmware reboots the node before acking — same behavior as iOS.

🤖 Generated with Claude Code

@github-actions github-actions Bot added build Build system changes enhancement New feature or request repo Repository maintenance labels Jun 12, 2026
@jamesarich jamesarich changed the base branch from main to release/2.8.0 June 12, 2026 14:47
@jamesarich jamesarich requested a review from vidplace7 June 13, 2026 00:19
@jamesarich jamesarich force-pushed the feat/hamparameters branch from b24bc89 to 6d4ea50 Compare June 13, 2026 11:55
jamesarich added a commit that referenced this pull request Jun 13, 2026
configureCommon() applied setMultipleConnectionPool(maxNumOfReaders = 4)
to every database, including the in-memory ones used by tests. A read on
a pooled reader connection can observe a snapshot older than the latest
write on the writer connection, so a read immediately after a write may
return stale rows.

DeviceLinkRepositoryImplTest.reconcilePrunesShortCodesNoLongerInCatalog
read [a, b] (the pre-prune state) instead of [a] after a deleteNotIn —
passing locally but flaking on CI depending on connection-assignment
timing (failed shard-core on #5738; the identical code passed on #5780).

In-memory builders now pass multiConnection = false so reads serialize
behind writes on one connection. Production/file databases keep the
multi-reader pool.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jamesarich and others added 3 commits June 13, 2026 07:35
When the licensed amateur radio toggle is on for the locally connected
node, the User config screen repurposes the long-name field as the
callsign (max 8 chars, iOS parity) and saving sends
AdminMessage(set_ham_mode) instead of set_owner. Current LoRa
tx_power/override_frequency are echoed into the HamParameters so a
re-send while already licensed never wipes the node's overrides
(firmware applies them verbatim). The node entry is optimistically
updated pending the device's authoritative NodeInfo.

Closes #5759

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Align AdminController.setHamMode KDoc with the implementation: the
  impl echoes the local LoRa values itself; caller-supplied
  tx_power/frequency are ignored (F-2, F-15)
- Fall back to the default LoRaConfig message instead of hand-coded
  proto defaults (F-9)
- Cover the lora-absent/unknown-node fallback branches and the
  null-myNodeInfo routing guard with tests (F-10, F-11)
- Hoist the clear-on-toggle condition into a named boolean (F-13)
- Deduplicate MyNodeInfo test fixtures into one helper (F-8)
- Concrete wording for the protobufs#941 extension note (F-16)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… guard, callsign guidance

- Route to set_ham_mode only when the licensed toggle transitions
  OFF→ON; subsequent saves of an already-licensed node use set_owner so
  other owner edits still propagate and the node doesn't reboot on
  every save (F-1)
- Enforce the local-node-only contract in AdminControllerImpl, not just
  the ViewModel: setHamMode ignores remote destinations (F-3)
- Show 'Your amateur radio call sign, up to 8 characters' as the
  field's supporting text in ham mode, giving sighted and screen-reader
  users the constraint (F-4, F-6)
- Document that saveUserConfig is the preferred entry point over
  setOwner (F-7)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jamesarich jamesarich force-pushed the feat/hamparameters branch from 6d4ea50 to 5a189a2 Compare June 13, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build system changes enhancement New feature or request repo Repository maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Implement set_ham_mode HamParameters Admin message

1 participant