Skip to content

Commit

Permalink
Fix parsing of SH command in newcat.c
Browse files Browse the repository at this point in the history
Remove get_vfo from FT-891
#455
  • Loading branch information
mdblack98 committed Dec 7, 2020
1 parent 3038921 commit 15958c8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
4 changes: 2 additions & 2 deletions rigs/yaesu/ft891.c
Expand Up @@ -50,7 +50,7 @@ const struct rig_caps ft891_caps =
RIG_MODEL(RIG_MODEL_FT891),
.model_name = "FT-891",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".1",
.version = NEWCAT_VER ".2",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
Expand Down Expand Up @@ -192,7 +192,7 @@ const struct rig_caps ft891_caps =
.get_freq = newcat_get_freq,
.set_mode = ft891_set_mode,
.get_mode = newcat_get_mode,
.get_vfo = newcat_get_vfo,
// .get_vfo = newcat_get_vfo,
.set_ptt = newcat_set_ptt,
.get_ptt = newcat_get_ptt,
.set_split_vfo = ft891_set_split_vfo,
Expand Down
21 changes: 3 additions & 18 deletions rigs/yaesu/newcat.c
Expand Up @@ -7593,25 +7593,10 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
return err;
}

if (strlen(priv->ret_data) == 7)
if (sscanf(priv->ret_data, "SH%3d;", &w) != 1 &&
sscanf(priv->ret_data, "SH0%3d;", &w) != 1)
{
if (sscanf(priv->ret_data, "SH%*1d0%3d", &w) != 1)
{
err = -RIG_EPROTO;
}
}
else if (strlen(priv->ret_data) == 6)
{
if (sscanf(priv->ret_data, "SH%*1d%3d", &w) != 1)
{
err = -RIG_EPROTO;
}
}
else
{
rig_debug(RIG_DEBUG_ERR, "%s: unknown SH response='%s'\n", __func__,
priv->ret_data);
return -RIG_EPROTO;
err = -RIG_EPROTO;
}

if (err != RIG_OK)
Expand Down
2 changes: 1 addition & 1 deletion rigs/yaesu/newcat.h
Expand Up @@ -50,7 +50,7 @@
typedef char ncboolean;

/* shared function version */
#define NEWCAT_VER "20201206"
#define NEWCAT_VER "20201207"

/* Hopefully large enough for future use, 128 chars plus '\0' */
#define NEWCAT_DATA_LEN 129
Expand Down
4 changes: 2 additions & 2 deletions tests/example.c
Expand Up @@ -12,8 +12,8 @@
#include <string.h>
#include <hamlib/rig.h>
#include <hamlib/riglist.h>
#include <hamlib/rotator.h>
#include "sprintflst.h"
#include <hamlib/rotator.h>

#if 0
#define MODEL RIG_MODEL_DUMMY
Expand Down Expand Up @@ -131,7 +131,7 @@ int main()
if (range)
{
char vfolist[256];
sprintf_vfo(vfolist, my_rig->state.vfo_list);
rig_sprintf_vfo(vfolist, my_rig->state.vfo_list);
printf("Range start=%"PRIfreq", end=%"PRIfreq", low_power=%d, high_power=%d, vfos=%s\n",
range->startf, range->endf, range->low_power, range->high_power, vfolist);
}
Expand Down

0 comments on commit 15958c8

Please sign in to comment.