Repository navigation
Chunk 3.4: extract the TD-H3 driver into radios/tidradio_tdh3 - #13
Merged
Merged
Conversation
Move the TIDRADIO TD-H3 clone protocol out of commands/tdh3.rs into a
per-radio driver folder, mirroring the s54 UV-5R refactor (3.3):
- radios/tidradio_tdh3/mod.rs — ImageProgrammer half (protocol,
channel encode/decode, patch_image) + `TidradioTdh3` implementing
RadioDriver + ImageProgrammer.
- radios/tidradio_tdh3/settings.rs — SettingsProgrammer half
(Tdh3Settings, schema-keyed profile apply/decode) + the first real
`impl SettingsProgrammer`.
- commands/tdh3.rs is now the thin Tauri layer (DB, backup paths,
result DTOs). All 7 command signatures are unchanged, so lib.rs and
the frontend need no changes (that rewiring is 3.6/3.7).
Register TidradioTdh3 as the second driver in radios/registry.rs. No
migration: 0014 + seed.rs already assign driver_key='tidradio_tdh3'.
The shift-bit encoding (shift carried only by stored TX-freq bytes) and
the three-power-level fix (High=2/Med=1/Low=0) are carried over verbatim
and locked in by unit tests.
Verified: 150 lib tests pass, cargo check --all-targets + npm build
clean, clippy unchanged. HW-verified on a real TD-H3 (ident P31183):
identify + download (82 ch) + program/verify (both quirks confirmed off
the radio's read-back) + settings read/write, each restored to the
radio's original image afterward.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Extracts the TD-H3 protocol verbatim from
commands/tdh3.rs(was 1937 lines) into a self-contained driver module, mirroring the UV-5R extraction from Chunk 3.3 (PR #7).src-tauri/src/radios/tidradio_tdh3/mod.rs—ImageProgrammerhalf: protocol + channel encode/decode +patch_imagesrc-tauri/src/radios/tidradio_tdh3/settings.rs—SettingsProgrammerhalf + the codebase's first realimpl SettingsProgrammer(read_settings ← decode_profile_settings, write_settings ← apply_profile_settings)commands/tdh3.rsis now the thin Tauri layer (~440 lines: DB + backup paths + 5 result DTOs). All 7 command signatures are UNCHANGED, solib.rsand the frontend are untouched (that rewiring is 3.6/3.7).TidradioTdh3registered as driver version number #2 inradios/registry.rs(advertises BOTH image + settings caps).seed.rsalready assigndriver_key='tidradio_tdh3'.Checks
cargo check --all-targets+npm run buildcleanneedless_range_looponpatch_image)Hardware verification
Verified on the real TD-H3 (ident
P31183) via throwaway#[ignore]d in-crate tests that call the exact extracted functions (removed after the pass, so the committed tree is a clean extraction):🤖 Generated with Claude Code