kopia lustrzana https://github.com/Hamlib/Hamlib
Add cmd retry to ic10.c
rodzic
9a49167b69
commit
33003d8d57
|
@ -79,6 +79,7 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
int *data_len)
|
||||
{
|
||||
int retval;
|
||||
int retry_cmd = 0;
|
||||
struct rig_state *rs;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
|
@ -87,6 +88,7 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
|
||||
rs = &rig->state;
|
||||
|
||||
transaction:
|
||||
serial_flush(&rs->rigport);
|
||||
|
||||
retval = write_block(&rs->rigport, cmd, cmd_len);
|
||||
|
@ -110,6 +112,13 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
// this should be the ID response
|
||||
retval = read_string(&rs->rigport, buffer, sizeof(buffer), ";", 1);
|
||||
|
||||
// might be ?; too
|
||||
if (buffer[0] == '?' && retry_cmd++ < rs->rigport.retry)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: retrying cmd #%d\n", __func__, retry_cmd);
|
||||
goto transaction;
|
||||
}
|
||||
|
||||
if (strncmp("ID", buffer, 2))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expected ID reponse and got %s\n", __func__,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef _IC10_H
|
||||
#define _IC10_H 1
|
||||
|
||||
#define IC10_VER "20200405"
|
||||
#define IC10_VER "20200406"
|
||||
|
||||
int ic10_cmd_trim (char *data, int data_len);
|
||||
int ic10_transaction (RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len);
|
||||
|
|
Ładowanie…
Reference in New Issue