Fix off by one error in tones for TS-590/890/990

Fix some rigs I found docs for - more needed
pull/1485/head
George Baltz N3GB 2024-01-22 15:00:56 -05:00
rodzic a703c77c2d
commit e42bb719b9
7 zmienionych plików z 20 dodań i 9 usunięć

Wyświetl plik

@ -4422,7 +4422,7 @@ int kenwood_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
} }
/* TODO: replace menu no 57 by a define */ /* TODO: replace menu no 57 by a define */
SNPRINTF(tonebuf, sizeof(tonebuf), "EX%03d%04d", 57, i + 1); SNPRINTF(tonebuf, sizeof(tonebuf), "EX%03d%04d", 57, i + kenwood_caps(rig)->tone_table_base);
RETURNFUNC(kenwood_transaction(rig, tonebuf, NULL, 0)); RETURNFUNC(kenwood_transaction(rig, tonebuf, NULL, 0));
} }
@ -4473,11 +4473,11 @@ int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone)
RETURNFUNC(-RIG_EINVAL); RETURNFUNC(-RIG_EINVAL);
} }
SNPRINTF(buf, sizeof(buf), "TN%c%02d", c, i + 1); SNPRINTF(buf, sizeof(buf), "TN%c%02d", c, i + kenwood_caps(rig)->tone_table_base);
} }
else else
{ {
SNPRINTF(buf, sizeof(buf), "TN%02d", i + 1); SNPRINTF(buf, sizeof(buf), "TN%02d", i + kenwood_caps(rig)->tone_table_base);
} }
RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0)); RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0));
@ -4554,7 +4554,7 @@ int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
tonebuf[2] = '\0'; tonebuf[2] = '\0';
tone_idx = atoi(tonebuf); tone_idx = atoi(tonebuf);
if (tone_idx == 0) if (tone_idx < kenwood_caps(rig)->tone_table_base)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: CTCSS tone is zero (%s)\n", rig_debug(RIG_DEBUG_ERR, "%s: CTCSS tone is zero (%s)\n",
__func__, tonebuf); __func__, tonebuf);
@ -4572,7 +4572,7 @@ int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
} }
} }
*tone = caps->ctcss_list[tone_idx - 1]; *tone = caps->ctcss_list[tone_idx] - kenwood_caps(rig)->tone_table_base;
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);
} }
@ -4623,11 +4623,11 @@ int kenwood_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
RETURNFUNC(-RIG_EINVAL); RETURNFUNC(-RIG_EINVAL);
} }
SNPRINTF(buf, sizeof(buf), "CN%c%02d", c, i + 1); SNPRINTF(buf, sizeof(buf), "CN%c%02d", c, i - kenwood_caps(rig)->tone_table_base);
} }
else else
{ {
SNPRINTF(buf, sizeof(buf), "CN%02d", i + 1); SNPRINTF(buf, sizeof(buf), "CN%02d", i - kenwood_caps(rig)->tone_table_base);
} }
RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0)); RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0));
@ -4692,7 +4692,7 @@ int kenwood_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
tone_idx = atoi(tonebuf + offs); tone_idx = atoi(tonebuf + offs);
if (tone_idx == 0) if (tone_idx < kenwood_caps(rig)->tone_table_base)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: CTCSS is zero (%s)\n", rig_debug(RIG_DEBUG_ERR, "%s: CTCSS is zero (%s)\n",
__func__, tonebuf); __func__, tonebuf);
@ -4710,7 +4710,7 @@ int kenwood_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
} }
} }
*tone = caps->ctcss_list[tone_idx - 1]; *tone = caps->ctcss_list[tone_idx] - kenwood_caps(rig)->tone_table_base;
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);
} }

Wyświetl plik

@ -137,6 +137,7 @@ struct kenwood_priv_caps
struct kenwood_slope_filter *slope_filter_high; /* Last entry should have value == -1 and frequency_hz == -1 */ struct kenwood_slope_filter *slope_filter_high; /* Last entry should have value == -1 and frequency_hz == -1 */
struct kenwood_slope_filter *slope_filter_low; /* Last entry should have value == -1 and frequency_hz == -1 */ struct kenwood_slope_filter *slope_filter_low; /* Last entry should have value == -1 and frequency_hz == -1 */
double swr; double swr;
int tone_table_base; /* Offset of first value in rigs tone tables, default=0 */
}; };
struct kenwood_priv_data struct kenwood_priv_data

Wyświetl plik

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -232,6 +233,7 @@ static struct kenwood_priv_caps ts2000_priv_caps =
.filter_width = ts2000_filter_width, .filter_width = ts2000_filter_width,
.slope_filter_high = ts2000_slope_filter_high, .slope_filter_high = ts2000_slope_filter_high,
.slope_filter_low = ts2000_slope_filter_low, .slope_filter_low = ts2000_slope_filter_low,
.tone_table_base = 1,
}; };
/* memory capabilities */ /* memory capabilities */

Wyświetl plik

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -43,6 +44,7 @@
static struct kenwood_priv_caps ts570_priv_caps = static struct kenwood_priv_caps ts570_priv_caps =
{ {
.cmdtrm = EOM_KEN, .cmdtrm = EOM_KEN,
.tone_table_base = 1,
}; };
static int ts570_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) static int ts570_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)

Wyświetl plik

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -53,6 +54,7 @@
static struct kenwood_priv_caps ts870s_priv_caps = static struct kenwood_priv_caps ts870s_priv_caps =
{ {
.cmdtrm = EOM_KEN, .cmdtrm = EOM_KEN,
.tone_table_base = 1,
}; };
/* only the ts870s and ts2000 support get_vfo with the 'FR;' command /* only the ts870s and ts2000 support get_vfo with the 'FR;' command

Wyświetl plik

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* /*
* Edited by Martin Ewing AA6E, March, 2012 * Edited by Martin Ewing AA6E, March, 2012
@ -52,6 +53,7 @@
static struct kenwood_priv_caps ts950_priv_caps = static struct kenwood_priv_caps ts950_priv_caps =
{ {
.cmdtrm = EOM_KEN, .cmdtrm = EOM_KEN,
.tone_table_base = 1,
}; };
/* /*

Wyświetl plik

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
*/ */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -120,6 +121,7 @@ static struct kenwood_priv_caps ts990s_priv_caps =
{ {
.cmdtrm = EOM_KEN, .cmdtrm = EOM_KEN,
.mode_table = ts990s_mode_table, .mode_table = ts990s_mode_table,
.tone_table_base = 0,
}; };