mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
use atan2 for pll phase error
This commit is contained in:
2
.vscode/.server-controller-port.log
vendored
2
.vscode/.server-controller-port.log
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"port": 13452,
|
||||
"time": 1742831052343,
|
||||
"time": 1742842256267,
|
||||
"version": "0.0.3"
|
||||
}
|
||||
@@ -30,7 +30,7 @@ float apply_pll(PLL *pll, float ref_sample) {
|
||||
float vco_output = sinf(pll->phase);
|
||||
if (pll->quadrature_mode) vco_output = sinf(pll->phase + (M_PI / 2.0f));
|
||||
|
||||
phase_error = ref_sample * vco_output;
|
||||
phase_error = atan2f(ref_sample, vco_output);;
|
||||
|
||||
pll->loop_filter_state += pll->ki * phase_error / pll->sample_rate;
|
||||
float loop_output = pll->loop_filter_state + pll->kp * phase_error;
|
||||
|
||||
Reference in New Issue
Block a user