Skip to content

feat(firmware): add a special function to trigger key lock.#7565

Open
philmoz wants to merge 2 commits into
mainfrom
philmoz/key-lock-sf
Open

feat(firmware): add a special function to trigger key lock.#7565
philmoz wants to merge 2 commits into
mainfrom
philmoz/key-lock-sf

Conversation

@philmoz

@philmoz philmoz commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Use case : I want to automatically lock the radio keys when I arm the model to prevent accidental key presses

The key lock feature is a fantastic enhancement (thanks @3djc); but still requires the user to manually activate the key combo.

This PR adds a new special/global function to control the key lock feature.
The 'No Keys' special function works like this:

  • when the function goes active the keys will be locked (if not already locked)
  • when the function goes inactive the keys will be unlocked (it not already unlocked)
  • when the function state does not change nothing happen (even if the key combo is used)

The key combo is always active so it is not possible to lock oneself out of the radio.
If the keys are unlocked after being locked by the special function, the special function will not re-lock them until its state changes.

This PR also make the popup messages more meaningful and fit better on B&W screens.
screenshot_gx12_26-07-17_09-40-34
screenshot_tx15_26-07-17_09-39-50

Summary by CodeRabbit

  • New Features
    • Added Disable Keys special function (optionally available when key-lock hardware/support is enabled) to lock and disable radio keys.
    • Added unlock-key hint text to the locked-keys status display.
    • Key-lock toggle combination is supported via the existing key-lock configuration.
  • Improvements
    • UI-side custom functions are now evaluated during the regular 10ms cycle.
    • YAML and Lua now recognize/serialize the DISABLE_KEYS function identifier.
  • Translations
    • Added No Keys label and updated “keys locked” messages across languages to include an unlock hint.

@philmoz philmoz added this to the 3.0 milestone Jul 16, 2026
@philmoz philmoz added enhancement ✨ New feature or request UX-UI Related to user experience (UX) or user interface (UI) behaviour labels Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch philmoz/key-lock-sf

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.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the conditional FUNC_DISABLE_KEYS custom function across Companion, firmware enums, YAML serialization, generated sorting, translations, key-lock runtime handling, popup display, Lua exposure, and Color LCD special-function editing.

Changes

Disable Keys function integration

Layer / File(s) Summary
Function contracts, generated tables, serialization, and translations
companion/src/firmwares/*, radio/src/dataconstants.h, radio/src/cfn_sort.cpp, radio/src/storage/yaml/*, radio/src/translations/*, tools/cfn_sorter.*
Adds the Disable Keys identifiers, guarded ordering entries, YAML DISABLE_KEYS mappings, translation strings, and related build dependencies.
Runtime key locking and popup handling
radio/src/keys.*, radio/src/functions.cpp, radio/src/edgetx.cpp, radio/src/main.cpp, radio/src/gui/common/stdlcd/*, radio/src/gui/gui_common.cpp, radio/src/lua/api_general.cpp
Evaluates the function on UI ticks, synchronizes key-lock state, gates availability and Lua exposure, and passes unlock information through wait popups.
Color LCD function editing
radio/src/gui/colorlcd/model/special_functions.*
Relocates FunctionEditPage implementations into the source file with inline lifecycle, widget, header, body, and parameter-building methods.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CustomFunction
  participant evalUIFunctions
  participant KeyLock
  participant Popup
  CustomFunction->>evalUIFunctions: Activate FUNC_DISABLE_KEYS
  evalUIFunctions->>KeyLock: setKeyLockedState(active)
  KeyLock-->>Popup: Emit toggle event
  Popup->>Popup: POPUP_WAIT(message, unlockInfo)
Loading

Possibly related PRs

Suggested reviewers: 3djc, raphaelcoeffic

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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 succinctly captures the main change: adding a special function to control key lock.
Description check ✅ Passed The description covers the use case, behavior, and UI updates, though it does not follow the template exactly.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch philmoz/key-lock-sf

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@radio/src/functions.cpp`:
- Around line 198-209: Update the aggregate active-function processing around
CFN_FUNC(cfn) and setKeyLockedState: compute the previous and new aggregate
states once across global and model functions, then synchronize the lock from
that transition even when a No Keys row is disabled, cleared, or replaced.
Remove per-row comparisons that depend on iteration order, while preserving
newActiveFunctions updates for FUNCTION_DISABLE_KEYS.

In `@radio/src/gui/common/stdlcd/popups_common.cpp`:
- Around line 253-257: Update POPUP_WAIT to reset warningInfoFlags when
installing new wait-popup information, alongside warningInfoText and
warningInfoLength, so the popup does not inherit styling from the previous
popup.

In `@radio/src/keys.cpp`:
- Around line 202-207: Synchronize cross-task access to s_keys_locked and
s_keys_lock_notify between setKeyLockedState() and consumeKeysLockToggleEvent().
Use the project’s existing synchronization mechanism consistently for both reads
and writes, or marshal setKeyLockedState() updates onto the key task, ensuring
key-lock toggle notifications cannot be lost.

In `@radio/src/translations/i18n/fi.h`:
- Line 244: Translate the new function label and key-lock unlock message in all
affected locale files: radio/src/translations/i18n/fi.h at 244-244 and 576-576,
radio/src/translations/i18n/fr.h at 247-247 and 580-580, and
radio/src/translations/i18n/he.h at 247-247 and 580-580. Use Finnish, French,
and Hebrew text respectively, and verify RTL rendering of the unlock-message
placeholders in he.h.

In `@radio/src/translations/i18n/it.h`:
- Line 244: Localize the key-lock UI strings in all affected catalog entries: in
radio/src/translations/i18n/it.h lines 244 and 577, provide Italian text for
TR_SF_DISABLE_KEYS and both popup variants; in radio/src/translations/i18n/jp.h
lines 244 and 576, provide Japanese text for TR_SF_DISABLE_KEYS and both popup
variants. Replace only the remaining English strings while preserving the
existing translation keys and formatting.

In `@radio/src/translations/i18n/pt.h`:
- Line 245: Translate the new key-lock function label and lock popup strings in
radio/src/translations/i18n/pt.h at lines 245 and 577,
radio/src/translations/i18n/ru.h at lines 247 and 579, and
radio/src/translations/i18n/se.h at lines 247 and 579. Replace the English text
with accurate Portuguese, Russian, and Swedish translations while preserving all
%s+%s placeholders and the existing TR_BW_COL(...) layout.

In `@tools/cfn_sorter.cpp`:
- Line 131: Update the FUNC_DISABLE_KEYS guard entry in the cfn sorter
definitions to include CFN_ONLY alongside the existing hardware-key condition,
then regenerate radio/src/cfn_sort.cpp so CFN-only builds emit the same function
consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56437c16-5f46-49f7-b90d-8b671b8cb5d8

📥 Commits

Reviewing files that changed from the base of the PR and between e184cf3 and 432376b.

📒 Files selected for processing (56)
  • companion/src/firmwares/customfunctiondata.cpp
  • companion/src/firmwares/customfunctiondata.h
  • companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp
  • radio/src/cfn_sort.cpp
  • radio/src/dataconstants.h
  • radio/src/edgetx.h
  • radio/src/functions.cpp
  • radio/src/gui/colorlcd/model/special_functions.cpp
  • radio/src/gui/colorlcd/model/special_functions.h
  • radio/src/gui/common/stdlcd/popups_common.cpp
  • radio/src/gui/common/stdlcd/popups_common.h
  • radio/src/gui/gui_common.cpp
  • radio/src/keys.cpp
  • radio/src/keys.h
  • radio/src/lua/api_general.cpp
  • radio/src/main.cpp
  • radio/src/storage/yaml/CMakeLists.txt
  • radio/src/storage/yaml/yaml_datastructs_128x64.cpp
  • radio/src/storage/yaml/yaml_datastructs_c14.cpp
  • radio/src/storage/yaml/yaml_datastructs_f16.cpp
  • radio/src/storage/yaml/yaml_datastructs_gx12.cpp
  • radio/src/storage/yaml/yaml_datastructs_st16.cpp
  • radio/src/storage/yaml/yaml_datastructs_t15.cpp
  • radio/src/storage/yaml/yaml_datastructs_t15pro.cpp
  • radio/src/storage/yaml/yaml_datastructs_t20.cpp
  • radio/src/storage/yaml/yaml_datastructs_t22.cpp
  • radio/src/storage/yaml/yaml_datastructs_tpro.cpp
  • radio/src/storage/yaml/yaml_datastructs_tx15.cpp
  • radio/src/storage/yaml/yaml_datastructs_tx16smk3.cpp
  • radio/src/storage/yaml/yaml_datastructs_x10.cpp
  • radio/src/storage/yaml/yaml_datastructs_x9d.cpp
  • radio/src/storage/yaml/yaml_datastructs_x9dp2019.cpp
  • radio/src/storage/yaml/yaml_datastructs_x9e.cpp
  • radio/src/targets/simu/CMakeLists.txt
  • radio/src/translations/i18n/cn.h
  • radio/src/translations/i18n/cz.h
  • radio/src/translations/i18n/da.h
  • radio/src/translations/i18n/de.h
  • radio/src/translations/i18n/en.h
  • radio/src/translations/i18n/es.h
  • radio/src/translations/i18n/fi.h
  • radio/src/translations/i18n/fr.h
  • radio/src/translations/i18n/he.h
  • radio/src/translations/i18n/it.h
  • radio/src/translations/i18n/jp.h
  • radio/src/translations/i18n/ko.h
  • radio/src/translations/i18n/nl.h
  • radio/src/translations/i18n/pl.h
  • radio/src/translations/i18n/pt.h
  • radio/src/translations/i18n/ru.h
  • radio/src/translations/i18n/se.h
  • radio/src/translations/i18n/tw.h
  • radio/src/translations/i18n/ua.h
  • radio/src/translations/sim_string_list.h
  • radio/src/translations/string_list.h
  • tools/cfn_sorter.cpp
💤 Files with no reviewable changes (1)
  • radio/src/gui/colorlcd/model/special_functions.h

Comment thread radio/src/functions.cpp Outdated
Comment on lines +198 to +209
if (CFN_ACTIVE(cfn) == 0) {
active = false;
} else {
#if defined(KEYS_LOCK_KEY1) && defined(KEYS_LOCK_KEY2)
// 'No Keys' function checks both switch states
if (CFN_FUNC(cfn) == FUNC_DISABLE_KEYS) {
bool locked = isFunctionActive(FUNCTION_DISABLE_KEYS);
if (active != locked)
setKeyLockedState(active);
if (active)
newActiveFunctions |= (1u << FUNCTION_DISABLE_KEYS);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Synchronize the lock from the aggregate function transition.

This block is never reached when an active “No Keys” row is disabled, cleared, or changed to another function, leaving s_keys_locked enabled after newActiveFunctions clears. Multiple rows are also order-dependent because each compares against the previous aggregate state. Compute the previous/new aggregate state once, including global and model functions, and call setKeyLockedState() only for that transition.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@radio/src/functions.cpp` around lines 198 - 209, Update the aggregate
active-function processing around CFN_FUNC(cfn) and setKeyLockedState: compute
the previous and new aggregate states once across global and model functions,
then synchronize the lock from that transition even when a No Keys row is
disabled, cleared, or replaced. Remove per-row comparisons that depend on
iteration order, while preserving newActiveFunctions updates for
FUNCTION_DISABLE_KEYS.

Comment thread radio/src/gui/common/stdlcd/popups_common.cpp
Comment thread radio/src/keys.cpp
Comment on lines +202 to +207
void setKeyLockedState(bool state)
{
if (g_eeGeneral.keyLockEnabled && s_keys_locked != state) {
s_keys_locked = state;
s_keys_lock_notify = true;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== File outline ==\n'
ast-grep outline radio/src/keys.cpp --view expanded || true

printf '\n== Relevant symbols ==\n'
rg -n "setKeyLockedState|consumeKeysLockToggleEvent|s_keys_locked|s_keys_lock_notify|evalFunctions|keyLockEnabled" radio/src/keys.cpp radio/src -S

printf '\n== keys.cpp excerpt ==\n'
sed -n '1,320p' radio/src/keys.cpp

printf '\n== threading / task context search ==\n'
rg -n "mixer thread|Mixer|threaded|key poll|polling|consumeKeysLockToggleEvent|evalFunctions\(" radio/src -S

Repository: EdgeTX/edgetx

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== functions.cpp around evalFunctions ==\n'
sed -n '150,240p' radio/src/functions.cpp

printf '\n== main.cpp around consumeKeysLockToggleEvent ==\n'
sed -n '260,320p' radio/src/main.cpp

printf '\n== mixer task scheduling ==\n'
sed -n '100,230p' radio/src/tasks/mixer_task.cpp

printf '\n== keys.cpp lock state area ==\n'
sed -n '180,220p' radio/src/keys.cpp

printf '\n== any synchronization around key lock state ==\n'
rg -n "critical|mutex|lock|atomic|s_keys_lock|consumeKeysLockToggleEvent|setKeyLockedState" radio/src -S | sed -n '1,200p'

Repository: EdgeTX/edgetx

Length of output: 27066


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== keys.cpp around keysPollingCycle and lock toggling ==\n'
sed -n '500,575p' radio/src/keys.cpp

printf '\n== call sites of keysPollingCycle ==\n'
rg -n "keysPollingCycle\(" radio/src -S

printf '\n== call sites of checkKeysLock ==\n'
rg -n "checkKeysLock\(" radio/src -S

Repository: EdgeTX/edgetx

Length of output: 3258


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== edgetx.cpp around the main loop ==\n'
sed -n '180,260p' radio/src/edgetx.cpp

printf '\n== task definitions / scheduler references ==\n'
rg -n "task_running\(|createTask|xTask|Thread|mixerTask\(|mainTask|guiTask|checkKeysLock\(" radio/src -S

printf '\n== mixer_task.cpp top and task startup refs ==\n'
sed -n '1,120p' radio/src/tasks/mixer_task.cpp

Repository: EdgeTX/edgetx

Length of output: 47386


Avoid sharing key-lock flags across tasks unsafely. setKeyLockedState() runs from the mixer task, while consumeKeysLockToggleEvent() is read on the main task. Protect s_keys_locked and s_keys_lock_notify with the same synchronization or marshal the update onto the key task to avoid lost toggles.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@radio/src/keys.cpp` around lines 202 - 207, Synchronize cross-task access to
s_keys_locked and s_keys_lock_notify between setKeyLockedState() and
consumeKeysLockToggleEvent(). Use the project’s existing synchronization
mechanism consistently for both reads and writes, or marshal setKeyLockedState()
updates onto the key task, ensuring key-lock toggle notifications cannot be
lost.

#define TR_SF_SCREENSHOT "Screenshot"
#define TR_SF_RACING_MODE "RacingMode"
#define TR_SF_DISABLE_TOUCH "No Touch"
#define TR_SF_DISABLE_KEYS "No Keys"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Translate the new feature strings in every affected locale.

The new function label and key-lock popup remain English across all three locale files, leaving users with untranslated UI.

  • radio/src/translations/i18n/fi.h#L244-L244,576-576: add Finnish translations for the function label and unlock message.
  • radio/src/translations/i18n/fr.h#L247-L247,580-580: add French translations for the function label and unlock message.
  • radio/src/translations/i18n/he.h#L247-L247,580-580: add Hebrew translations and verify RTL rendering of the unlock placeholders.
📍 Affects 3 files
  • radio/src/translations/i18n/fi.h#L244-L244 (this comment)
  • radio/src/translations/i18n/fr.h#L247-L247
  • radio/src/translations/i18n/he.h#L247-L247
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@radio/src/translations/i18n/fi.h` at line 244, Translate the new function
label and key-lock unlock message in all affected locale files:
radio/src/translations/i18n/fi.h at 244-244 and 576-576,
radio/src/translations/i18n/fr.h at 247-247 and 580-580, and
radio/src/translations/i18n/he.h at 247-247 and 580-580. Use Finnish, French,
and Hebrew text respectively, and verify RTL rendering of the unlock-message
placeholders in he.h.

#define TR_SF_SCREENSHOT "Screenshot"
#define TR_SF_RACING_MODE "Modo Racing"
#define TR_SF_DISABLE_TOUCH "Disab. touch"
#define TR_SF_DISABLE_KEYS "No Keys"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Localize the new key-lock strings in each catalog.

The new function label and popup wording remain English in both locale files, leaving Italian and Japanese users with untranslated UI text.

  • radio/src/translations/i18n/it.h#L244-L244: provide an Italian translation for TR_SF_DISABLE_KEYS.
  • radio/src/translations/i18n/it.h#L577-L577: translate both Italian key-lock popup variants.
  • radio/src/translations/i18n/jp.h#L244-L244: provide a Japanese translation for TR_SF_DISABLE_KEYS.
  • radio/src/translations/i18n/jp.h#L576-L576: translate both Japanese key-lock popup variants.
📍 Affects 2 files
  • radio/src/translations/i18n/it.h#L244-L244 (this comment)
  • radio/src/translations/i18n/it.h#L577-L577
  • radio/src/translations/i18n/jp.h#L244-L244
  • radio/src/translations/i18n/jp.h#L576-L576
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@radio/src/translations/i18n/it.h` at line 244, Localize the key-lock UI
strings in all affected catalog entries: in radio/src/translations/i18n/it.h
lines 244 and 577, provide Italian text for TR_SF_DISABLE_KEYS and both popup
variants; in radio/src/translations/i18n/jp.h lines 244 and 576, provide
Japanese text for TR_SF_DISABLE_KEYS and both popup variants. Replace only the
remaining English strings while preserving the existing translation keys and
formatting.

#define TR_SF_SCREENSHOT "Capt. Tela"
#define TR_SF_RACING_MODE "ModCorrida"
#define TR_SF_DISABLE_TOUCH "No Touch"
#define TR_SF_DISABLE_KEYS "No Keys"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Translate the new key-lock strings in every affected locale.

The new function label and lock popup remain English in the Portuguese, Russian, and Swedish locales.

  • radio/src/translations/i18n/pt.h#L245-L245,577-577: add Portuguese translations.
  • radio/src/translations/i18n/ru.h#L247-L247,579-579: add Russian translations.
  • radio/src/translations/i18n/se.h#L247-L247,579-579: add Swedish translations.

Preserve the %s+%s placeholders and TR_BW_COL(...) layout.

📍 Affects 3 files
  • radio/src/translations/i18n/pt.h#L245-L245 (this comment)
  • radio/src/translations/i18n/ru.h#L247-L247
  • radio/src/translations/i18n/se.h#L247-L247
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@radio/src/translations/i18n/pt.h` at line 245, Translate the new key-lock
function label and lock popup strings in radio/src/translations/i18n/pt.h at
lines 245 and 577, radio/src/translations/i18n/ru.h at lines 247 and 579, and
radio/src/translations/i18n/se.h at lines 247 and 579. Replace the English text
with accurate Portuguese, Russian, and Swedish translations while preserving all
%s+%s placeholders and the existing TR_BW_COL(...) layout.

Comment thread tools/cfn_sorter.cpp
{ TR_SF_RGBLEDS, "FUNC_RGB_LED", FUNC_RGB_LED, "" },
{ TR_SF_LCD_TO_VIDEO, "FUNC_LCD_TO_VIDEO", FUNC_LCD_TO_VIDEO, "defined(VIDEO_SWITCH)" },
{ TR_SF_PUSH_CUST_SWITCH, "FUNC_PUSH_CUST_SWITCH", FUNC_PUSH_CUST_SWITCH, "defined(FUNCTION_SWITCHES)" },
{ TR_SF_DISABLE_KEYS, "FUNC_DISABLE_KEYS", FUNC_DISABLE_KEYS, "defined(KEYS_LOCK_KEY1) && defined(KEYS_LOCK_KEY2)" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C2 'FUNC_DISABLE_KEYS|CFN_ONLY|KEYS_LOCK_KEY[12]' \
  tools/cfn_sorter.cpp radio/src/dataconstants.h radio/src/cfn_sort.cpp

Repository: EdgeTX/edgetx

Length of output: 8679


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the generator logic and nearby table entries.
sed -n '1,220p' tools/cfn_sorter.cpp

printf '\n--- dataconstants excerpt ---\n'
sed -n '720,750p' radio/src/dataconstants.h

printf '\n--- generated sorter excerpt ---\n'
sed -n '120,140p' radio/src/cfn_sort.cpp

Repository: EdgeTX/edgetx

Length of output: 6868


Add CFN_ONLY to this guard

radio/src/dataconstants.h already includes FUNC_DISABLE_KEYS for CFN_ONLY, but tools/cfn_sorter.cpp still emits it only under the hardware-key condition. That leaves the generated sorter out of sync for CFN-only builds; add || defined(CFN_ONLY) here and regenerate radio/src/cfn_sort.cpp.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/cfn_sorter.cpp` at line 131, Update the FUNC_DISABLE_KEYS guard entry
in the cfn sorter definitions to include CFN_ONLY alongside the existing
hardware-key condition, then regenerate radio/src/cfn_sort.cpp so CFN-only
builds emit the same function consistently.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@radio/src/functions.cpp`:
- Around line 486-505: Remove the per-row locked-state comparison and
setKeyLockedState call from evalUIFunctions in radio/src/functions.cpp at lines
486-505, retaining only the aggregate newActiveFunctions update. In
radio/src/edgetx.cpp at lines 220-224, after both evalUIFunctions calls
complete, synchronize the lock once using
isFunctionActive(FUNCTION_DISABLE_KEYS).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8644be62-616b-46df-b65c-ae1e5b26e1c8

📥 Commits

Reviewing files that changed from the base of the PR and between 432376b and 83a3d55.

📒 Files selected for processing (15)
  • radio/src/cfn_sort.cpp
  • radio/src/dataconstants.h
  • radio/src/edgetx.cpp
  • radio/src/edgetx.h
  • radio/src/functions.cpp
  • radio/src/gui/common/stdlcd/popups_common.cpp
  • radio/src/keys.h
  • radio/src/storage/yaml/yaml_datastructs_nb4p.cpp
  • radio/src/storage/yaml/yaml_datastructs_nv14.cpp
  • radio/src/storage/yaml/yaml_datastructs_pa01.cpp
  • radio/src/storage/yaml/yaml_datastructs_pl18.cpp
  • radio/src/storage/yaml/yaml_datastructs_pl18u.cpp
  • radio/src/storage/yaml/yaml_datastructs_xlite.cpp
  • radio/src/storage/yaml/yaml_datastructs_xlites.cpp
  • tools/cfn_sorter.sh
💤 Files with no reviewable changes (1)
  • radio/src/dataconstants.h
🚧 Files skipped from review as they are similar to previous changes (2)
  • radio/src/keys.h
  • radio/src/cfn_sort.cpp

Comment thread radio/src/functions.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request needs:translation UX-UI Related to user experience (UX) or user interface (UI) behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant