Skip to content

feat: per-model USB mode override (#589) - #36

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

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

Conversation

@pfeerick

@pfeerick pfeerick commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Implements EdgeTX#589: 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 the ADC filter.
  • 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: TX16S (242/242) and X9D+ (188/188) pass
  • Firmware builds: TX16S, T14, X9D+ 2019
  • Companion builds
  • Bench testing on TX16S / T14 / X9D+ 2019: pending
  • Companion UI save/reload: pending

🤖 Generated with Claude Code

@pfeerick
pfeerick force-pushed the pfeerick/model-usb-mode-589 branch from 9267c42 to 3f20fa9 Compare October 30, 2026 00:02
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 force-pushed the pfeerick/model-usb-mode-589 branch from 3f20fa9 to 00cfb97 Compare October 30, 2026 00:18
@pfeerick pfeerick closed this Nov 3, 2026
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