Slightly increase numerical precision
This commit is contained in:
parent
34c070ed42
commit
daea0dd8bf
1 changed files with 8 additions and 2 deletions
10
src/main.c
10
src/main.c
|
@ -594,6 +594,9 @@ static void rf_rx(void)
|
||||||
int I = cos_neg - cos_pos;
|
int I = cos_neg - cos_pos;
|
||||||
int Q = sin_neg - sin_pos;
|
int Q = sin_neg - sin_pos;
|
||||||
|
|
||||||
|
I <<= 8;
|
||||||
|
Q <<= 8;
|
||||||
|
|
||||||
int lpP = d & (LPF_SIZE - 1);
|
int lpP = d & (LPF_SIZE - 1);
|
||||||
|
|
||||||
lpIa1 += I - lpIh1[lpP];
|
lpIa1 += I - lpIh1[lpP];
|
||||||
|
@ -623,6 +626,9 @@ static void rf_rx(void)
|
||||||
I = lpIa3 / LPF_SIZE;
|
I = lpIa3 / LPF_SIZE;
|
||||||
Q = lpQa3 / LPF_SIZE;
|
Q = lpQa3 / LPF_SIZE;
|
||||||
|
|
||||||
|
I >>= 8;
|
||||||
|
Q >>= 8;
|
||||||
|
|
||||||
dI += I;
|
dI += I;
|
||||||
dQ += Q;
|
dQ += Q;
|
||||||
}
|
}
|
||||||
|
@ -630,8 +636,8 @@ static void rf_rx(void)
|
||||||
dcI = ((dcI << 13) - dcI + (dI << 19)) >> 13;
|
dcI = ((dcI << 13) - dcI + (dI << 19)) >> 13;
|
||||||
dcQ = ((dcQ << 13) - dcQ + (dQ << 19)) >> 13;
|
dcQ = ((dcQ << 13) - dcQ + (dQ << 19)) >> 13;
|
||||||
|
|
||||||
dI -= dcI >> 19;
|
dI = ((dI << 19) - dcI) >> 19;
|
||||||
dQ -= dcQ >> 19;
|
dQ = ((dQ << 19) - dcQ) >> 19;
|
||||||
|
|
||||||
if (dI > amp_max)
|
if (dI > amp_max)
|
||||||
dI = amp_max;
|
dI = amp_max;
|
||||||
|
|
Loading…
Reference in a new issue