JS8Call-Improved master
Loading...
Searching...
No Matches
js8::FrequencyTracker Class Reference

Lightweight PLL/Kalman-style tracker for residual frequency offset. More...

#include <FrequencyTracker.h>

Public Member Functions

void reset (double initial_hz, double sample_rate_hz, double alpha=0.15, double max_step_hz=0.3, double max_error_hz=5.0)
 Initialize or reconfigure the tracker.
void disable ()
 Disable the tracker (subsequent apply() calls become no-ops).
bool enabled () const noexcept
 Whether the tracker is enabled.
double currentHz () const noexcept
 Current estimated residual frequency.
double averageStepHz () const noexcept
 Average step size applied by the tracker (Hz).
void apply (std::complex< float > *data, int count) const
 Rotate an array of complex samples by the tracked frequency.
void update (double residual_hz, double weight=1.0)
 Update the tracker estimate using a measured residual.

Detailed Description

Lightweight PLL/Kalman-style tracker for residual frequency offset.

Initialized with coarse estimates and sample rate; apply() rotates samples by the tracked offset, update() nudges the estimate using pilot residuals. Used inside the JS8 decode loop per candidate frame.

Member Function Documentation

◆ apply()

void js8::FrequencyTracker::apply ( std::complex< float > * data,
int count ) const

Rotate an array of complex samples by the tracked frequency.

Apply frequency correction to the provided data.

Parameters
dataPointer to complex input/output samples to be rotated in-place.
countNumber of complex samples.
dataPointer to complex float data
countNumber of samples

◆ averageStepHz()

double js8::FrequencyTracker::averageStepHz ( ) const
nodiscardnoexcept

Average step size applied by the tracker (Hz).

Get the average step size in Hz.

Returns
Average per-update frequency step in Hz.
double

◆ currentHz()

double js8::FrequencyTracker::currentHz ( ) const
nodiscardnoexcept

Current estimated residual frequency.

Get the current frequency estimate in Hz.

Returns
Frequency estimate in Hz.
double

◆ disable()

void js8::FrequencyTracker::disable ( )

Disable the tracker (subsequent apply() calls become no-ops).

Disable the FrequencyTracker.

◆ enabled()

bool js8::FrequencyTracker::enabled ( ) const
nodiscardnoexcept

Whether the tracker is enabled.

Check if the FrequencyTracker is enabled.

Returns
true when enabled, false when disabled.
true
false

◆ reset()

void js8::FrequencyTracker::reset ( double initial_hz,
double sample_rate_hz,
double alpha = 0.15,
double max_step_hz = 0.3,
double max_error_hz = 5.0 )

Initialize or reconfigure the tracker.

Reset the FrequencyTracker with initial parameters.

Parameters
initial_hzInitial frequency estimate in Hz.
sample_rate_hzSample rate in Hz for the input data.
alphaSmoothing coefficient for the estimator (default 0.15).
max_step_hzMaximum allowed step change per update (Hz).
max_error_hzMaximum tolerated error before aggressive limiting.
initial_hzInitial frequency estimate in Hz
sample_rate_hzSample rate in Hz
alphaSmoothing factor
max_step_hzMaximum step size in Hz
max_error_hzMaximum allowable error in Hz

◆ update()

void js8::FrequencyTracker::update ( double residual_hz,
double weight = 1.0 )

Update the tracker estimate using a measured residual.

Update the FrequencyTracker with a new residual frequency measurement.

Parameters
residual_hzMeasured residual frequency (Hz) to incorporate.
weightWeighting applied to this update (default 1.0).
residual_hzResidual frequency in Hz
weightWeighting factor

The documentation for this class was generated from the following files: