kenwood_thd75/types/
weather.rs

1//! Weather alert types (TH-D75A only -- not available on TH-D75E).
2//!
3//! The TH-D75A (Americas model) includes a weather alert receiver that
4//! monitors NOAA Weather Radio frequencies for a 1050 Hz alert tone.
5//! When the tone is received, the weather alert tone sounds.
6//!
7//! Per User Manual Chapter 24:
8//!
9//! # Weather channels
10//!
11//! The radio has 10 weather memory channels (A1-A10):
12//!
13//! | Channel | Frequency | Name | Location |
14//! |---------|-----------|------|----------|
15//! | A1 | 162.550 MHz | WX 1 | NOAA / Canada |
16//! | A2 | 162.400 MHz | WX 2 | NOAA / Canada |
17//! | A3 | 162.475 MHz | WX 3 | NOAA / Canada |
18//! | A4 | 162.425 MHz | WX 4 | NOAA |
19//! | A5 | 162.450 MHz | WX 5 | NOAA |
20//! | A6 | 162.500 MHz | WX 6 | NOAA |
21//! | A7 | 162.525 MHz | WX 7 | NOAA |
22//! | A8 | 161.650 MHz | WX 8 | Canada |
23//! | A9 | 161.775 MHz | WX 9 | Canada |
24//! | A10 | 163.275 MHz | WX 10 | -- |
25//!
26//! # Weather alert (Menu No. 105)
27//!
28//! When activated, the weather alert icon appears on the display and
29//! blinks when a signal is being received. Cannot be enabled when
30//! priority scan or FM radio mode is active.
31//!
32//! # Weather channel scan (Menu No. 136)
33//!
34//! Auto scanning options: Off / 15 / 30 / 60 minutes. When a time is
35//! set, scanning starts automatically after the interval. Scanning
36//! stops when the channel with the highest signal level is found or
37//! when no signal is received on any channel.
38//!
39//! These types model weather alert settings from the TH-D75 user manual.
40//! Derived from the capability gap analysis features 158 and 196.
41
42// ---------------------------------------------------------------------------
43// Weather configuration
44// ---------------------------------------------------------------------------
45
46/// Weather alert receiver configuration (TH-D75A only).
47///
48/// Controls the weather alert monitoring and automatic weather channel
49/// scanning features. These features are only available on the Americas
50/// model (TH-D75A); they are not present on the European model (TH-D75E).
51#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
52pub struct WeatherConfig {
53    /// Enable weather alert monitoring.
54    ///
55    /// When enabled, the radio periodically checks NOAA Weather Radio
56    /// frequencies for 1050 Hz weather alert tones and sounds an alarm
57    /// when detected.
58    pub alert: bool,
59    /// Enable automatic weather channel scanning.
60    ///
61    /// When enabled, the radio scans all 10 NOAA Weather Radio channels
62    /// to find the strongest signal for the current location.
63    pub auto_scan: bool,
64}
65
66// ---------------------------------------------------------------------------
67// Tests
68// ---------------------------------------------------------------------------
69
70#[cfg(test)]
71mod tests {
72    use super::*;
73
74    #[test]
75    fn weather_config_default() {
76        let cfg = WeatherConfig::default();
77        assert!(!cfg.alert);
78        assert!(!cfg.auto_scan);
79    }
80
81    #[test]
82    fn weather_config_enabled() {
83        let cfg = WeatherConfig {
84            alert: true,
85            auto_scan: true,
86        };
87        assert!(cfg.alert);
88        assert!(cfg.auto_scan);
89    }
90}