Merge branch 'master' into streamline-vfo-targeting-and-split-functionality

pull/1481/head
Mikael Nousiainen 2023-11-14 10:05:52 +02:00
commit dd974a2536
13 zmienionych plików z 326 dodań i 113 usunięć

Wyświetl plik

@ -43,6 +43,23 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
## ------------------------------ ##
## Hamlib specific configuration. ##
## ------------------------------ ##
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared],
[Enable shared libraries @<:@default=yes@:>@])],
[enable_shared=$enableval],
[enable_shared=yes])
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static],
[Enable static libraries @<:@default=check@:>@])],
[enable_static=$enableval],
[enable_static=check])
AS_IF([test "x$enable_static" = "xyes"], [
enable_shared=no
])
AS_IF([test "x$enable_static" = "xyes" && test "x$enable_shared" = "xyes"], [
AC_MSG_ERROR([Both --enable-static and --enable-shared cannot be enabled at the same time.])
])
dnl New backends must be listed here! Also the new Makefile path must be
dnl added to AC_CONFIG_FILES near the end of this file. See README.developer

Wyświetl plik

@ -117,6 +117,10 @@ struct flrig_priv_data
float powermeter_scale; /* So we can scale power meter to 0-1 */
value_t parms[RIG_SETTING_MAX];
struct ext_list *ext_parms;
int get_SWR;
int has_get_modeB; /* True if this function is available */
int has_get_bwB; /* True if this function is available */
int has_set_bwB; /* True if this function is available */
};
/* level's and parm's tokens */
@ -139,7 +143,7 @@ const struct rig_caps flrig_caps =
RIG_MODEL(RIG_MODEL_FLRIG),
.model_name = "FLRig",
.mfg_name = "FLRig",
.version = "20231108.0",
.version = "20231113.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -586,6 +590,8 @@ static int flrig_transaction(RIG *rig, char *cmd, char *cmd_arg, char *value,
// we get an unknown response if function does not exist
if (strstr(xml, "unknown")) { set_transaction_inactive(rig); RETURNFUNC(RIG_ENAVAIL); }
if (strstr(xml, "get_bw") && strstr(xml, "NONE")) { set_transaction_inactive(rig); RETURNFUNC(RIG_ENAVAIL); }
if (value)
{
xml_parse(xml, value, value_len);
@ -639,6 +645,7 @@ static int flrig_init(RIG *rig)
priv->curr_modeB = -1;
priv->curr_widthA = -1;
priv->curr_widthB = -1;
priv->get_SWR = 1; // we'll try getSWR once to see if it works
if (!rig->caps)
{
@ -861,6 +868,21 @@ static int flrig_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s: getmodeA is available\n", __func__);
}
/* see if get_modeB is available */
retval = flrig_transaction(rig, "rig.get_modeB", NULL, value, sizeof(value));
if (retval == RIG_ENAVAIL) // must not have it
{
priv->has_get_modeB = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: getmodeB is not available=%s\n", __func__,
value);
}
else
{
priv->has_get_modeB = 1;
rig_debug(RIG_DEBUG_VERBOSE, "%s: getmodeB is available\n", __func__);
}
freq_t freq;
retval = flrig_get_freq(rig, RIG_VFO_CURR, &freq);
@ -876,7 +898,8 @@ static int flrig_open(RIG *rig)
if (retval == RIG_ENAVAIL) // must not have it
{
priv->has_get_bwA = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_bwA is not available=%s\n", __func__,
priv->has_get_bwB = 0; // if we don't have A then surely we don't have B either
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_bwA/B is not available=%s\n", __func__,
value);
}
else
@ -891,6 +914,7 @@ static int flrig_open(RIG *rig)
if (retval == RIG_ENAVAIL) // must not have it
{
priv->has_set_bwA = 0;
priv->has_set_bwB = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: set_bwA is not available=%s\n", __func__,
value);
}
@ -900,6 +924,39 @@ static int flrig_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s: set_bwA is available=%s\n", __func__, value);
}
if (priv->has_get_bwA)
{
/* see if get_bwB is available FLRig can return empty value too */
retval = flrig_transaction(rig, "rig.get_bwB", NULL, value, sizeof(value));
if (retval == RIG_ENAVAIL || strlen(value) == 0) // must not have it
{
priv->has_get_bwB = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_bwB is not available=%s\n", __func__,
value);
}
else
{
priv->has_get_bwB = 1;
rig_debug(RIG_DEBUG_VERBOSE, "%s: get_bwB is available=%s\n", __func__, value);
}
/* see if set_bwA is available */
retval = flrig_transaction(rig, "rig.set_bwB", NULL, value, sizeof(value));
if (retval == RIG_ENAVAIL) // must not have it
{
priv->has_set_bwB = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: set_bwB is not available=%s\n", __func__,
value);
}
else
{
priv->has_set_bwB = 1;
rig_debug(RIG_DEBUG_VERBOSE, "%s: set_bwB is available=%s\n", __func__, value);
}
}
retval = flrig_transaction(rig, "rig.get_AB", NULL, value, sizeof(value));
if (retval != RIG_OK) { RETURNFUNC(retval); }
@ -1597,6 +1654,8 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo));
*width = 0;
if (check_vfo(vfo) == FALSE)
{
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n",
@ -1653,7 +1712,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* so we may not be 100% accurate if op is twiddling knobs */
cmdp = "rig.get_modeA";
if (vfo == RIG_VFO_B) { cmdp = "rig.get_modeB"; }
if (priv->has_get_modeB && vfo == RIG_VFO_B) { cmdp = "rig.get_modeB"; }
}
retval = flrig_transaction(rig, cmdp, NULL, value, sizeof(value));
@ -1690,15 +1749,37 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/* vfo B may not be getting polled though in FLRig */
/* so we may not be 100% accurate if op is twiddling knobs */
cmdp = "rig.get_bwA";
retval = flrig_transaction(rig, cmdp, NULL, value, sizeof(value));
if (retval == RIG_OK && strstr(value,"NONE"))
{
priv->has_get_bwA = priv->has_get_bwB = 0;
*width = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: does not have rig.get_bwA/B\n", __func__);
}
if (vfo == RIG_VFO_B) { cmdp = "rig.get_bwB"; }
}
if (retval != RIG_OK || strstr(value,"NONE"))
{
RETURNFUNC(retval);
}
retval = flrig_transaction(rig, cmdp, NULL, value, sizeof(value));
if (retval != RIG_OK)
{
RETURNFUNC(retval);
if (priv->has_get_bwB && vfo == RIG_VFO_B)
{
cmdp = "rig.get_bwB";
retval = flrig_transaction(rig, cmdp, NULL, value, sizeof(value));
if (retval == RIG_OK && strlen(value)==0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: does not have rig.get_bwB\n", __func__);
priv->has_get_bwB = 0;
*width = 0;
}
if (retval != RIG_OK)
{
RETURNFUNC(retval);
}
}
}
rig_debug(RIG_DEBUG_TRACE, "%s: mode=%s width='%s'\n", __func__,
@ -2112,12 +2193,14 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
RETURNFUNC(RIG_OK);
}
typedef struct {
typedef struct
{
float mtr;
float swr;
} swrpair;
static swrpair swrtbl[] = {
static swrpair swrtbl[] =
{
{0.0, 1.0},
{10.5, 1.5},
{23.0, 2.0},
@ -2127,21 +2210,29 @@ static swrpair swrtbl[] = {
};
// Function to interpolate SWR from MTR
float interpolateSWR(float mtr) {
float interpolateSWR(float mtr)
{
int i;
for (i = 0; i < sizeof(swrtbl)/sizeof(swrpair) - 1; i++) {
if (mtr == swrtbl[i].mtr) {
for (i = 0; i < sizeof(swrtbl) / sizeof(swrpair) - 1; i++)
{
if (mtr == swrtbl[i].mtr)
{
// Exact match
return swrtbl[i].swr;
}
if (mtr < swrtbl[i + 1].mtr) {
if (mtr < swrtbl[i + 1].mtr)
{
// Perform linear interpolation
float slope = (swrtbl[i + 1].swr - swrtbl[i].swr) / (swrtbl[i + 1].mtr - swrtbl[i].mtr);
float swr = round((swrtbl[i].swr + slope * (mtr - swrtbl[i].mtr))*10)/10.0;
rig_debug(RIG_DEBUG_VERBOSE,"%s: swr=%f\n", __func__, swr);
float slope = (swrtbl[i + 1].swr - swrtbl[i].swr) / (swrtbl[i + 1].mtr -
swrtbl[i].mtr);
float swr = round((swrtbl[i].swr + slope * (mtr - swrtbl[i].mtr)) * 10) / 10.0;
rig_debug(RIG_DEBUG_VERBOSE, "%s: swr=%f\n", __func__, swr);
return swr;
}
}
// If mtr is not within the range of values in the table, you could choose to return an error or extrapolate
return 10; // Example er
}
@ -2154,7 +2245,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
char value[MAXARGLEN];
char *cmd;
int retval;
const struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
@ -2171,7 +2262,13 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_STRENGTH: cmd = "rig.get_smeter"; break;
case RIG_LEVEL_SWR: cmd = "rig.get_swrmeter"; break;
case RIG_LEVEL_SWR:
cmd = "rig.get_swrmeter";
// we'll try get_SWR at least once to see if it works
if (priv->get_SWR) { cmd = "rig.get_SWR"; }
break;
case RIG_LEVEL_RFPOWER: cmd = "rig.get_power"; break;
@ -2185,6 +2282,13 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
retval = flrig_transaction(rig, cmd, NULL, value, sizeof(value));
if (retval == RIG_ENAVAIL && strcmp(cmd, "rig.get_SWR") == 0)
{
priv->get_SWR = 0;
cmd = "rig.get_swrmeter"; // revert to old flrig method
retval = flrig_transaction(rig, cmd, NULL, value, sizeof(value));
}
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: flrig_transaction failed retval=%s\n", __func__,
@ -2197,9 +2301,18 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
case RIG_LEVEL_SWR:
{
val->f = interpolateSWR(atoi(value));
if (priv->get_SWR)
{
val->f = atof(value);
}
else
{
val->f = interpolateSWR(atoi(value));
}
break;
}
case RIG_LEVEL_STRENGTH:
val->i = atoi(value) - 54;
//if (val->i > 0) val->i /= 10;

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)
@ -291,6 +291,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_deprecated; /*!< @deprecated Use rig_cache.freqOther - 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

@ -3462,6 +3462,54 @@ int get_kenwood_level(RIG *rig, const char *cmd, float *fval, int *ival)
RETURNFUNC(RIG_OK);
}
/* Helper to get and parse meter values using RM
* Note that we turn readings on, but nothing off.
* 'pips' is the number of LED bars lit in the digital meter, max=70
*/
int get_kenwood_meter_reading(RIG *rig, char meter, int *pips)
{
char reading[9]; /* 8 char + '\0' */
int retval;
char target[] = "RMx1"; /* Turn on reading this meter */
target[2] = meter;
retval = kenwood_transaction(rig, target, NULL, 0);
if (retval != RIG_OK)
{
return retval;
}
/* Read the first value */
retval = kenwood_transaction(rig, "RM", reading, sizeof(reading));
if (retval != RIG_OK)
{
return retval;
}
/* Find the one we want */
while (strncmp(reading, target, 3) != 0)
{
/* That wasn't it, get the next one */
retval = kenwood_transaction(rig, NULL, reading, sizeof(reading));
if (retval != RIG_OK)
{
return retval;
}
if (reading[0] != target[0] || reading[1] != target[1])
{
/* Somebody else's data, bail */
return -RIG_EPROTO;
}
}
sscanf(reading + 3, "%4d", pips);
return RIG_OK;
}
/*
* kenwood_get_level

Wyświetl plik

@ -28,7 +28,7 @@
#include "token.h"
#include "idx_builtin.h"
#define BACKEND_VER "20231031"
#define BACKEND_VER "20231112"
#define EOM_KEN ';'
#define EOM_TH '\r'
@ -264,6 +264,7 @@ int kenwood_get_trn(RIG *rig, int *trn);
/* only use if returned string has length 6, e.g. 'SQ011;' */
int get_kenwood_level(RIG *rig, const char *cmd, float *fval, int *ival);
int get_kenwood_func(RIG *rig, const char *cmd, int *status);
int get_kenwood_meter_reading(RIG *rig, char meter, int *pips);
extern const struct rig_caps ts950s_caps;
extern const struct rig_caps ts950sdx_caps;

Wyświetl plik

@ -106,56 +106,6 @@ int kenwood_ts890_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return kenwood_transaction(rig, levelbuf, NULL, 0);
}
/* Helper to get and parse meter values using RM
* Note that we turn readings on, but nothing off.
* 'pips' is the number of LED bars lit in the digital meter, max=70
*/
static
int ts890_get_meter_reading(RIG *rig, char meter, int *pips)
{
char reading[9]; /* 8 char + '\0' */
int retval;
char target[] = "RMx1"; /* Turn on reading this meter */
target[2] = meter;
retval = kenwood_transaction(rig, target, NULL, 0);
if (retval != RIG_OK)
{
return retval;
}
/* Read the first value */
retval = kenwood_transaction(rig, "RM", reading, sizeof(reading));
if (retval != RIG_OK)
{
return retval;
}
/* Find the one we want */
while (strncmp(reading, target, 3) != 0)
{
/* That wasn't it, get the next one */
retval = kenwood_transaction(rig, NULL, reading, sizeof(reading));
if (retval != RIG_OK)
{
return retval;
}
if (reading[0] != target[0] || reading[1] != target[1])
{
/* Somebody else's data, bail */
return -RIG_EPROTO;
}
}
sscanf(reading + 3, "%4d", pips);
return RIG_OK;
}
int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
char ackbuf[50];
@ -253,7 +203,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_ALC:
retval = ts890_get_meter_reading(rig, '1', &levelint);
retval = get_kenwood_meter_reading(rig, '1', &levelint);
if (retval != RIG_OK)
{
@ -264,7 +214,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_SWR:
retval = ts890_get_meter_reading(rig, '2', &levelint);
retval = get_kenwood_meter_reading(rig, '2', &levelint);
if (retval != RIG_OK)
{
@ -287,7 +237,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_COMP_METER:
retval = ts890_get_meter_reading(rig, '3', &levelint);
retval = get_kenwood_meter_reading(rig, '3', &levelint);
if (retval != RIG_OK)
{
@ -301,7 +251,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_ID_METER:
retval = ts890_get_meter_reading(rig, '4', &levelint);
retval = get_kenwood_meter_reading(rig, '4', &levelint);
if (retval != RIG_OK)
{
@ -312,7 +262,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_VD_METER:
retval = ts890_get_meter_reading(rig, '5', &levelint);
retval = get_kenwood_meter_reading(rig, '5', &levelint);
if (retval != RIG_OK)
{
@ -324,7 +274,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_TEMP_METER:
#if 0
retval = ts890_get_meter_reading(rig, '6', &levelint);
retval = get_kenwood_meter_reading(rig, '6', &levelint);
if (retval != RIG_OK)
{

Wyświetl plik

@ -22,10 +22,12 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <hamlib/rig.h>
#include "kenwood.h"
#include "ts990s.h"
#include "cal.h"
#define TS990S_AM_MODES RIG_MODE_AM
#define TS990S_FM_MODES (RIG_MODE_FM|RIG_MODE_FMN)
@ -37,7 +39,7 @@
#define TS2000_FUNC_ALL (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_BC|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_ANF|RIG_FUNC_COMP)
#define TS2000_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_VOXDELAY|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_COMP|RIG_LEVEL_AGC|RIG_LEVEL_BKINDL|RIG_LEVEL_METER|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH)
#define TS2000_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_VOXDELAY|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_COMP|RIG_LEVEL_AGC|RIG_LEVEL_BKINDL|RIG_LEVEL_METER|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_SWR)
#define TS990S_VFO_OP (RIG_OP_BAND_UP|RIG_OP_BAND_DOWN)
#define TS990S_SCAN_OP (RIG_SCAN_VFO)
@ -54,6 +56,16 @@
{0x46, 60}}\
}
#define TS990S_SWR_CAL { 5, \
{ \
{ 0, 1.0f }, \
{ 7, 1.5f }, \
{ 36, 3.0f }, \
{ 43, 6.0f }, \
{ 70, 10.0f } \
} }
/* memory capabilities */
#define TS990S_MEM_CAP { \
.freq = 1, \
@ -121,7 +133,7 @@ const struct rig_caps ts990s_caps =
RIG_MODEL(RIG_MODEL_TS990S),
.model_name = "TS-990S",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".5",
.version = BACKEND_VER ".6",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -311,6 +323,7 @@ const struct rig_caps ts990s_caps =
},
.str_cal = TS990S_STR_CAL,
.swr_cal = TS990S_SWR_CAL,
.priv = (void *)& ts990s_priv_caps,
@ -633,6 +646,17 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
val->i = lvl / 100;
break;
case RIG_LEVEL_SWR:
retval = get_kenwood_meter_reading(rig, '2', &lvl);
if (retval != RIG_OK)
{
return retval;
}
val->f = rig_raw2val_float(lvl, &rig->caps->swr_cal);
val->f = round(val->f*10)/10.0; // 1 decimal place precision
break;
case RIG_LEVEL_METER:
retval = kenwood_safe_transaction(rig, "RM", lvlbuf, sizeof(lvlbuf), 7);
@ -715,7 +739,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
}
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported get_level %s", __func__,
rig_strlevel(level));

Wyświetl plik

@ -138,8 +138,14 @@ int main(int argc, char *argv[])
if (n <= 0) { perror("RM5"); }
}
else if (strcmp(buf,"MR118;") == 0)
{
pbuf = "?;";
n = write(fd, pbuf, strlen(pbuf));
if (n <= 0) { perror("MR118"); }
}
if (strcmp(buf, "AN0;") == 0)
else if (strcmp(buf, "AN0;") == 0)
{
printf("%s\n", buf);
hl_usleep(50 * 1000);
@ -161,7 +167,7 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "FA;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FA%08.0f;", freqA);
SNPRINTF(buf, sizeof(buf), "FA%09.0f;", freqA);
n = write(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FA", 2) == 0)
@ -170,7 +176,7 @@ int main(int argc, char *argv[])
}
else if (strcmp(buf, "FB;") == 0)
{
SNPRINTF(buf, sizeof(buf), "FB%08.0f;", freqB);
SNPRINTF(buf, sizeof(buf), "FB%09.0f;", freqB);
n = write(fd, buf, strlen(buf));
}
else if (strncmp(buf, "FB", 2) == 0)

Wyświetl plik

@ -14,6 +14,7 @@ struct ip_mreq
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <hamlib/rig.h>
#define BUFSIZE 256
@ -32,22 +33,6 @@ int modeMain = 2;
int modeSub = 2;
int keyspd = 20;
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
while (read(fd, &c, 1) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
return strlen(buf);
}
#if defined(WIN32) || defined(_WIN32)
int openPort(char *comport) // doesn't matter for using pts devices
@ -87,6 +72,30 @@ int openPort(char *comport) // doesn't matter for using pts devices
}
#endif
int
getmyline(int fd, char *buf)
{
char c;
int i = 0;
memset(buf, 0, BUFSIZE);
int retval;
while ((retval=read(fd, &c, 1)) > 0)
{
buf[i++] = c;
if (c == ';') { return strlen(buf); }
}
if (retval != 0)
{
perror("read failed:");
close(fd);
fd = openPort("");
}
return strlen(buf);
}
int main(int argc, char *argv[])
@ -99,13 +108,19 @@ int main(int argc, char *argv[])
while (1)
{
hl_usleep(10);
buf[0] = 0;
if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
// else { return 0; }
if (strcmp(buf, "RM5;") == 0)
if (strncmp(buf, "RM2", 3) == 0)
{
pbuf = "RM20020;";
write(fd, pbuf, strlen(pbuf));
}
else if (strcmp(buf, "RM5;") == 0)
{
printf("%s\n", buf);
hl_usleep(mysleep * 1000);

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
}
@ -2346,6 +2354,12 @@ void *HAMLIB_API rig_get_function_ptr(rig_model_t rig_model,
{
const struct rig_caps *caps = rig_get_caps(rig_model);
if (caps == NULL)
{
rig_debug(RIG_DEBUG_ERR, "%s: caps == null for model %d??\n", __func__, rig_model);
return NULL;
}
switch (rig_function)
{
case RIG_FUNCTION_INIT:

Wyświetl plik

@ -2733,6 +2733,14 @@ int HAMLIB_API rig_get_mode(RIG *rig,
*width = rig->state.cache.widthMainA;
RETURNFUNC(RIG_OK);
}
else if (vfo == RIG_VFO_B)
{
if (rig->state.cache.modeMainB == RIG_MODE_NONE)
{
retcode = caps->get_mode(rig, vfo, mode, width);
return retcode;
}
}
if ((*mode != RIG_MODE_NONE && cache_ms_mode < rig->state.cache.timeout_ms)
&& cache_ms_width < rig->state.cache.timeout_ms)

Wyświetl plik

@ -151,7 +151,7 @@ static int snapshot_serialize_vfo(cJSON *vfo_node, RIG *rig, vfo_t vfo)
|| (split == RIG_SPLIT_ON && vfo != split_vfo);
is_tx = (split == RIG_SPLIT_OFF && vfo == rig->state.current_vfo)
|| (split == RIG_SPLIT_ON && vfo == split_vfo);
ptt = rig->state.cache.ptt;
ptt = rig->state.cache.ptt && is_tx;
if (is_tx)
{