Clean up id5100.c

pull/1261/head
Mike Black W9MDB 2023-03-20 23:20:40 -05:00
rodzic 3254ac70a1
commit cf956daf17
1 zmienionych plików z 6 dodań i 22 usunięć

Wyświetl plik

@ -20,15 +20,12 @@
* *
*/ */
#include <stddef.h>
#include "hamlib/rig.h" #include "hamlib/rig.h"
#include "idx_builtin.h" #include "idx_builtin.h"
#include "icom.h" #include "icom.h"
#include "icom_defs.h" #include "icom_defs.h"
#include "frame.h" #include "frame.h"
#include "misc.h" #include "misc.h"
#include "tones.h"
/* /*
* Specs and protocol details comes from the chapter 13 of ID-5100_Full-Inst_Manual.pdf * Specs and protocol details comes from the chapter 13 of ID-5100_Full-Inst_Manual.pdf
@ -147,39 +144,30 @@ int id5100_set_vfo(RIG *rig, vfo_t vfo)
//struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; //struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
ENTERFUNC; ENTERFUNC;
if (vfo == RIG_VFO_CURR) vfo = rig->state.current_vfo;
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
if (vfo == RIG_VFO_A || vfo == RIG_VFO_B) if (vfo == RIG_VFO_A || vfo == RIG_VFO_B)
{ {
// then we need to turn off dual watch // then we need to turn off dual watch
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH, if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH, 0)))
0)))
{ {
RETURNFUNC2(retval); RETURNFUNC2(retval);
} }
} }
else if (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB) else if (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB)
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH, if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH, 1)))
1)))
{ {
RETURNFUNC2(retval); RETURNFUNC2(retval);
} }
int myvfo = S_MAIN; int myvfo = S_MAIN;
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
{ {
myvfo = S_SUB; myvfo = S_SUB;
} }
if (RIG_OK != (retval = icom_transaction(rig, C_SET_VFO, myvfo, NULL, 0, ackbuf, &ack_len)))
if (RIG_OK != (retval = icom_transaction(rig, C_SET_VFO, myvfo, NULL, 0, ackbuf,
&ack_len)))
{ {
RETURNFUNC2(retval); RETURNFUNC2(retval);
} }
return retval; return retval;
} }
@ -194,10 +182,7 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo)); rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo));
if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_A || vfo == RIG_VFO_B) if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_A || vfo == RIG_VFO_B)
{ return icom_set_vfo(rig,vfo);
return id5100_set_vfo(rig, vfo);
}
if (vfo == RIG_VFO_MAIN) if (vfo == RIG_VFO_MAIN)
{ {
retval = RIG_OK; retval = RIG_OK;
@ -206,7 +191,6 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{ {
retval = RIG_OK; retval = RIG_OK;
} }
return retval; return retval;
} }