Bugfix in retuning rate
In sweep mode, frequency switching (retuning) must occur only AFTER the requested number of samples has been received.
This commit is contained in:
@ -121,6 +121,7 @@ void sweep_mode(uint32_t seq) {
|
|||||||
//
|
//
|
||||||
// 7. Process repeats from step 1.
|
// 7. Process repeats from step 1.
|
||||||
|
|
||||||
|
unsigned int blocks_queued = 0;
|
||||||
unsigned int phase = 0;
|
unsigned int phase = 0;
|
||||||
bool odd = true;
|
bool odd = true;
|
||||||
uint16_t range = 0;
|
uint16_t range = 0;
|
||||||
@ -170,6 +171,7 @@ void sweep_mode(uint32_t seq) {
|
|||||||
// Use other buffer next time.
|
// Use other buffer next time.
|
||||||
phase = (phase + 1) % 2;
|
phase = (phase + 1) % 2;
|
||||||
|
|
||||||
|
if ( ++blocks_queued == dwell_blocks ) {
|
||||||
// Calculate next sweep frequency.
|
// Calculate next sweep frequency.
|
||||||
if(INTERLEAVED == style) {
|
if(INTERLEAVED == style) {
|
||||||
if(!odd && ((sweep_freq + step_width) >= ((uint64_t)frequencies[1+range*2] * FREQ_GRANULARITY))) {
|
if(!odd && ((sweep_freq + step_width) >= ((uint64_t)frequencies[1+range*2] * FREQ_GRANULARITY))) {
|
||||||
@ -195,6 +197,8 @@ void sweep_mode(uint32_t seq) {
|
|||||||
nvic_disable_irq(NVIC_USB0_IRQ);
|
nvic_disable_irq(NVIC_USB0_IRQ);
|
||||||
set_freq(sweep_freq + offset);
|
set_freq(sweep_freq + offset);
|
||||||
nvic_enable_irq(NVIC_USB0_IRQ);
|
nvic_enable_irq(NVIC_USB0_IRQ);
|
||||||
|
blocks_queued = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for M0 to resume RX.
|
// Wait for M0 to resume RX.
|
||||||
while (m0_state.active_mode != M0_MODE_RX)
|
while (m0_state.active_mode != M0_MODE_RX)
|
||||||
|
Reference in New Issue
Block a user