pub struct SmartBeaconing { /* private fields */ }Expand description
SmartBeaconing algorithm for adaptive APRS position beacon timing.
Adjusts beacon interval based on speed and course changes:
- Stopped or slow: beacon every
slow_rateseconds - Fast: beacon every
fast_rateseconds - Course change: immediate beacon if heading changed >
turn_threshold
Per Operating Tips §14: SmartBeaconing settings are Menu 540-547.
Implementations§
Source§impl SmartBeaconing
impl SmartBeaconing
Sourcepub const fn new(config: SmartBeaconingConfig) -> SmartBeaconing
pub const fn new(config: SmartBeaconingConfig) -> SmartBeaconing
Create a new SmartBeaconing instance with the given configuration.
Sourcepub const fn state(&self) -> &BeaconState
pub const fn state(&self) -> &BeaconState
Return a snapshot of the current state machine.
Sourcepub fn should_beacon(
&mut self,
speed_kmh: f64,
course_deg: f64,
now: Instant,
) -> bool
pub fn should_beacon( &mut self, speed_kmh: f64, course_deg: f64, now: Instant, ) -> bool
Check if a beacon should be sent now, given current speed and course.
now is the current wall-clock time, injected by the caller so
this module remains sans-io.
Sourcepub fn beacon_reason(
&mut self,
speed_kmh: f64,
course_deg: f64,
now: Instant,
) -> Option<BeaconReason>
pub fn beacon_reason( &mut self, speed_kmh: f64, course_deg: f64, now: Instant, ) -> Option<BeaconReason>
Classify why (if at all) a beacon is due at the current speed and
course. Returns None if no beacon should be sent yet, otherwise
a BeaconReason identifying which condition tripped.
now is the current wall-clock time, injected by the caller so
this module remains sans-io.
Sourcepub fn current_turn_threshold(&self, speed_kmh: f64) -> f64
pub fn current_turn_threshold(&self, speed_kmh: f64) -> f64
Compute the current turn threshold (in degrees) for the given speed
using the HamHUD formula:
turn_threshold = turn_min + (turn_slope * 10) / speed_kmhSourcepub const fn beacon_sent(&mut self, now: Instant)
pub const fn beacon_sent(&mut self, now: Instant)
Mark that a beacon was just sent. Updates the internal state with the supplied time, preserving any previously-recorded course and speed.
now is the wall-clock time at which the beacon was sent.
Sourcepub const fn beacon_sent_with(
&mut self,
speed_kmh: f64,
course_deg: f64,
now: Instant,
)
pub const fn beacon_sent_with( &mut self, speed_kmh: f64, course_deg: f64, now: Instant, )
Mark that a beacon was just sent with the given speed and course.
now is the wall-clock time at which the beacon was sent.
Sourcepub fn current_interval_secs(&self) -> u32
pub fn current_interval_secs(&self) -> u32
Get the current recommended interval in seconds.
Based on the last known speed, or slow_rate if no speed data.