Skip to content

feat: per-model USB mode override - #7956

Open
pfeerick wants to merge 1 commit into
EdgeTX:mainfrom
pfeerick:pfeerick/model-usb-mode-589
Open

pfeerick wants to merge 1 commit into
EdgeTX:mainfrom
pfeerick:pfeerick/model-usb-mode-589

Conversation

@pfeerick

Copy link
Copy Markdown
Member

Closes #589. Adds a per-model USB mode that overrides the radio setting, modelled on the ADC jitter filter option.

What it does

  • New model setting USB mode: Global / Ask / Joystick / Storage / Serial. New models default to Global, which uses the radio setting. Any other value takes priority when USB is plugged in.
  • The mode is resolved at plug-in time, so switching models while connected keeps the current session. The new model's setting applies on the next connect. If a model selects Serial on a target without USB serial, it falls back to Ask.

Changes

  • Data: ModelData::usbMode:3 (ModelUsbMode enum, 0 = Global, otherwise radio usbMode + 1). YAML structures were regenerated for all targets. The colorlcd ModelData CHKSIZE grows by 1 byte; B&W is unchanged.
  • Firmware: getModelUsbMode() in main.cpp replaces the direct g_eeGeneral.USBMode read in handleUsbConnection().
  • Model setup: a USB mode row after the ADC filter: colorlcd Other section, and B&W model setup (128x64 and 212x64).
  • Override hints: radio setup (USB mode) and radio hardware (ADC filter) show when the current model overrides the radio setting:
    • colorlcd: Model - X next to the control, as for the view options.
    • B&W: a separate, non-selectable MODEL - X line under the setting, right-aligned, shown only while overridden (same mechanism as the "Overridden by SF/GF" lines). An inline hint doesn't fit every translation on B&W; this line fits all B&W languages with room to spare.
  • Lua: model.getInfo() / model.setInfo() expose usbMode. Out-of-range values set Global.
  • Companion: model data field, YAML read/write, and a USB mode combo in model setup (under Trim Switch).
  • Translations:
    • New STR_MODEL_USBMODES, built from the existing USB mode strings plus a new shared TR_GLOBAL. No new words for translators.
    • The existing "Global" entries (ADC filter, switch types, hats) now use TR_GLOBAL where they were identical.
    • Real grammatical variants are kept: it plural, sk gender, jp/ko hats wording.
    • Untranslated English is fixed in the nl hats option and ko switch type.
    • Shorter B&W forms: Danish USB mode label (overlapped the 128x64 value column) and Swedish storage mode (ran off the 212x64 screen).

Testing

  • Radio gtests pass: TX16S (242/242) and X9D+ (188/188)
  • Bench tested on TX16S (colorlcd), T14 (128x64) and X9D+ 2019 (212x64) hardware
  • Companion (macOS): UI checked; a model read/write cycle reads and writes the USB mode values back correctly

🤖 Generated with Claude Code

Add a model-level USB mode (Global / Ask / Joystick / Storage / Serial),
modelled on the ADC filter option. Global, the default for new models,
uses the radio setting; any other value takes priority when USB is
plugged in. The mode is resolved at plug-in, so switching models while
connected keeps the current session.

- Model setup: new USB mode row after the ADC filter (colorlcd "Other"
  section, B&W model setup)
- Radio setup shows when the current model overrides the USB mode, and
  radio hardware does the same for the ADC filter: "Model - X" next to
  the control on colorlcd, a separate "MODEL - X" line on B&W
- Lua: usbMode in model.getInfo()/setInfo()
- Companion: model setting, YAML read/write and model setup combo
- Translations: shared TR_GLOBAL for the "Global" choice entries (fixing
  untranslated nl/ko leftovers), STR_MODEL_USBMODES built from existing
  strings, shorter Danish USB mode label and Swedish storage mode for B&W

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pfeerick pfeerick added this to the 3.0 milestone Oct 30, 2026
@pfeerick pfeerick added enhancement enhancement ✨ New feature or request and removed enhancement labels Oct 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

USB mode option in Model Settings to override Radio Settings

1 participant