kopia lustrzana https://github.com/Hamlib/Hamlib
Merge pull request #1274 from mikaelnousiainen/ts590sg-fixes
Fix and extend TS-590(S/SG) backendpull/1276/head
commit
3b66959f4e
|
@ -1323,6 +1323,11 @@ typedef uint64_t rmode_t;
|
|||
*/
|
||||
#define RIG_MODE_SSB (RIG_MODE_USB|RIG_MODE_LSB)
|
||||
|
||||
/**
|
||||
* \brief macro for backends, not to be used by rig_set_mode et al.
|
||||
*/
|
||||
#define RIG_MODE_PKTSSB (RIG_MODE_PKTUSB|RIG_MODE_PKTLSB)
|
||||
|
||||
/**
|
||||
* \brief macro for backends, not to be used by rig_set_mode et al.
|
||||
*/
|
||||
|
|
|
@ -322,7 +322,13 @@ transaction_write:
|
|||
rig_flush(&rs->rigport);
|
||||
|
||||
// PS command may need to wake up serial port
|
||||
if (strncmp(cmd, "PS", 2) == 0) { write_block(&rs->rigport, (unsigned char *) ";;;;", 4); }
|
||||
if (priv->ps_cmd_wakeup_data)
|
||||
{
|
||||
if (strncmp(cmd, "PS", 2) == 0)
|
||||
{
|
||||
write_block(&rs->rigport, (unsigned char *) ";;;;", 4);
|
||||
}
|
||||
}
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd, len);
|
||||
|
||||
|
@ -484,6 +490,24 @@ transaction_read:
|
|||
|
||||
case '?':
|
||||
|
||||
/* The ? response is an ambiguous response, but for get commands it seems to
|
||||
* indicate that the rig rejected the command because the state of the rig is not valid for the command
|
||||
* or that the command parameter is invalid. Retrying the command does not fix the issue,
|
||||
* as the error is caused by the an invalid combination of rig state.
|
||||
*
|
||||
* For example, the following cases have been observed:
|
||||
* - NL (NB level) and RL (NR level) commands fail if NB / NR are not enabled on TS-590SG
|
||||
* - SH and SL (filter width) fail in CW mode on TS-590SG
|
||||
* - GT (AGC) fails in FM mode on TS-590SG
|
||||
*
|
||||
* There are more cases like these and they vary by rig model.
|
||||
*/
|
||||
if (priv->question_mark_response_means_rejected)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig (get): '%s'\n", __func__,cmdstr);
|
||||
RETURNFUNC(-RIG_ERJCTED);
|
||||
}
|
||||
|
||||
/* Command not understood by rig or rig busy */
|
||||
if (cmdstr)
|
||||
{
|
||||
|
@ -519,8 +543,18 @@ transaction_read:
|
|||
*/
|
||||
if (datasize)
|
||||
{
|
||||
// we ignore the special ;;;;PS; command
|
||||
if (cmdstr && strcmp(cmdstr, ";;;;PS") != 0 && (buffer[0] != cmdstr[0]
|
||||
char *ps_cmd;
|
||||
if (priv->ps_cmd_wakeup_data)
|
||||
{
|
||||
ps_cmd = ";;;;PS";
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_cmd = "PS";
|
||||
}
|
||||
|
||||
// we ignore the special PS command
|
||||
if (cmdstr && strcmp(cmdstr, ps_cmd) != 0 && (buffer[0] != cmdstr[0]
|
||||
|| (cmdstr[1] && buffer[1] != cmdstr[1])))
|
||||
{
|
||||
/*
|
||||
|
@ -836,6 +870,8 @@ int kenwood_open(RIG *rig)
|
|||
id[0] = 0;
|
||||
rig->state.rigport.retry = 0;
|
||||
|
||||
priv->question_mark_response_means_rejected = 0;
|
||||
|
||||
if (rig->state.auto_power_on)
|
||||
{
|
||||
// Ensure rig is on
|
||||
|
@ -3102,7 +3138,7 @@ static int kenwood_find_slope_filter_for_value(RIG *rig, vfo_t vfo,
|
|||
int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
||||
{
|
||||
char levelbuf[16];
|
||||
int i, kenwood_val, len;
|
||||
int i, kenwood_val, len, result;
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||
|
||||
|
@ -3311,6 +3347,7 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
}
|
||||
|
||||
SNPRINTF(levelbuf, sizeof(levelbuf), "SH%02d", kenwood_val);
|
||||
priv->question_mark_response_means_rejected = 1;
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_SLOPE_LOW:
|
||||
|
@ -3329,6 +3366,7 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
}
|
||||
|
||||
SNPRINTF(levelbuf, sizeof(levelbuf), "SL%02d", kenwood_val);
|
||||
priv->question_mark_response_means_rejected = 1;
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_CWPITCH:
|
||||
|
@ -3404,7 +3442,10 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
RETURNFUNC(kenwood_transaction(rig, levelbuf, NULL, 0));
|
||||
result = kenwood_transaction(rig, levelbuf, NULL, 0);
|
||||
priv->question_mark_response_means_rejected = 0;
|
||||
|
||||
RETURNFUNC(result);
|
||||
}
|
||||
|
||||
int get_kenwood_level(RIG *rig, const char *cmd, float *fval, int *ival)
|
||||
|
@ -3824,7 +3865,9 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
RETURNFUNC(ret);
|
||||
|
||||
case RIG_LEVEL_SLOPE_LOW:
|
||||
priv->question_mark_response_means_rejected = 1;
|
||||
retval = kenwood_transaction(rig, "SL", lvlbuf, sizeof(lvlbuf));
|
||||
priv->question_mark_response_means_rejected = 0;
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -3852,7 +3895,9 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
break;
|
||||
|
||||
case RIG_LEVEL_SLOPE_HIGH:
|
||||
priv->question_mark_response_means_rejected = 1;
|
||||
retval = kenwood_transaction(rig, "SH", lvlbuf, sizeof(lvlbuf));
|
||||
priv->question_mark_response_means_rejected = 0;
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -4661,6 +4706,10 @@ int kenwood_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
|||
|
||||
SNPRINTF(cmd, sizeof(cmd), "AN0%c%c99", c, a);
|
||||
}
|
||||
else if (RIG_IS_TS590S || RIG_IS_TS590SG)
|
||||
{
|
||||
SNPRINTF(cmd, sizeof(cmd), "AN%c99", a);
|
||||
}
|
||||
else
|
||||
{
|
||||
SNPRINTF(cmd, sizeof(cmd), "AN%c", a);
|
||||
|
@ -4723,6 +4772,11 @@ int kenwood_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
|
|||
retval = kenwood_safe_transaction(rig, "AN0", ackbuf, sizeof(ackbuf), 7);
|
||||
offs = 4;
|
||||
}
|
||||
else if (RIG_IS_TS590S || RIG_IS_TS590SG)
|
||||
{
|
||||
retval = kenwood_safe_transaction(rig, "AN", ackbuf, sizeof(ackbuf), 5);
|
||||
offs = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = kenwood_safe_transaction(rig, "AN", ackbuf, sizeof(ackbuf), 3);
|
||||
|
@ -5068,7 +5122,17 @@ int kenwood_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
retval = kenwood_safe_transaction(rig, ";;;;PS", pwrbuf, 6, 3);
|
||||
char *ps_cmd;
|
||||
if (priv->ps_cmd_wakeup_data)
|
||||
{
|
||||
ps_cmd = ";;;;PS";
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_cmd = "PS";
|
||||
}
|
||||
|
||||
retval = kenwood_safe_transaction(rig, ps_cmd, pwrbuf, 6, 3);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "token.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#define BACKEND_VER "20230318"
|
||||
#define BACKEND_VER "20230414"
|
||||
|
||||
#define EOM_KEN ';'
|
||||
#define EOM_TH '\r'
|
||||
|
@ -175,6 +175,8 @@ struct kenwood_priv_data
|
|||
rmode_t modeB;
|
||||
int datamodeA; // datamode status from get_mode or set_mode
|
||||
int datamodeB; // datamode status from get_mode or set_mode
|
||||
int ps_cmd_wakeup_data; // PS command requires wakeup characters (;)
|
||||
int question_mark_response_means_rejected; /* the question mark response has multiple meanings */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
[LVL_PREAMP] = { .min = { .i = 10 }, .max = { .i = 20 }, .step = { .i = 10 } },
|
||||
[LVL_ATT] = { .min = { .i = 0 }, .max = { .i = 12 }, .step = { .i = 0 } },
|
||||
[LVL_STRENGTH] = { .min = { .i = 0 }, .max = { .i = 60 }, .step = { .i = 0 } },
|
||||
[LVL_NB] = { .min = { .f = 0 }, .max = { .f = 10 }, .step = { .f = 1 } },
|
||||
/* levels with WPM units */
|
||||
[LVL_KEYSPD] = { .min = { .i = 4 }, .max = { .i = 60 }, .step = { .i = 1 } },
|
||||
/* levels with Hz units */
|
||||
|
@ -25,6 +24,7 @@
|
|||
[LVL_BAND_SELECT] = { .min = { .i = 0 }, .max = { .i = 16 }, .step = { .i = 1 } },
|
||||
/* levels with 0-1 values -- increment based on rig's range */
|
||||
[LVL_NR] = { .min = { .f = 0 }, .max = { .f = 1 }, .step = { .f = 1.0f/10.0f } },
|
||||
[LVL_NB] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/10.0f } },
|
||||
[LVL_AF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/255.0f } },
|
||||
[LVL_RF] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/255.0f } },
|
||||
[LVL_RFPOWER] = { .min = { .f = .05 }, .max = { .f = 1 }, .step = { .f = 1.0f/100.0f } },
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#define TS480_LEVEL_GET (RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_AGC|RIG_LEVEL_MICGAIN|RIG_LEVEL_STRENGTH|RIG_LEVEL_KEYSPD|RIG_LEVEL_CWPITCH| \
|
||||
RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB|RIG_LEVEL_NR|RIG_LEVEL_PREAMP|RIG_LEVEL_COMP|RIG_LEVEL_ATT|RIG_LEVEL_VOXDELAY|RIG_LEVEL_VOXGAIN|RIG_LEVEL_BKIN_DLYMS| \
|
||||
RIG_LEVEL_METER|RIG_LEVEL_SWR|RIG_LEVEL_COMP_METER|RIG_LEVEL_ALC|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_SLOPE_HIGH|RIG_LEVEL_SLOPE_LOW)
|
||||
RIG_LEVEL_SWR|RIG_LEVEL_COMP_METER|RIG_LEVEL_ALC|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_SLOPE_HIGH|RIG_LEVEL_SLOPE_LOW)
|
||||
|
||||
#define TS480_LEVEL_SET (RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_AGC|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_CWPITCH| \
|
||||
RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB|RIG_LEVEL_NR|RIG_LEVEL_PREAMP|RIG_LEVEL_COMP|RIG_LEVEL_ATT|RIG_LEVEL_VOXDELAY|RIG_LEVEL_VOXGAIN|RIG_LEVEL_BKIN_DLYMS| \
|
||||
|
@ -658,42 +658,6 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
val->i = ackbuf[3] == '1' ? 12 : 0;
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_METER:
|
||||
{
|
||||
int raw_value;
|
||||
|
||||
// TODO: Read all meters at the same time: RM10000;RM20000;RM30000;
|
||||
|
||||
retval = kenwood_safe_transaction(rig, "RM", ackbuf, sizeof(ackbuf), 7);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
sscanf(ackbuf, "RM%1d", &raw_value);
|
||||
|
||||
switch (raw_value)
|
||||
{
|
||||
case 1:
|
||||
val->i = RIG_METER_SWR;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
val->i = RIG_METER_COMP;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
val->i = RIG_METER_ALC;
|
||||
break;
|
||||
|
||||
default:
|
||||
val->i = RIG_METER_NONE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case RIG_LEVEL_SWR:
|
||||
case RIG_LEVEL_COMP_METER:
|
||||
case RIG_LEVEL_ALC:
|
||||
|
@ -1205,7 +1169,7 @@ static struct kenwood_slope_filter ts480_slope_filter_low[] =
|
|||
{ RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 8, 700 },
|
||||
{ RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 9, 800 },
|
||||
{ RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 10, 900 },
|
||||
{ RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 10, 1, 1000 },
|
||||
{ RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 11, 1000 },
|
||||
{ RIG_MODE_AM, 0, 0, 0 },
|
||||
{ RIG_MODE_AM, 0, 1, 100 },
|
||||
{ RIG_MODE_AM, 0, 2, 200 },
|
||||
|
@ -1247,6 +1211,7 @@ int ts480_init(RIG *rig)
|
|||
priv->ag_format = 2;
|
||||
priv->micgain_min = 0;
|
||||
priv->micgain_max = 100;
|
||||
priv->ps_cmd_wakeup_data = 1;
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
|
2157
rigs/kenwood/ts590.c
2157
rigs/kenwood/ts590.c
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue