Skip to content

feat(radio): optional key lock feature (2.12 backport) - #7561

Draft
pfeerick wants to merge 7 commits into
2.12from
pfeerick/keys-lock-2.12
Draft

feat(radio): optional key lock feature (2.12 backport)#7561
pfeerick wants to merge 7 commits into
2.12from
pfeerick/keys-lock-2.12

Conversation

@pfeerick

Copy link
Copy Markdown
Member

Summary

  • Backport of feat(radio): optional key lock feature #7383 ("feat(radio): optional key lock feature") to the 2.12 release branch, up to and including 961df15.
  • Adds an optional key-lock toggle (hold a per-target key combo to lock/unlock the keypad), configurable per-radio, with translations and a new keys_lock.cpp test.
  • Cherry-picked from main and adapted to 2.12's tree: reused existing bitfield padding for the new keyLockEnabled flag (no struct size change), regenerated yaml_datastructs_*.cpp via tools/generate-yaml.sh, and re-wired the colorlcd key-shortcuts menu to 2.12's pre-refactor Choice/quick_menu widgets instead of main's newer QMPageChoice/qmpagechoice.h (which don't exist on 2.12).
  • Restored the missing keyIsSupported() inline helper in radio/src/hal/key_driver.h (present on main, absent on 2.12) since the feature depends on it.

Test plan

  • Firmware builds clean for a B&W target (X9D/taranis)
  • Firmware builds clean for a color target (X10/horus)
  • Companion + simulator build clean (X7/T20V2)
  • Manual test of key-lock toggle on hardware/simulator

Once merged into 2.12, the original 3djc/keys-lock branch (PR #7383) will be rebased onto main for the remaining refactor commits.

🤖 Generated with Claude Code

@pfeerick pfeerick added this to the 2.12.3 milestone Jul 15, 2026
@pfeerick pfeerick added the enhancement ✨ New feature or request label Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 44493d3c-1f29-4798-8db3-b0c6d01fb90b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pfeerick/keys-lock-2.12

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.

@pfeerick pfeerick added the rn: feature Feature to be highlighted in release notes label Jul 16, 2026
@pfeerick
pfeerick force-pushed the pfeerick/keys-lock-2.12 branch 2 times, most recently from 0c749c5 to 089b430 Compare July 23, 2026 06:52
3djc and others added 7 commits August 6, 2026 01:47
Ports the equivalent combo assignments from PR 7383 (main branch) so
these targets get the key-lock feature: c14/v14/v14lcd use SYS+MODEL,
t22 uses PAGEDN+ENTER, st16 uses EXIT+ENTER. V12 is left without a
combo since it lacks a KEY_MENU to safely fall back to.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ncation, and struct dedup

- yaml_datastructs_c14.cpp and yaml_datastructs_v12.cpp were missing
  the keyLockEnabled mapping entirely, so the setting silently failed
  to persist across save/load on those radios.
- The B&W 128x64/212x64 key-lock menu label buffer (lbl[24]) was too
  small for STR_KEY_LOCK_FMT's worst-case output (up to 28 bytes for
  combos like PAGE<+PAGE>), causing truncation. Bumped to lbl[45],
  matching the ColorLCD equivalent.
- Hoisted keyLockEnabled out of the per-flavor #if defined(COLORLCD)/
  #elif LCD_W==128/#else block in datastructs_private.h into the
  shared prefix (alongside modelQuickSelect/oneLogPerDay), removing
  the 3x duplication that let the c14/v12 YAML omissions happen in
  the first place. Verified sizeof(RadioData) is unchanged for all
  three flavors (COLORLCD/LCD_W==128/else) via chksize.h's
  static_assert, and regenerated every target's yaml_datastructs via
  tools/generate-yaml.sh (only field order/padding shifted, no
  fields added or removed elsewhere).

Mirrors the fixes applied to the same feature on main in
#7569.
The port of #7383 placed the new key lock label/checkbox at row 30 in
gridLayout_2, which was already occupied by the PPM units label/combobox.
Move key lock to row 31 and shift the trailing vertical spacer to row 32.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PR #7383 disabled the General Setup key-lock checkbox on boards whose
hw_defs JSON has no key_lock_combo, via BoardJson::hasKeyLockCombo().
2.12 predates the JSON hw_defs system, so this backport never gained
that gating and always showed the checkbox enabled, even on boards
where the firmware compiles out the feature entirely for lack of a
KEYS_LOCK_KEY1/KEY2 combo: V12, XLite/XLites, PA01, and the whole PL18
family (NV14, EL18, PL18, PL18EV, PL18U, NB4P).

Add Board::HasKeyLockCombo, backed by the existing IS_* board-family
helpers instead of JSON, and gate the checkbox/label the same way
generalsetup.cpp already gates other per-board UI elements.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pfeerick
pfeerick force-pushed the pfeerick/keys-lock-2.12 branch from 4f06741 to 36e01af Compare August 6, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request rn: feature Feature to be highlighted in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant