Revert "Start to normalize Icom cmd detection"

This reverts commit 1ade49f3d5.
pull/846/head
Mike Black W9MDB 2021-10-17 16:02:30 -05:00
rodzic 80f7378bf5
commit 569f21c7fe
2 zmienionych plików z 14 dodań i 19 usunięć

Wyświetl plik

@ -45,9 +45,8 @@
#include "frame.h" #include "frame.h"
#include "misc.h" #include "misc.h"
// we automatically determine availability of some commands // we automatically determine availability of the 1A 03 command
// defaults to UNK and then set when command is tested enum { ENUM_1A_03_UNK, ENUM_1A_03_YES, ENUM_1A_03_NO };
enum { ENUM_CMD_UNK, ENUM_CMD_WORKS, ENUM_CMD_FAILS };
static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo); static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo);
static int icom_set_default_vfo(RIG *rig); static int icom_set_default_vfo(RIG *rig);
@ -932,10 +931,7 @@ icom_rig_open(RIG *rig)
ENTERFUNC; ENTERFUNC;
priv->no_1a_03_cmd = ENUM_CMD_UNK; priv->no_1a_03_cmd = ENUM_1A_03_UNK;
priv->x25cmdfails = ENUM_CMD_UNK;
priv->x26cmdfails = ENUM_CMD_UNK;
rig_debug(RIG_DEBUG_VERBOSE, "%s: %s v%s\n", __func__, rig->caps->model_name, rig_debug(RIG_DEBUG_VERBOSE, "%s: %s v%s\n", __func__, rig->caps->model_name,
rig->caps->version); rig->caps->version);
@ -1494,7 +1490,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
// we'll use 0x25 command to get unselected frequency // we'll use 0x25 command to get unselected frequency
// we have to assume current_vfo is accurate to determine what "other" means // we have to assume current_vfo is accurate to determine what "other" means
if (priv->x25cmdfails == ENUM_CMD_WORKS) if (priv->x25cmdfails == 0)
{ {
int cmd2 = 0x25; int cmd2 = 0x25;
int subcmd2 = 0x00; int subcmd2 = 0x00;
@ -1783,10 +1779,10 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode)
if (RIG_MODEL_X108G == rig->caps->rig_model) if (RIG_MODEL_X108G == rig->caps->rig_model)
{ {
priv->no_1a_03_cmd = ENUM_CMD_FAILS; priv->no_1a_03_cmd = ENUM_1A_03_NO;
} }
if (priv->no_1a_03_cmd == ENUM_CMD_FAILS) if (priv->no_1a_03_cmd == ENUM_1A_03_NO)
{ {
return (0); return (0);
} }
@ -1796,8 +1792,8 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode)
if (-RIG_ERJCTED == retval) if (-RIG_ERJCTED == retval)
{ {
if (priv->no_1a_03_cmd == ENUM_CMD_UNK) { if (priv->no_1a_03_cmd == ENUM_1A_03_UNK) {
priv->no_1a_03_cmd = ENUM_CMD_FAILS; /* do not keep asking */ priv->no_1a_03_cmd = ENUM_1A_03_NO; /* do not keep asking */
return (RIG_OK); return (RIG_OK);
} }
else else
@ -1887,7 +1883,7 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width)
RETURNFUNC(-RIG_EINVAL); RETURNFUNC(-RIG_EINVAL);
} }
} }
if (priv->no_1a_03_cmd == ENUM_CMD_FAILS) RETURNFUNC(RIG_OK); // don't bother to try since it doesn't work if (priv->no_1a_03_cmd == ENUM_1A_03_NO) RETURNFUNC(RIG_OK); // don't bother to try since it doesn't work
if (mode & RIG_MODE_AM) if (mode & RIG_MODE_AM)
{ {
@ -1918,9 +1914,9 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width)
if (-RIG_ERJCTED == retval) if (-RIG_ERJCTED == retval)
{ {
if (priv->no_1a_03_cmd == ENUM_CMD_UNK) if (priv->no_1a_03_cmd == ENUM_1A_03_UNK)
{ {
priv->no_1a_03_cmd = ENUM_CMD_FAILS; /* do not keep asking */ priv->no_1a_03_cmd = ENUM_1A_03_NO; /* do not keep asking */
return (RIG_OK); return (RIG_OK);
} }
else else
@ -2008,7 +2004,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
int ack_len = sizeof(ackbuf); int ack_len = sizeof(ackbuf);
rmode_t icom_mode; rmode_t icom_mode;
rmode_t tmode; rmode_t tmode;
pbwidth_t twidth = 0; pbwidth_t twidth;
//struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv; //struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv;
unsigned char dm_sub_cmd = unsigned char dm_sub_cmd =
rig->caps->rig_model == RIG_MODEL_IC7200 ? 0x04 : S_MEM_DATA_MODE; rig->caps->rig_model == RIG_MODEL_IC7200 ? 0x04 : S_MEM_DATA_MODE;
@ -2091,7 +2087,6 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
unsigned char datamode[2]; unsigned char datamode[2];
unsigned char mode_icom; // Not used, we only need the width unsigned char mode_icom; // Not used, we only need the width
signed char width_icom; signed char width_icom;
struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv;
TRACE; TRACE;
@ -2115,7 +2110,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom); rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom);
if (filter_byte && priv->x26cmdfails == ENUM_CMD_WORKS) // then we need the filter width byte too if (filter_byte) // then we need the filter width byte too
{ {
TRACE; TRACE;

Wyświetl plik

@ -30,7 +30,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define BACKEND_VER "20211017" #define BACKEND_VER "20211015"
#define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B))
#define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00)