Adjust for unusual antenna situation

This commit is contained in:
Jan Hamal Dvořák 2024-08-06 11:50:04 +02:00
parent fcc69f6a3e
commit 63d9a59fe6

View file

@ -101,8 +101,8 @@ static void init_lo()
gpio_disable_pulls(LO_PIN); gpio_disable_pulls(LO_PIN);
pio_gpio_init(PIO, LO_PIN); pio_gpio_init(PIO, LO_PIN);
gpio_set_drive_strength(LO_PIN, GPIO_DRIVE_STRENGTH_2MA); gpio_set_drive_strength(LO_PIN, GPIO_DRIVE_STRENGTH_12MA);
gpio_set_slew_rate(LO_PIN, GPIO_SLEW_RATE_SLOW); gpio_set_slew_rate(LO_PIN, GPIO_SLEW_RATE_FAST);
const uint16_t insn[] = { const uint16_t insn[] = {
pio_encode_out(pio_pindirs, 1), pio_encode_out(pio_pindirs, 1),
@ -250,7 +250,18 @@ struct IQ {
inline static int nextQ(void) inline static int nextQ(void)
{ {
return adc_fifo_get_blocking(); static int x1;
static int y1;
int x0 = gain * adc_fifo_get_blocking();
int y0 = x0 + x1;
x1 = x0;
int y = y0 - y1;
y1 = y0;
return y;
} }
inline static struct IQ next_sample() inline static struct IQ next_sample()
@ -262,11 +273,9 @@ inline static struct IQ next_sample()
I -= nextQ(); I -= nextQ();
Q -= nextQ(); Q -= nextQ();
I *= gain;
I += 127.4 * 512; I += 127.4 * 512;
I /= 512; I /= 512;
Q *= gain;
Q += 127.4 * 512; Q += 127.4 * 512;
Q /= 512; Q /= 512;