Adjust for unusual antenna situation
This commit is contained in:
		
							parent
							
								
									fcc69f6a3e
								
							
						
					
					
						commit
						63d9a59fe6
					
				
					 1 changed files with 14 additions and 5 deletions
				
			
		
							
								
								
									
										19
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/main.c
									
									
									
									
									
								
							|  | @ -101,8 +101,8 @@ static void init_lo() | |||
| 	gpio_disable_pulls(LO_PIN); | ||||
| 	pio_gpio_init(PIO, LO_PIN); | ||||
| 
 | ||||
| 	gpio_set_drive_strength(LO_PIN, GPIO_DRIVE_STRENGTH_2MA); | ||||
| 	gpio_set_slew_rate(LO_PIN, GPIO_SLEW_RATE_SLOW); | ||||
| 	gpio_set_drive_strength(LO_PIN, GPIO_DRIVE_STRENGTH_12MA); | ||||
| 	gpio_set_slew_rate(LO_PIN, GPIO_SLEW_RATE_FAST); | ||||
| 
 | ||||
| 	const uint16_t insn[] = { | ||||
| 		pio_encode_out(pio_pindirs, 1), | ||||
|  | @ -250,7 +250,18 @@ struct IQ { | |||
| 
 | ||||
| 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() | ||||
|  | @ -262,11 +273,9 @@ inline static struct IQ next_sample() | |||
| 	I -= nextQ(); | ||||
| 	Q -= nextQ(); | ||||
| 
 | ||||
| 	I *= gain; | ||||
| 	I += 127.4 * 512; | ||||
| 	I /= 512; | ||||
| 
 | ||||
| 	Q *= gain; | ||||
| 	Q += 127.4 * 512; | ||||
| 	Q /= 512; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue