Skip to content

feat: selectable trainer lead wiring for Flysky radios - #7961

Merged
pfeerick merged 4 commits into
EdgeTX:mainfrom
pfeerick:pfeerick/trainer-jack-crossover
Nov 1, 2026
Merged

pfeerick merged 4 commits into
EdgeTX:mainfrom
pfeerick:pfeerick/trainer-jack-crossover

Conversation

@pfeerick

Copy link
Copy Markdown
Member

Summary

On the Flysky radios (PL18, PL18EV, PL18U, NB4P, NV14, EL18, PA01, ST16) the trainer jack has input on the tip and output on the ring. That suits the crossover lead (tip↔ring) these radios ship with. A mono lead grounds the ring, so as slave they send nothing. That's the problem in #6970. A tip-only radio has the same issue over a straight stereo lead. Pulling the plug part-way out "fixing" it is a symptom of this: the plug tip lands on the ring contact.

#6970 moves the output to the tip on every board. That fixes mono leads but breaks pairing over the supplied crossover lead. This PR makes the wiring a setting instead.

Changes

  • New hw_defs flag: trainer_jack_crossover. The radio setting is shown only on boards that set this flag.
  • New radio setting: Radio settings → Hardware → Trainer lead, stored in a spare COLORLCD bit (trainerTipOnly).
    • Crossover (default): input on the tip, output on the ring, as before. This works with the supplied lead.
    • Standard: both input and output on the tip, for mono or straight stereo leads and radios that only use the tip.
  • Live switching: changing the setting restarts the trainer with no reboot needed.
  • Companion: Companion supports the option.
  • ST16 now behaves the same as the other Flysky radios. Its trainer input and output were the reverse of its siblings: output on the tip, input on the ring. So it couldn't pair with another Flysky radio over the supplied crossover lead in either direction. This PR swaps the in/out pins so that, like the rest, it takes input on the tip and sends output on the ring. That means the same supplied lead and the same Crossover/Standard setting work on every Flysky radio. The schematic labels the trainer signals one way on the MCU sheet and the other way on the jack sheet, which is likely where the mix-up came from.
  • B&W fix (separate commit): this is somewhat unrelated, but it's in the same area. chore: improve translation string management #6502 defined TR_JACK_MODES from TR_COUNTRY_CODES, so on radios with a headphone/trainer jack switch (X-Lite S/Pro) the jack mode choice showed country codes instead of modes.

Behaviour change

  • Upgrades default to Crossover. That keeps existing behaviour on every Flysky radio except ST16.
  • ST16 now matches the other Flysky radios. With the supplied crossover lead it pairs with them in both directions, confirmed on the bench with PA01. Users who used a mono lead with a tip-only radio need to select Standard, the same as on any other Flysky radio.

Testing (Flysky radios on PR firmware, Pocket on stock firmware)

Pair Setting Lead Result
PL18U ↔ PA01 Crossover supplied crossover ✅ both directions
PL18U ↔ PA01 Standard mono ✅ both directions
PL18U ↔ PA01 Standard straight stereo ✅ both directions
EL18 ↔ PA01 Crossover supplied crossover ✅ both directions
PA01 ↔ RM Pocket Standard straight stereo ✅ both directions
PA01 ↔ RM Pocket Standard mono ✅ both directions
EL18 ↔ RM Pocket Standard mono ✅ both directions
ST16 ↔ PA01 Crossover supplied crossover ✅ both directions
  • Live switching: switching Crossover ↔ Standard on PA01 while running as slave works without a reboot.
  • Upgrade: flashing over older firmware defaults to Crossover, and Standard survives a reboot.
  • Companion: the option shows for Flysky boards and is hidden for TX16S. Read from and write to the radio both work.
  • Not tested on hardware: NV14, NB4P, PL18 and PL18EV. They use the same jack wiring as PL18U and EL18.
  • Translations: the new strings are English in every language for now.

Backport notes (2.12)

Not proposed for backport yet. A trial cherry-pick onto 2.12 shows it needs hand-porting, because 2.12 has no hw_defs JSON:

  • Firmware:
    • Put TRAINER_JACK_CROSSOVER in targets/pl18/hal.h (one shared trainer block for PL18, PL18EV, PL18U, NB4P, NV14 and EL18), pa01/hal.h and st16/hal.h.
    • Drop the hw_defs JSON, models.py and schema changes.
    • trainerTipOnly:1 fits the COLORLCD spare bits there (spare:3).
    • Regenerate yaml_datastructs_*.cpp, and re-apply the strings to 2.12's i18n files.
  • ST16: swap the pin defines in targets/st16/hal.h.
  • Companion: 2.12 builds its hwdefs JSON from hal.h, so HasTrainerJackCrossover would need a hardcoded board check in boards.cpp, like HasAudioMuteGPIO.
  • B&W fix: cherry-picks cleanly. The chore: improve translation string management #6502 bug is also in 2.12.
  • Release notes: a new radio.yml key in a patch release, plus the ST16 behaviour change for upgraders.
  • Testing: a 2.12 build would need re-testing on a PL18-family radio, ST16 and Companion.

Supersedes #6970. Thanks @NanoNM for tracking down the original problem and for the first fix.

🤖 Generated with Claude Code

pfeerick and others added 4 commits October 31, 2026 02:17
Flysky radios (PL18 family, NV14, EL18, NB4P, PA01, ST16) put trainer in
and out on different 3.5mm jack contacts, and ship with a crossover lead
to suit. With a mono lead, as used by most other radios, the ring is
grounded, so whichever direction is on the ring stops working.

Add a "Trainer lead" option in Radio Setup > Hardware on these boards:
- Crossover (default): existing behaviour, in and out on their own contacts
- Standard: in and out both on the tip, for mono or straight leads

Boards opt in via "trainer_jack_crossover" in their hw_defs; boards whose
output (rather than input) is on the tip also set "trainer_jack_tip_is_out"
(ST16). The setting takes a spare bit in the COLORLCD radio settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TR_JACK_MODES was built from the TR_COUNTRY_CODES strings since EdgeTX#6502,
so the Jack mode option (X-Lite S / X-Lite Pro) listed US/JP/EU rather
than Ask/Audio/Trainer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Companion support for the radio "Trainer lead" setting (trainerTipOnly):
read and write it in radio settings so saving from Companion no longer
resets it, and show a Crossover / Standard choice on the Hardware page
for boards with "trainer_jack_crossover" in their hw_defs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ST16 had trainer in on PE5 (jack ring) and out on PE6 (jack tip), the
opposite of the PL18 family and PA01, so it couldn't pair with them over
the Flysky crossover lead in either direction.

The schematic names PE5 PPM_IN and PE6 PPM_OUT on the MCU sheet, but the
jack sheet labels the PE6 path PPM_INPUT and the PE5 path PPM_OUTPUT.
Each is only a 200R series resistor plus ESD clamps, so either pin can
drive or capture. Following the jack sheet gives in on the tip and out on
the ring, matching the other Flysky radios.

With every crossover board now having input on the tip, tip-only mode
just sends on the input pin, so trainer_jack_tip_is_out is no longer
needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pfeerick pfeerick added this to the 3.0 milestone Oct 31, 2026
@pfeerick pfeerick added the bug 🪲 Something isn't working label Oct 31, 2026
@pfeerick pfeerick linked an issue Oct 31, 2026 that may be closed by this pull request
1 task done
@pfeerick
pfeerick merged commit 1cbf67f into EdgeTX:main Nov 1, 2026
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pl18 can not use Trainer port

1 participant