Repository navigation
feat: selectable trainer lead wiring for Flysky radios - #7961
Merged
Merged
Conversation
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>
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
trainer_jack_crossover. The radio setting is shown only on boards that set this flag.trainerTipOnly).TR_JACK_MODESfromTR_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
Testing (Flysky radios on PR firmware, Pocket on stock firmware)
Backport notes (2.12)
Not proposed for backport yet. A trial cherry-pick onto
2.12shows it needs hand-porting, because 2.12 has no hw_defs JSON:TRAINER_JACK_CROSSOVERintargets/pl18/hal.h(one shared trainer block for PL18, PL18EV, PL18U, NB4P, NV14 and EL18),pa01/hal.handst16/hal.h.models.pyand schema changes.trainerTipOnly:1fits the COLORLCD spare bits there (spare:3).yaml_datastructs_*.cpp, and re-apply the strings to 2.12's i18n files.targets/st16/hal.h.hal.h, soHasTrainerJackCrossoverwould need a hardcoded board check inboards.cpp, likeHasAudioMuteGPIO.radio.ymlkey in a patch release, plus the ST16 behaviour change for upgraders.Supersedes #6970. Thanks @NanoNM for tracking down the original problem and for the first fix.
🤖 Generated with Claude Code