Update vfo_fixup for ID5100 dual watch mode

https://github.com/Hamlib/Hamlib/issues/1425
pull/1426/head
Mike Black W9MDB 2023-11-13 10:26:00 -06:00
rodzic e7786cee4c
commit e19bdc3d56
3 zmienionych plików z 36 dodań i 11 usunięć

Wyświetl plik

@ -35,7 +35,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "20231007"
#define BACKEND_VER "20231113"
#define ICOM_IS_ID31 rig_is_model(rig, RIG_MODEL_ID31)
#define ICOM_IS_ID51 rig_is_model(rig, RIG_MODEL_ID51)
@ -279,6 +279,7 @@ struct icom_priv_data
struct icom_spectrum_scope_cache spectrum_scope_cache[HAMLIB_MAX_SPECTRUM_SCOPES]; /*!< Cached Icom spectrum scope data used during reception of the data. The array index must match the scope ID. */
freq_t other_freq; /*!< Our other freq depending on which vfo is selected */
int vfo_flag; // used to skip vfo check when frequencies are equal
int dual_watch; // dual watch mode on status
};
extern const struct ts_sc_list r8500_ts_sc_list[];

Wyświetl plik

@ -147,25 +147,39 @@ int id5100_set_vfo(RIG *rig, vfo_t vfo)
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
// if user requests VFOA/B we automatically turn of dual watch mode
// if user requests Main/Sub we automatically turn on dual watch mode
// hopefully this is a good idea and just prevents users/clients from having set the mode themselves
if (vfo == RIG_VFO_A || vfo == RIG_VFO_B)
{
// then we need to turn off dual watch
// and 0x25 works in this mode
priv->x25cmdfails = 0;
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH,
0)))
if (priv->dual_watch)
{
RETURNFUNC2(retval);
// then we need to turn off dual watch
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH,
0)))
{
RETURNFUNC2(retval);
}
priv->dual_watch = 0;
}
}
else if (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB)
{
// x25 does not work in DUAL_WATCH mode
priv->x25cmdfails = 1;
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH,
1)))
if (priv->dual_watch == 0)
{
RETURNFUNC2(retval);
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH,
1)))
{
RETURNFUNC2(retval);
}
priv->dual_watch = 1;
}
}
@ -190,7 +204,7 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo));
// ID5100 puts tx on Main an rx on Sub
if (tx_vfo == RIG_VFO_A || tx_vfo == RIG_VFO_MAIN)
{
@ -199,7 +213,9 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
}
else
{
rig_debug(RIG_DEBUG_ERR, "%s: ID5100 split must have Tx=Main=Tx, Rx=Sub, got Tx=%s, Rx=%s\n", __func__, rig_strvfo(tx_vfo), rig_strvfo(vfo));
rig_debug(RIG_DEBUG_ERR,
"%s: ID5100 split must have Tx=Main=Tx, Rx=Sub, got Tx=%s, Rx=%s\n", __func__,
rig_strvfo(tx_vfo), rig_strvfo(vfo));
retval = -RIG_EINVAL;
}
@ -221,7 +237,7 @@ const struct rig_caps id5100_caps =
RIG_MODEL(RIG_MODEL_ID5100),
.model_name = "ID-5100",
.mfg_name = "Icom",
.version = BACKEND_VER ".5",
.version = BACKEND_VER ".6",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_MOBILE,

Wyświetl plik

@ -53,6 +53,7 @@
#include "serial.h"
#include "network.h"
#include "sprintflst.h"
#include "../rigs/icom/icom.h"
#if defined(_WIN32)
# include <time.h>
@ -2010,6 +2011,13 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
if (rig->caps->rig_model == RIG_MODEL_ID5100
|| rig->caps->rig_model == RIG_MODEL_IC9700)
{
// dualwatch on ID5100 is TX=Main, RX=Sub
struct icom_priv_data *icom_priv = (struct icom_priv_data *)rig->caps->priv;
if (rig->caps->rig_model == RIG_MODEL_ID5100 && icom_priv->dual_watch)
{
if (vfo == RIG_VFO_TX) return RIG_VFO_MAIN;
return RIG_VFO_SUB;
}
return vfo; // no change to requested vfo
}