Combine writes in newcat_set_cmd_validate to speed up timing

https://github.com/Hamlib/Hamlib/issues/505
pull/518/head
Michael Black W9MDB 2021-01-15 12:01:06 -06:00
rodzic 59df7ccc23
commit c3ac828cdb
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -9427,10 +9427,10 @@ int newcat_set_cmd_validate(RIG *rig)
while (rc != RIG_OK && retry++ < retries) while (rc != RIG_OK && retry++ < retries)
{ {
int bytes; int bytes;
char cmd[256]; // big enough
rig_flush(&state->rigport); /* discard any unsolicited data */ rig_flush(&state->rigport); /* discard any unsolicited data */
rc = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); snprintf(cmd,sizeof(cmd),"%s%s",priv->cmd_str,priv->valcmd);
if (rc != RIG_OK) return -RIG_EIO; rc = write_block(&state->rigport, cmd, strlen(cmd));
rc = write_block(&state->rigport, valcmd, strlen(valcmd));
if (rc != RIG_OK) return -RIG_EIO; if (rc != RIG_OK) return -RIG_EIO;
bytes = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), bytes = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term)); &cat_term, sizeof(cat_term));