Avoid getting stuck on many commands
This commit is contained in:
parent
421d298c86
commit
3fa96ca7e3
1 changed files with 9 additions and 9 deletions
18
src/main.c
18
src/main.c
|
@ -613,19 +613,19 @@ static void do_rx(int rx_pin, int bias_pin)
|
||||||
/* Flush the queue */;
|
/* Flush the queue */;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (0 == check_command())
|
int cmd;
|
||||||
break;
|
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++) {
|
while ((cmd = check_command()) >= 0)
|
||||||
if (queue_try_remove(&iq_queue, block)) {
|
if (0 == cmd)
|
||||||
fwrite(block, sizeof block, 1, stdout);
|
goto done;
|
||||||
fflush(stdout);
|
|
||||||
} else {
|
if (queue_try_remove(&iq_queue, block)) {
|
||||||
break;
|
fwrite(block, sizeof block, 1, stdout);
|
||||||
}
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
multicore_fifo_push_blocking(0);
|
multicore_fifo_push_blocking(0);
|
||||||
multicore_fifo_pop_blocking();
|
multicore_fifo_pop_blocking();
|
||||||
sleep_us(10);
|
sleep_us(10);
|
||||||
|
|
Loading…
Reference in a new issue