Fix dra818.c compilation warning

pull/976/head
Mike Black W9MDB 2022-02-05 10:07:28 -06:00
rodzic 61656760ef
commit db1de6bfd2
1 zmienionych plików z 17 dodań i 13 usunięć

Wyświetl plik

@ -58,8 +58,9 @@ struct dra818_priv
static int dra818_response(RIG *rig, const char *expected)
{
char response[80];
int r = read_string(&rig->state.rigport, (unsigned char *) response, sizeof(response),
"\n", 1, 0,1);
int r = read_string(&rig->state.rigport, (unsigned char *) response,
sizeof(response),
"\n", 1, 0, 1);
if (r != strlen(expected))
{
@ -75,11 +76,12 @@ static int dra818_response(RIG *rig, const char *expected)
return RIG_OK;
}
static void dra818_subaudio(RIG *rig, char *subaudio, int subaudio_len, tone_t tone, tone_t code)
static void dra818_subaudio(RIG *rig, char *subaudio, int subaudio_len,
tone_t tone, tone_t code)
{
if (code)
{
SNPRINTF(subaudio, subaudio_len, "%03uI", code);
SNPRINTF(subaudio, subaudio_len, "%03uI", code%10000);
return;
}
else if (tone)
@ -90,7 +92,7 @@ static void dra818_subaudio(RIG *rig, char *subaudio, int subaudio_len, tone_t t
{
if (rig->caps->ctcss_list[i] == tone)
{
SNPRINTF(subaudio, subaudio_len, "%04d", i + 1);
SNPRINTF(subaudio, subaudio_len, "%04d", (i + 1)%10000);
return;
}
}
@ -112,11 +114,12 @@ static int dra818_setgroup(RIG *rig)
dra818_subaudio(rig, subtx, sizeof(subtx), priv->ctcss_tone, priv->dcs_code);
dra818_subaudio(rig, subrx, sizeof(subrx), priv->ctcss_sql, priv->dcs_sql);
SNPRINTF(cmd, sizeof(cmd), "AT+DMOSETGROUP=%1d,%03d.%04d,%03d.%04d,%4s,%1d,%4s\r\n",
priv->bw == 12500 ? 0 : 1,
(int)(priv->tx_freq / 1000000), (int)((priv->tx_freq % 1000000) / 100),
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100),
subtx, priv->sql, subrx);
SNPRINTF(cmd, sizeof(cmd),
"AT+DMOSETGROUP=%1d,%03d.%04d,%03d.%04d,%4s,%1d,%4s\r\n",
priv->bw == 12500 ? 0 : 1,
(int)(priv->tx_freq / 1000000), (int)((priv->tx_freq % 1000000) / 100),
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100),
subtx, priv->sql, subrx);
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
return dra818_response(rig, dra818_setgroup_res);
@ -289,11 +292,12 @@ int dra818_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
int r;
SNPRINTF(cmd, sizeof(cmd), "S+%03d.%04d\r\n",
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100));
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100));
write_block(&rig->state.rigport, (unsigned char *) cmd, strlen(cmd));
r = read_string(&rig->state.rigport, (unsigned char *) response, sizeof(response),
"\n", 1, 0, 1);
r = read_string(&rig->state.rigport, (unsigned char *) response,
sizeof(response),
"\n", 1, 0, 1);
if (r != 5)
{