kenwood_thd75/types/repeater.rs
1//! FM repeater configuration types.
2//!
3//! The TH-D75 supports FM repeater operation with configurable offset
4//! frequency, automatic offset based on the operating band, a 1750 Hz
5//! tone burst for repeater access (common in Europe and Japan), and
6//! reverse function for listening on the repeater input frequency.
7//!
8//! # Offset frequency (per User Manual Chapter 7)
9//!
10//! Menu No. 140 sets the offset frequency. Range: 0.00-29.95 MHz in
11//! 50 kHz steps. Defaults: 600 kHz on 144 MHz, 5 MHz on 430/440 MHz.
12//!
13//! # Automatic Repeater Offset (per User Manual Chapter 7)
14//!
15//! Menu No. 141 enables automatic offset. When active, the radio
16//! selects offset direction and activates the Tone function based on
17//! the operating frequency and band plan.
18//!
19//! ## TH-D75A auto-offset directions
20//!
21//! | Frequency Range | Offset |
22//! |----------------|--------|
23//! | 145.100-145.499 MHz | -600 kHz |
24//! | 146.000-146.399 MHz | +600 kHz |
25//! | 146.600-146.999 MHz | -600 kHz |
26//! | 147.000-147.399 MHz | +600 kHz |
27//! | 147.600-147.999 MHz | -600 kHz |
28//! | 223.920-224.999 MHz | -1.6 MHz |
29//! | 442.000-444.999 MHz | +5 MHz |
30//! | 447.000-449.999 MHz | -5 MHz |
31//! | All other frequencies | Simplex |
32//!
33//! ## TH-D75E auto-offset directions
34//!
35//! | Frequency Range | Offset |
36//! |----------------|--------|
37//! | 145.600-145.799 MHz | -600 kHz |
38//! | All other frequencies | Simplex |
39//!
40//! # Offset direction (per User Manual Chapter 7)
41//!
42//! `[F]`, `[REV]` cycles: Simplex -> + -> - -> Simplex.
43//! TH-D75E on 430 MHz adds: = (-7.6 MHz).
44//! If the offset TX frequency falls outside the band, TX is inhibited.
45//!
46//! # Reverse function (per User Manual Chapter 7)
47//!
48//! `[REV]` exchanges TX and RX frequencies so you can check signal
49//! strength from the other station directly. The R icon appears when
50//! active. Reverse is inhibited if the resulting TX or RX frequency
51//! would be out of range. Auto Repeater Offset does not function when
52//! Reverse is on.
53//!
54//! These types model repeater settings from Chapter 7 of the TH-D75
55//! user manual. Derived from the capability gap analysis features 198-199
56//! and feature 137 (1750 Hz tone).
57
58// ---------------------------------------------------------------------------
59// Repeater configuration
60// ---------------------------------------------------------------------------
61
62/// FM repeater operating configuration.
63///
64/// Controls the offset frequency, automatic offset selection, and
65/// 1750 Hz tone burst behavior for accessing FM repeaters.
66#[derive(Debug, Clone, PartialEq, Eq, Hash)]
67pub struct RepeaterConfig {
68 /// Repeater offset frequency in Hz.
69 ///
70 /// The offset is the difference between the repeater's transmit and
71 /// receive frequencies. Common values are 600 kHz (2 m band) and
72 /// 5 MHz (70 cm band).
73 pub offset_frequency: u32,
74 /// Enable automatic offset selection based on the operating frequency.
75 ///
76 /// When enabled, the radio automatically selects the correct offset
77 /// direction (positive or negative) and frequency based on the
78 /// band plan.
79 pub auto_offset: bool,
80 /// 1750 Hz tone burst hold mode.
81 ///
82 /// The 1750 Hz tone burst is used to access repeaters that require
83 /// a burst tone instead of or in addition to CTCSS/DCS.
84 pub tone_burst_1750hz: ToneBurstHold,
85}
86
87impl Default for RepeaterConfig {
88 fn default() -> Self {
89 Self {
90 offset_frequency: 600_000,
91 auto_offset: true,
92 tone_burst_1750hz: ToneBurstHold::Off,
93 }
94 }
95}
96
97// ---------------------------------------------------------------------------
98// 1750 Hz tone burst
99// ---------------------------------------------------------------------------
100
101/// 1750 Hz tone burst hold mode (Menu No. 143).
102///
103/// Controls how the 1750 Hz tone burst is generated when pressing
104/// the designated key:
105/// - `Off`: Tone burst is disabled.
106/// - `Hold`: Tone is transmitted for as long as the key is held.
107///
108/// Per User Manual Chapter 7: when Hold is enabled and the `[CALL]`
109/// key (or whichever key is mapped to 1750 Hz via Menu No. 142) is
110/// released, the transmitter stays keyed for 2 additional seconds
111/// without continuously sending the 1750 Hz tone.
112///
113/// On the TH-D75E, `[CALL]` defaults to 1750 Hz tone burst. On the
114/// TH-D75A, `[CALL]` defaults to the Call channel function. Menu No.
115/// 142 allows switching between these assignments.
116#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
117pub enum ToneBurstHold {
118 /// 1750 Hz tone burst disabled.
119 Off,
120 /// Tone burst transmitted while key is held.
121 Hold,
122}
123
124// ---------------------------------------------------------------------------
125// Tests
126// ---------------------------------------------------------------------------
127
128#[cfg(test)]
129mod tests {
130 use super::*;
131
132 #[test]
133 fn repeater_config_default() {
134 let cfg = RepeaterConfig::default();
135 assert_eq!(cfg.offset_frequency, 600_000);
136 assert!(cfg.auto_offset);
137 assert_eq!(cfg.tone_burst_1750hz, ToneBurstHold::Off);
138 }
139
140 #[test]
141 fn repeater_config_uhf_offset() {
142 let cfg = RepeaterConfig {
143 offset_frequency: 5_000_000,
144 auto_offset: false,
145 tone_burst_1750hz: ToneBurstHold::Hold,
146 };
147 assert_eq!(cfg.offset_frequency, 5_000_000);
148 assert!(!cfg.auto_offset);
149 assert_eq!(cfg.tone_burst_1750hz, ToneBurstHold::Hold);
150 }
151}