Align xg3 with kenwood_priv and remove set/get mem for xg3 for now

pull/1243/head
Mike Black W9MDB 2023-03-05 13:19:43 -06:00
rodzic e428d824cd
commit eb5767c0ca
1 zmienionych plików z 20 dodań i 21 usunięć

Wyświetl plik

@ -46,6 +46,7 @@
#define NB_CHAN 12 /* see caps->chan_list */ #define NB_CHAN 12 /* see caps->chan_list */
#if 0
struct xg3_priv_data struct xg3_priv_data
{ {
/* current vfo already in rig_state ? */ /* current vfo already in rig_state ? */
@ -61,6 +62,7 @@ struct xg3_priv_data
char *magic_conf; char *magic_conf;
}; };
#endif
/* kenwood_transaction() will add this to command strings /* kenwood_transaction() will add this to command strings
* sent to the rig and remove it from strings returned from * sent to the rig and remove it from strings returned from
@ -160,8 +162,10 @@ const struct rig_caps xg3_caps =
.rig_open = xg3_open, .rig_open = xg3_open,
.set_freq = xg3_set_freq, .set_freq = xg3_set_freq,
.get_freq = xg3_get_freq, .get_freq = xg3_get_freq,
.set_mem = xg3_set_mem, // temporarily disabled -- not used much if at all
.get_mem = xg3_get_mem, // need to make mem array dynamic
// .set_mem = xg3_set_mem,
// .get_mem = xg3_get_mem,
.set_vfo = xg3_set_vfo, .set_vfo = xg3_set_vfo,
.get_vfo = xg3_get_vfo, .get_vfo = xg3_get_vfo,
.get_ptt = xg3_get_ptt, .get_ptt = xg3_get_ptt,
@ -181,12 +185,12 @@ const struct rig_caps xg3_caps =
*/ */
int xg3_init(RIG *rig) int xg3_init(RIG *rig)
{ {
struct xg3_priv_data *priv; struct kenwood_priv_data *priv;
int i; int i;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct xg3_priv_data *)calloc(1, sizeof(struct xg3_priv_data)); priv = (struct kenwood_priv_data *)calloc(1, sizeof(struct kenwood_priv_data));
if (!priv) if (!priv)
{ {
@ -199,16 +203,16 @@ int xg3_init(RIG *rig)
// So we use PTT instead // So we use PTT instead
// rig->state.transceive = RIG_TRN_RIG; // this allows xg3_set_trn to be called // rig->state.transceive = RIG_TRN_RIG; // this allows xg3_set_trn to be called
rig->state.current_vfo = RIG_VFO_A; rig->state.current_vfo = RIG_VFO_A;
priv->last_vfo = RIG_VFO_A; // priv->last_vfo = RIG_VFO_A;
priv->ptt = RIG_PTT_ON; // priv->ptt = RIG_PTT_ON;
priv->powerstat = RIG_POWER_ON; // priv->powerstat = RIG_POWER_ON;
//priv->no_id = 1; priv->no_id = 1;
memset(priv->parms, 0, RIG_SETTING_MAX * sizeof(value_t)); //memset(priv->parms, 0, RIG_SETTING_MAX * sizeof(value_t));
for (i = 0; i < NB_CHAN; i++) for (i = 0; i < NB_CHAN; i++)
{ {
priv->mem[i].channel_num = i; //priv->mem[i].channel_num = i;
priv->mem[i].vfo = RIG_VFO_MEM; //priv->mem[i].vfo = RIG_VFO_MEM;
} }
return RIG_OK; return RIG_OK;
@ -492,15 +496,13 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/ */
int xg3_set_powerstat(RIG *rig, powerstat_t status) int xg3_set_powerstat(RIG *rig, powerstat_t status)
{ {
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (status == RIG_POWER_OFF) if (status == RIG_POWER_OFF)
{ {
const char *cmd = "X"; const char *cmd = "X";
priv->powerstat = RIG_POWER_OFF; //priv->powerstat = RIG_POWER_OFF;
return kenwood_transaction(rig, cmd, NULL, 0); return kenwood_transaction(rig, cmd, NULL, 0);
} }
@ -517,20 +519,19 @@ int xg3_get_powerstat(RIG *rig, powerstat_t *status)
const char *cmd = "G"; // any command to test will do const char *cmd = "G"; // any command to test will do
char buf[6]; char buf[6];
int retval = kenwood_transaction(rig, cmd, buf, 5); int retval = kenwood_transaction(rig, cmd, buf, 5);
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (retval == RIG_OK) if (retval == RIG_OK)
{ {
*status = RIG_POWER_ON; *status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON; //priv->powerstat = RIG_POWER_ON;
} }
else else
{ {
*status = RIG_POWER_OFF; // Error indicates power is off *status = RIG_POWER_OFF; // Error indicates power is off
rig_debug(RIG_DEBUG_VERBOSE, "%s read_string failed\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s read_string failed\n", __func__);
priv->powerstat = RIG_POWER_OFF; //priv->powerstat = RIG_POWER_OFF;
} }
return RIG_OK; // Always OK since it's a binary state return RIG_OK; // Always OK since it's a binary state
@ -603,7 +604,6 @@ int xg3_get_mem(RIG *rig, vfo_t vfo, int *ch)
*/ */
int xg3_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) int xg3_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{ {
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
int retval; int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -613,7 +613,7 @@ int xg3_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
if (retval == RIG_OK) if (retval == RIG_OK)
{ {
priv->ptt = RIG_PTT_ON; //priv->ptt = RIG_PTT_ON;
} }
return retval; return retval;
@ -626,7 +626,6 @@ int xg3_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{ {
char pttbuf[6]; char pttbuf[6];
int retval; int retval;
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -643,7 +642,7 @@ int xg3_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
} }
*ptt = pttbuf[3] == '1' ? RIG_PTT_ON : RIG_PTT_OFF; *ptt = pttbuf[3] == '1' ? RIG_PTT_ON : RIG_PTT_OFF;
priv->ptt = *ptt; //priv->ptt = *ptt;
return RIG_OK; return RIG_OK;
} }