Skip to content

feat: editable radio settings on Manage → Radio (+ !adm radio) - #33

Merged
sg merged 1 commit into
mainfrom
feat/radio-settings-editable
Jul 4, 2026
Merged

feat: editable radio settings on Manage → Radio (+ !adm radio)#33
sg merged 1 commit into
mainfrom
feat/radio-settings-editable

Conversation

@sg

@sg sg commented Jul 4, 2026

Copy link
Copy Markdown
Owner

What changed

The Manage → Radio tab is now editable, reorganized top→bottom into Identity, Radio settings, Advert (moved down), Contact table (moved down), and a read-only Device info dump.

Identity — edit the node Name; a New private key field (paste 128-hex) to rotate identity. Section Save/Cancel enable only on change, with a Reboot after checkbox.

Radio settings — a Preset dropdown (US/Canada, EU 868, EU/Asia 433, ANZ) that fills freq/bw/sf/cr; individually editable Frequency / Bandwidth / SF / CR / TX power, Latitude/Longitude, and an "Include location in adverts" toggle. Same change-gated Save/Cancel + Reboot after.

Change-detection snapshots the radio's reported values into a form + pristine copy; after a save the device info is re-queried and the forms re-snapshot.

Backend

  • mcbot.py: refresh_self_info() (re-query SELF_INFO after a change) and adopt_new_private_key() (rewrite cached key file + refresh in-memory identity so a restart doesn't reload the stale key).
  • management.py: radio_set_name, radio_apply_settings (freq/bw/sf/cr atomic; tx/coords/loc-policy; optional reboot), radio_apply_identity / _radio_import_key, radio_reboot — all audited (radio.name/settings/identity/reboot) and surfacing the radio's ERROR. Region presets live in RADIO_PRESETS.
  • webapi/routers/dbadmin.py: GET /api/radio/presets, POST /api/radio/identity, POST /api/radio/settings, POST /api/radio/reboot (all require_auth).
  • commands/adm.py: !adm radio name|set|preset|location|advloc|reboot|key (DM-only, owner-gated).

Safety / notes

  • Private-key import is destructive: the node gets a new pubkey → contacts must re-add the bot, old DMs stop decrypting. Web import requires a typed confirm; the bot adopts the new identity and rewrites its key file; reboot recommended.
  • Radio params can isolate the node and usually need a reboot to take effect (hence the per-section Reboot checkbox); reboot briefly drops the bot's link (auto_reconnect restores it).
  • Preset values: US/CA + EU868 are MeshCore's documented defaults; 433/ANZ are best-known community values — please verify. Current values used: US/CA 910.525/62.5/7/5, EU868 869.618/62.5/8/5, EU/Asia433 433.5/62.5/8/5, ANZ 915.8/62.5/7/5. Presets only fill the fields; you review before Save.

Tests

tests/test_radio_config.py (stubbed radio): name (+length guard), apply-settings all/partial/out-of-range/reboot, identity import (adopts pubkey, bad-key guards), radio-ERROR→MgmtError. Full suite (12 files) green; web-ui build clean.

Breaking changes

None — additive; existing Advert/Contact-table functionality unchanged, just relocated.

@sg
sg merged commit 64ab232 into main Jul 4, 2026
1 check passed
@sg
sg deleted the feat/radio-settings-editable branch July 4, 2026 17:53
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