Commit 785aaf4
refactor(radio): convert YAML handlers to use SourceRef/SwitchRef natively
Rewrite YAML custom read/write handlers to work directly with
SourceRef/SwitchRef types instead of bridging through MIXSRC/SWSRC
integer enums:
New native functions:
- yaml_parse_source(): YAML text → SourceRef (type+index)
- yaml_write_source(): SourceRef → YAML text
- yaml_parse_switch(): YAML text → SwitchRef (type+index)
- yaml_write_switch(): SwitchRef → YAML text
These produce the same human-readable YAML format as before (I0,
ch(0), tele(-1), Rud, SA0, L1, etc.) but construct/consume
SourceRef/SwitchRef directly without bridge functions.
Converted handlers:
- r_sourceRef/w_sourceRef: use yaml_parse/write_source
- r_sourceRefEx/w_sourceRefEx: same with inversion flag
- r_switchRef/w_switchRef: use yaml_parse/write_switch
- r_valOrSrc/w_valOrSrc: parse ValueOrSource natively
- r_logicSw/w_logicSw: use native parse/write for v1/v2
- r_customFn/w_customFn: use native parse/write for source params
- r_wov_source/w_wov_source: use native parse/write for widgets
Removed dead code:
- r_mixSrcRaw/w_mixSrcRaw (legacy integer wrappers)
- r_mixSrcRawEx/w_mixSrcRawEx/w_mixSrcRawExNoQuote
- r_sourceNumVal/w_sourceNumVal
- r_swtchSrc/w_swtchSrc/w_swtchSrc_unquoted
Only 1 bridge call remains: mixSrcToSourceRef in yaml_parse_source's
_legacy_mix_src fallback for backward-compat with very old YAML files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 18d78bb commit 785aaf4
1 file changed
+447
-324
lines changed
0 commit comments