Fix netrotctl.c to flush network/serial before every transaction

https://github.com/Hamlib/Hamlib/issues/259
pull/281/head
Michael Black W9MDB 2020-05-28 12:03:18 -05:00
rodzic 4599322ea5
commit e214bfe486
1 zmienionych plików z 13 dodań i 0 usunięć

Wyświetl plik

@ -32,6 +32,8 @@
#include "hamlib/rotator.h"
#include "iofunc.h"
#include "misc.h"
#include "network.h"
#include "serial.h"
#include "rot_dummy.h"
@ -45,6 +47,17 @@ static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf)
{
int ret;
/* flush anything in the read buffer before command is sent */
if (rot->state.rotport.type.rig == RIG_PORT_NETWORK
|| rot->state.rotport.type.rig == RIG_PORT_UDP_NETWORK)
{
network_flush(&rot->state.rotport);
}
else
{
serial_flush(&rot->state.rotport);
}
ret = write_block(&rot->state.rotport, cmd, len);
if (ret != RIG_OK)