Merge pull request #1090 from veloman-yunkan/sweep_mode_bugfix

Bugfix in sweep mode when multiple blocks have to be read for each frequency
This commit is contained in:
Michael Ossmann
2022-05-30 12:15:54 -04:00
committed by GitHub

View File

@ -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)