From 489ecf6aed5a66804a00a57d04c95ffbd4ccf947 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Thu, 18 Nov 2021 09:21:09 -0600 Subject: [PATCH 1/9] kenwood.c change to minimize mode setting if change not needed https://github.com/Hamlib/Hamlib/issues/872 --- rigs/kenwood/kenwood.c | 50 +++++++++++++++++++++++++++++++----------- rigs/kenwood/kenwood.h | 6 ++++- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 05e3919e4..6f48d67b4 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -2053,7 +2053,10 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) char kmode; char buf[6]; char data_mode = '0'; + char *data_cmd = "DA"; int err; + int datamode = 0; + int needdata; struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_caps *caps = kenwood_caps(rig); @@ -2149,12 +2152,6 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) pbwidth_t twidth; err = rig_get_mode(rig, vfo, &priv->curr_mode, &twidth); - // only change mode if needed - if (priv->curr_mode != mode) - { - snprintf(buf, sizeof(buf), "MD%c", c); - err = kenwood_transaction(rig, buf, NULL, 0); - } } if (err != RIG_OK) { RETURNFUNC(err); } @@ -2167,20 +2164,35 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) || RIG_MODE_RTTY == mode || RIG_MODE_RTTYR == mode)) { - char *data_cmd = "DA"; - if (RIG_IS_TS950S || RIG_IS_TS950SDX) { data_cmd = "DT"; } - /* supports DATA sub modes - see above */ - snprintf(buf, sizeof(buf), "%s%c", data_cmd, data_mode); - err = kenwood_transaction(rig, buf, NULL, 0); - - if (err != RIG_OK) { RETURNFUNC(err); } + datamode = 1; } } + rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_mode=%s, new_mode=%s\n", __func__, rig_strrmode(priv->curr_mode), rig_strrmode(mode)); + // only change mode if needed + if (priv->curr_mode != mode) + { + snprintf(buf, sizeof(buf), "MD%c", c); + err = kenwood_transaction(rig, buf, NULL, 0); + } + needdata = 0; + if ((vfo == RIG_VFO_A) && ((priv->datamodeA == 0 && datamode) || (priv->datamodeA == 1 && !datamode))) + needdata = 1; + if ((vfo == RIG_VFO_B) && ((priv->datamodeB == 0 && datamode) || (priv->datamodeB == 1 && !datamode))) + needdata = 1; + + if (needdata) + { + /* supports DATA sub modes - see above */ + snprintf(buf, sizeof(buf), "%s%c", data_cmd, data_mode); + err = kenwood_transaction(rig, buf, NULL, 0); + + if (err != RIG_OK) { RETURNFUNC(err); } + } if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); } @@ -2418,6 +2430,8 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) if ('1' == modebuf[2]) { + if (vfo == RIG_VFO_A) priv->datamodeA = 1; + else priv->datamodeB = 1; switch (*mode) { case RIG_MODE_USB: *mode = RIG_MODE_PKTUSB; break; @@ -2426,9 +2440,16 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) case RIG_MODE_FM: *mode = RIG_MODE_PKTFM; break; + case RIG_MODE_AM: *mode = RIG_MODE_PKTAM; break; + default: break; } } + else + { + if (vfo == RIG_VFO_A) priv->datamodeA = 0; + else priv->datamodeB = 0; + } } if (RIG_IS_TS480) @@ -2447,6 +2468,9 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { *width = rig_passband_normal(rig, *mode); } + + if (vfo == RIG_VFO_A) priv->modeA = *mode; + else priv->modeB = *mode; RETURNFUNC(RIG_OK); } diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index 8ecaed878..e31db932b 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -28,7 +28,7 @@ #include "token.h" #include "misc.h" -#define BACKEND_VER "20211109" +#define BACKEND_VER "20211118" #define EOM_KEN ';' #define EOM_TH '\r' @@ -166,6 +166,10 @@ struct kenwood_priv_data int is_k4hd; int no_id; // if true will not send ID; with every set command int opened; // true once rig_open is called to avoid setting VFOA every open call + rmode_t modeA; + rmode_t modeB; + int datamodeA; // datamode status from get_mode or set_mode + int datamodeB; // datamode status from get_mode or set_mode }; From 8c3e8fed284d404e59ed710f0fd2b4f336f85191 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Thu, 18 Nov 2021 10:42:58 -0600 Subject: [PATCH 2/9] Improved debug in rig_get_cache https://github.com/Hamlib/Hamlib/issues/872 --- src/rig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rig.c b/src/rig.c index c709b1857..7cdda73dd 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1810,8 +1810,8 @@ int rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms_freq, RETURNFUNC(-RIG_EINVAL); } - rig_debug(RIG_DEBUG_CACHE, "%s: vfo=%s, freq=%.0f\n", __func__, rig_strvfo(vfo), - (double)*freq); + rig_debug(RIG_DEBUG_CACHE, "%s: vfo=%s, freq=%.0f, mode=%s, width=%d\n", __func__, rig_strvfo(vfo), + (double)*freq, rig_strrmode(*mode), (int)*width); if (rig_need_debug(RIG_DEBUG_CACHE)) { From c229c2f52df383216e307bc0d76e8b81b0e431c1 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Thu, 18 Nov 2021 12:05:57 -0600 Subject: [PATCH 3/9] Add some debug to kenwood.c https://github.com/Hamlib/Hamlib/issues/872 --- rigs/kenwood/kenwood.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 6f48d67b4..55d160d3d 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -2092,6 +2092,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { /* emulations like PowerSDR and SmartSDR normally hijack the RTTY modes for SSB-DATA AFSK modes */ + rig_debug(RIG_DEBUG_VERBOSE, "%s: emulate=%d, HPSDR=%d, changing PKT mode to RTTY\n", __func__, priv->is_emulation, RIG_IS_HPSDR); if (RIG_MODE_PKTLSB == mode) { mode = RIG_MODE_RTTY; } if (RIG_MODE_PKTUSB == mode) { mode = RIG_MODE_RTTYR; } @@ -2413,6 +2414,7 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { /* emulations like PowerSDR and SmartSDR normally hijack the RTTY modes for SSB-DATA AFSK modes */ + rig_debug(RIG_DEBUG_VERBOSE, "%s: emulate=%d, HPSDR=%d, changing RTTY mode to PKT\n", __func__, priv->is_emulation, RIG_IS_HPSDR); if (RIG_MODE_RTTY == *mode) { *mode = RIG_MODE_PKTLSB; } if (RIG_MODE_RTTYR == *mode) { *mode = RIG_MODE_PKTUSB; } From f3dc90f8f5547731f9babb50635c3a12f8037cb1 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Thu, 18 Nov 2021 16:09:45 -0600 Subject: [PATCH 4/9] Show split result in kenwood_get_split_vfo_if https://github.com/Hamlib/Hamlib/issues/872 --- rigs/kenwood/kenwood.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 55d160d3d..2b29d7afa 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1518,8 +1518,8 @@ int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split, } priv->tx_vfo = *txvfo; - rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->tx_vfo=%s\n", __func__, - rig_strvfo(priv->tx_vfo)); + rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->tx_vfo=%s, split=%d\n", __func__, + rig_strvfo(priv->tx_vfo), *split); RETURNFUNC(RIG_OK); } From 383d97dee0685b167373a6e0eea81af0d40142b7 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Fri, 19 Nov 2021 00:04:00 -0600 Subject: [PATCH 5/9] Add update to rig->state.current_vfo in a couple of places https://github.com/Hamlib/Hamlib/issues/872 --- rigs/kenwood/kenwood.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 2b29d7afa..40572df83 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1057,7 +1057,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo) char vfo_function; struct kenwood_priv_data *priv = rig->state.priv; - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo)); /* Emulations do not need to set VFO since VFOB is a copy of VFOA @@ -1088,6 +1088,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo) break; case RIG_VFO_CURR: + rig->state.current_vfo = RIG_VFO_CURR; RETURNFUNC(RIG_OK); default: @@ -1149,6 +1150,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo) { RETURNFUNC(retval); } + rig->state.current_vfo = vfo; /* if FN command then there's no FT or FR */ /* If split mode on, the don't change TxVFO */ From 050826bb4486ce15b822a13a802732fb83029671 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Fri, 19 Nov 2021 14:16:27 -0600 Subject: [PATCH 6/9] Add send_voice_mem to ic7610.c --- rigs/icom/ic7610.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rigs/icom/ic7610.c b/rigs/icom/ic7610.c index 32940e9a8..3cfeb1bec 100644 --- a/rigs/icom/ic7610.c +++ b/rigs/icom/ic7610.c @@ -248,7 +248,7 @@ const struct rig_caps ic7610_caps = RIG_MODEL(RIG_MODEL_IC7610), .model_name = "IC-7610", .mfg_name = "Icom", - .version = BACKEND_VER ".3", + .version = BACKEND_VER ".4", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -477,5 +477,6 @@ const struct rig_caps ic7610_caps = .get_powerstat = icom_get_powerstat, .send_morse = icom_send_morse, .stop_morse = icom_stop_morse, - .wait_morse = rig_wait_morse + .wait_morse = rig_wait_morse, + .send_voice_mem = rig_send_voice_mem }; From 4b3bbabc5da31df483ff1c70f1102ef5435e57bf Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Fri, 19 Nov 2021 16:19:18 -0600 Subject: [PATCH 7/9] Fix rig_set_split problem on Kenwood rigs https://github.com/Hamlib/Hamlib/issues/872 --- rigs/dummy/netrigctl.c | 13 +++++++++++-- src/rig.c | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 9f7727b5c..e94a907a7 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -49,6 +49,8 @@ struct netrigctl_priv_data { vfo_t vfo_curr; int rigctld_vfo_mode; + vfo_t rx_vfo; + vfo_t tx_vfo; }; int netrigctl_get_vfo_mode(RIG *rig) @@ -120,6 +122,8 @@ static int netrigctl_vfostr(RIG *rig, char *vfostr, int len, vfo_t vfo) if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; } } + else if (vfo == RIG_VFO_RX) vfo = priv->rx_vfo; + else if (vfo == RIG_VFO_TX) vfo = priv->tx_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, rig->state.vfo_opt); @@ -262,6 +266,8 @@ static int netrigctl_open(RIG *rig) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); priv = (struct netrigctl_priv_data *)rig->state.priv; + priv->rx_vfo = RIG_VFO_A; + priv->tx_vfo = RIG_VFO_B; len = sprintf(cmd, "\\chk_vfo\n"); ret = netrigctl_transaction(rig, cmd, len, buf); @@ -621,7 +627,10 @@ static int netrigctl_open(RIG *rig) rs->mode_list |= rs->tx_range_list[i].modes; rs->vfo_list |= rs->tx_range_list[i].vfo; } - if (rs->vfo_list == 0) rs->vfo_list = RIG_VFO_A|RIG_VFO_B; + if (rs->vfo_list == 0) { + rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo_list empty, defaulting to A/B\n", __func__); + rs->vfo_list = RIG_VFO_A|RIG_VFO_B; + } if (prot_ver == 0) { return RIG_OK; } @@ -2570,7 +2579,7 @@ struct rig_caps netrigctl_caps = RIG_MODEL(RIG_MODEL_NETRIGCTL), .model_name = "NET rigctl", .mfg_name = "Hamlib", - .version = "20211107.0", + .version = "20211118.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, diff --git a/src/rig.c b/src/rig.c index 7cdda73dd..b8c90e20e 100644 --- a/src/rig.c +++ b/src/rig.c @@ -4266,7 +4266,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, { const struct rig_caps *caps; int retcode, rc2; - vfo_t curr_vfo, tx_vfo; + vfo_t curr_vfo, tx_vfo, rx_vfo; ELAPSED1; ENTERFUNC; @@ -4303,12 +4303,15 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, /* Use previously setup TxVFO */ if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) { + TRACE; tx_vfo = rig->state.tx_vfo; } else { + TRACE; tx_vfo = vfo; } + rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s, tx_vfo=%s\n", __func__, rig_strvfo(curr_vfo), rig_strvfo(tx_vfo)); if (caps->set_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)) { @@ -4320,7 +4323,13 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, // some rigs exhibit undesirable flashing when swapping vfos in split // so we turn it off, do our thing, and turn split back on - rig_set_split_vfo(rig,RIG_VFO_CURR, RIG_SPLIT_OFF, RIG_VFO_CURR); + rx_vfo = RIG_VFO_A; + if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_B) rx_vfo = RIG_VFO_A; + else if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_A) rx_vfo = RIG_VFO_B; + else if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_MAIN) rx_vfo = RIG_VFO_SUB; + else if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_SUB) rx_vfo = RIG_VFO_MAIN; + rig_debug(RIG_DEBUG_VERBOSE, "%s: rx_vfo=%s, tx_vfo=%s\n", __func__, rig_strvfo(rx_vfo), rig_strvfo(tx_vfo)); + rig_set_split_vfo(rig,rx_vfo, RIG_SPLIT_OFF, rx_vfo); if (caps->set_vfo) { TRACE; @@ -4360,7 +4369,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, if (caps->set_vfo) { TRACE; - rc2 = caps->set_vfo(rig, curr_vfo); + rc2 = caps->set_vfo(rig, rx_vfo); } else { @@ -4372,7 +4381,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, /* return the first error code */ retcode = rc2; } - rig_set_split_vfo(rig,RIG_VFO_CURR, RIG_SPLIT_ON, RIG_VFO_CURR); + rig_set_split_vfo(rig,rx_vfo, RIG_SPLIT_ON, tx_vfo); ELAPSED2; RETURNFUNC(retcode); From 12f7bb4d8f81da856e298e9e534d149b8b4e72a5 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Sat, 20 Nov 2021 11:52:39 -0600 Subject: [PATCH 8/9] Change getnameinfo to return numeric IP instead of hostname to avoid Windows long delay on reverse lookups https://github.com/Hamlib/Hamlib/issues/873 --- tests/ampctld.c | 4 ++-- tests/rigctld.c | 4 ++-- tests/rotctld.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/ampctld.c b/tests/ampctld.c index 12b6e2a54..208d0b5f4 100644 --- a/tests/ampctld.c +++ b/tests/ampctld.c @@ -568,7 +568,7 @@ int main(int argc, char *argv[]) sizeof(host), serv, sizeof(serv), - NI_NOFQDN)) + NI_NUMERICHOST|NI_NUMERICSERV)) < 0) { @@ -674,7 +674,7 @@ void *handle_socket(void *arg) sizeof(host), serv, sizeof(serv), - NI_NOFQDN)) + NI_NUMERICHOST|NI_NUMERICSERV)) < 0) { diff --git a/tests/rigctld.c b/tests/rigctld.c index 391106295..6c956e75f 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -963,7 +963,7 @@ int main(int argc, char *argv[]) sizeof(host), serv, sizeof(serv), - NI_NOFQDN)) + NI_NUMERICHOST|NI_NUMERICSERV)) < 0) { rig_debug(RIG_DEBUG_WARN, @@ -1201,7 +1201,7 @@ void *handle_socket(void *arg) sizeof(host), serv, sizeof(serv), - NI_NOFQDN)) + NI_NUMERICHOST|NI_NUMERICSERV)) < 0) { diff --git a/tests/rotctld.c b/tests/rotctld.c index 19b12ce3b..ecbca0e6a 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -598,7 +598,7 @@ int main(int argc, char *argv[]) sizeof(host), serv, sizeof(serv), - NI_NOFQDN)) + NI_NUMERICHOST|NI_NUMERICSERV)) < 0) { @@ -711,7 +711,7 @@ void *handle_socket(void *arg) sizeof(host), serv, sizeof(serv), - NI_NOFQDN)) + NI_NUMERICHOST|NI_NUMERICSERV)) < 0) { From f71712b23b6daeaea97c0e1995c7fee4d1084410 Mon Sep 17 00:00:00 2001 From: Mikael Nousiainen Date: Sat, 20 Nov 2021 21:28:26 +0200 Subject: [PATCH 9/9] Add contour, audio peak filter and keyer functions/levels for many Yaesu rigs --- extra/kylix/hamlib_rigapi.pas | 2 +- include/hamlib/rig.h | 2 +- rigs/yaesu/ft1200.c | 65 +++- rigs/yaesu/ft2000.c | 47 ++- rigs/yaesu/ft2000.h | 2 +- rigs/yaesu/ft3000.c | 65 +++- rigs/yaesu/ft5000.c | 56 ++- rigs/yaesu/ft5000.h | 2 +- rigs/yaesu/ft891.c | 78 +++++ rigs/yaesu/ft891.h | 2 +- rigs/yaesu/ft991.c | 78 +++++ rigs/yaesu/ft991.h | 2 +- rigs/yaesu/ftdx10.c | 65 +++- rigs/yaesu/ftdx10.h | 2 +- rigs/yaesu/ftdx101.c | 65 +++- rigs/yaesu/ftdx101.h | 2 +- rigs/yaesu/newcat.c | 618 ++++++++++++++++++++++++++++++++++ rigs/yaesu/newcat.h | 7 + 18 files changed, 1146 insertions(+), 14 deletions(-) diff --git a/extra/kylix/hamlib_rigapi.pas b/extra/kylix/hamlib_rigapi.pas index 2007de8e8..2437c2add 100644 --- a/extra/kylix/hamlib_rigapi.pas +++ b/extra/kylix/hamlib_rigapi.pas @@ -494,7 +494,7 @@ const RIG_FUNC_ANF = (1 shl 8); {* Automatic Notch Filter (DSP); *} RIG_FUNC_NR = (1 shl 9); {* Noise Reduction (DSP); *} RIG_FUNC_AIP = (1 shl 10); {* AIP (Kenwood); *} - RIG_FUNC_APF = (1 shl 11); {* Auto Passband Filter *} + RIG_FUNC_APF = (1 shl 11); {* Audio Peak Filter *} RIG_FUNC_MON = (1 shl 12); {* Monitor transmitted signal, != rev *} RIG_FUNC_MN = (1 shl 13); {* Manual Notch (Icom); *} RIG_FUNC_RF = (1 shl 14); {* RTTY Filter (Icom); TNX AD7AI -- N0NB *} diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index f58dfa387..9c8318ad5 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -1088,7 +1088,7 @@ typedef uint64_t setting_t; #define RIG_FUNC_ANF CONSTANT_64BIT_FLAG (8) /*!< \c ANF -- Automatic Notch Filter (DSP) */ #define RIG_FUNC_NR CONSTANT_64BIT_FLAG (9) /*!< \c NR -- Noise Reduction (DSP) */ #define RIG_FUNC_AIP CONSTANT_64BIT_FLAG (10) /*!< \c AIP -- RF pre-amp (AIP on Kenwood, IPO on Yaesu, etc.) */ -#define RIG_FUNC_APF CONSTANT_64BIT_FLAG (11) /*!< \c APF -- Auto Passband/Audio Peak Filter */ +#define RIG_FUNC_APF CONSTANT_64BIT_FLAG (11) /*!< \c APF -- Audio Peak Filter */ #define RIG_FUNC_MON CONSTANT_64BIT_FLAG (12) /*!< \c MON -- Monitor transmitted signal */ #define RIG_FUNC_MN CONSTANT_64BIT_FLAG (13) /*!< \c MN -- Manual Notch */ #define RIG_FUNC_RF CONSTANT_64BIT_FLAG (14) /*!< \c RF -- RTTY Filter */ diff --git a/rigs/yaesu/ft1200.c b/rigs/yaesu/ft1200.c index 69b72d765..06e43e361 100644 --- a/rigs/yaesu/ft1200.c +++ b/rigs/yaesu/ft1200.c @@ -73,12 +73,75 @@ const struct confparams ftdx1200_ext_levels[] = } } }, + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_APF_FREQ, + "APF_FREQ", + "APF frequency", + "Audio peak filter frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -250, .max = 250, .step = 10 } }, + }, + { + TOK_APF_WIDTH, + "APF_WIDTH", + "APF width", + "Audio peak filter width", + NULL, + RIG_CONF_COMBO, + { .c = { .combostr = { "Narrow", "Medium", "Wide", NULL } } }, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 100, .max = 4000, .step = 100 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, { RIG_CONF_END, NULL, } }; int ftdx1200_ext_tokens[] = { - TOK_ROOFING_FILTER, TOK_BACKEND_NONE + TOK_ROOFING_FILTER, TOK_KEYER, TOK_APF_FREQ, TOK_APF_WIDTH, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE }; /* diff --git a/rigs/yaesu/ft2000.c b/rigs/yaesu/ft2000.c index 07501ae3a..a438e4557 100644 --- a/rigs/yaesu/ft2000.c +++ b/rigs/yaesu/ft2000.c @@ -74,12 +74,57 @@ const struct confparams ft2000_ext_levels[] = } } }, + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 100, .max = 4000, .step = 100 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, { RIG_CONF_END, NULL, } }; int ft2000_ext_tokens[] = { - TOK_ROOFING_FILTER, TOK_BACKEND_NONE + TOK_ROOFING_FILTER, TOK_KEYER, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE }; diff --git a/rigs/yaesu/ft2000.h b/rigs/yaesu/ft2000.h index b09da65e1..607360ae8 100644 --- a/rigs/yaesu/ft2000.h +++ b/rigs/yaesu/ft2000.h @@ -64,7 +64,7 @@ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ RIG_FUNC_RIT|RIG_FUNC_XIT|\ - RIG_FUNC_TUNER) + RIG_FUNC_TUNER|RIG_FUNC_APF) #define FT2000_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ diff --git a/rigs/yaesu/ft3000.c b/rigs/yaesu/ft3000.c index ab047f921..8a5e5859e 100644 --- a/rigs/yaesu/ft3000.c +++ b/rigs/yaesu/ft3000.c @@ -77,12 +77,75 @@ const struct confparams ftdx3000_ext_levels[] = } } }, + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_APF_FREQ, + "APF_FREQ", + "APF frequency", + "Audio peak filter frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -250, .max = 250, .step = 10 } }, + }, + { + TOK_APF_WIDTH, + "APF_WIDTH", + "APF width", + "Audio peak filter width", + NULL, + RIG_CONF_COMBO, + { .c = { .combostr = { "Narrow", "Medium", "Wide", NULL } } }, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 100, .max = 4000, .step = 100 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, { RIG_CONF_END, NULL, } }; int ftdx3000_ext_tokens[] = { - TOK_ROOFING_FILTER, TOK_BACKEND_NONE + TOK_ROOFING_FILTER, TOK_KEYER, TOK_APF_FREQ, TOK_APF_WIDTH, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE }; int ft3000_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) diff --git a/rigs/yaesu/ft5000.c b/rigs/yaesu/ft5000.c index a9a27ff29..3faa0805d 100644 --- a/rigs/yaesu/ft5000.c +++ b/rigs/yaesu/ft5000.c @@ -75,12 +75,66 @@ const struct confparams ftdx5000_ext_levels[] = } } }, + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_APF_WIDTH, + "APF_WIDTH", + "APF width", + "Audio peak filter width", + NULL, + RIG_CONF_COMBO, + { .c = { .combostr = { "S. Narrow", "Narrow", "Medium", "Wide", NULL } } }, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 100, .max = 4000, .step = 100 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, { RIG_CONF_END, NULL, } }; int ftdx5000_ext_tokens[] = { - TOK_ROOFING_FILTER, TOK_BACKEND_NONE + TOK_ROOFING_FILTER, TOK_KEYER, TOK_APF_WIDTH, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE }; const struct rig_caps ftdx5000_caps = diff --git a/rigs/yaesu/ft5000.h b/rigs/yaesu/ft5000.h index 7aba65cc7..b7524447d 100644 --- a/rigs/yaesu/ft5000.h +++ b/rigs/yaesu/ft5000.h @@ -66,7 +66,7 @@ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ RIG_FUNC_RIT|RIG_FUNC_XIT|\ - RIG_FUNC_TUNER) + RIG_FUNC_TUNER|RIG_FUNC_APF) /* TBC */ #define FTDX5000_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ diff --git a/rigs/yaesu/ft891.c b/rigs/yaesu/ft891.c index 2562d1b7d..0517a2c80 100644 --- a/rigs/yaesu/ft891.c +++ b/rigs/yaesu/ft891.c @@ -50,6 +50,79 @@ static int ft891_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t static int ft891_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft891_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); +const struct confparams ft891_ext_levels[] = +{ + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_APF_FREQ, + "APF_FREQ", + "APF frequency", + "Audio peak filter frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -250, .max = 250, .step = 10 } }, + }, + { + TOK_APF_WIDTH, + "APF_WIDTH", + "APF width", + "Audio peak filter width", + NULL, + RIG_CONF_COMBO, + { .c = { .combostr = { "Narrow", "Medium", "Wide", NULL } } }, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 10, .max = 3200, .step = 1 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, + { RIG_CONF_END, NULL, } +}; + +int ft891_ext_tokens[] = +{ + TOK_KEYER, TOK_APF_FREQ, TOK_APF_WIDTH, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE +}; + /* * FT-891 rig capabilities */ @@ -190,6 +263,9 @@ const struct rig_caps ft891_caps = RIG_FLT_END, }, + .ext_tokens = ft891_ext_tokens, + .extlevels = ft891_ext_levels, + .priv = NULL, /* private data FIXME: */ .rig_init = ft891_init, @@ -237,6 +313,8 @@ const struct rig_caps ft891_caps = .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, .get_channel = newcat_get_channel, + .set_ext_level = newcat_set_ext_level, + .get_ext_level = newcat_get_ext_level, .send_morse = newcat_send_morse, }; diff --git a/rigs/yaesu/ft891.h b/rigs/yaesu/ft891.h index e0541e1d2..7f3909ea8 100644 --- a/rigs/yaesu/ft891.h +++ b/rigs/yaesu/ft891.h @@ -62,7 +62,7 @@ #define FT891_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ - RIG_FUNC_TUNER) + RIG_FUNC_TUNER|RIG_FUNC_APF) #define FT891_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ diff --git a/rigs/yaesu/ft991.c b/rigs/yaesu/ft991.c index c0fe7f35c..c5c615da7 100644 --- a/rigs/yaesu/ft991.c +++ b/rigs/yaesu/ft991.c @@ -62,6 +62,79 @@ static int ft991_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); static int ft991_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code); static int ft991_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code); +const struct confparams ft991_ext_levels[] = +{ + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_APF_FREQ, + "APF_FREQ", + "APF frequency", + "Audio peak filter frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -250, .max = 250, .step = 10 } }, + }, + { + TOK_APF_WIDTH, + "APF_WIDTH", + "APF width", + "Audio peak filter width", + NULL, + RIG_CONF_COMBO, + { .c = { .combostr = { "Narrow", "Medium", "Wide", NULL } } }, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 10, .max = 3200, .step = 1 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, + { RIG_CONF_END, NULL, } +}; + +int ft991_ext_tokens[] = +{ + TOK_KEYER, TOK_APF_FREQ, TOK_APF_WIDTH, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE +}; + /* * FT-991 rig capabilities */ @@ -194,6 +267,9 @@ const struct rig_caps ft991_caps = RIG_FLT_END, }, + .ext_tokens = ft991_ext_tokens, + .extlevels = ft991_ext_levels, + .priv = NULL, /* private data FIXME: */ .rig_init = ft991_init, @@ -249,6 +325,8 @@ const struct rig_caps ft991_caps = .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, .get_channel = newcat_get_channel, + .set_ext_level = newcat_set_ext_level, + .get_ext_level = newcat_get_ext_level, .send_morse = newcat_send_morse, .send_voice_mem = newcat_send_voice_mem, }; diff --git a/rigs/yaesu/ft991.h b/rigs/yaesu/ft991.h index f100fe4e3..3a0438a18 100644 --- a/rigs/yaesu/ft991.h +++ b/rigs/yaesu/ft991.h @@ -65,7 +65,7 @@ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ RIG_FUNC_RIT|RIG_FUNC_XIT|\ - RIG_FUNC_TUNER) + RIG_FUNC_TUNER|RIG_FUNC_APF) #define FT991_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ diff --git a/rigs/yaesu/ftdx10.c b/rigs/yaesu/ftdx10.c index baadf6387..bc3d6542f 100644 --- a/rigs/yaesu/ftdx10.c +++ b/rigs/yaesu/ftdx10.c @@ -63,12 +63,75 @@ const struct confparams ftdx10_ext_levels[] = RIG_CONF_COMBO, { .c = { .combostr = { "AUTO", "12 kHz", "3 kHz", "500 Hz", "300 Hz (optional)", NULL } } } }, + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_APF_FREQ, + "APF_FREQ", + "APF frequency", + "Audio peak filter frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -250, .max = 250, .step = 10 } }, + }, + { + TOK_APF_WIDTH, + "APF_WIDTH", + "APF width", + "Audio peak filter width", + NULL, + RIG_CONF_COMBO, + { .c = { .combostr = { "Narrow", "Medium", "Wide", NULL } } }, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 10, .max = 3200, .step = 1 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, { RIG_CONF_END, NULL, } }; int ftdx10_ext_tokens[] = { - TOK_ROOFING_FILTER, TOK_BACKEND_NONE + TOK_ROOFING_FILTER, TOK_KEYER, TOK_APF_FREQ, TOK_APF_WIDTH, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE }; const struct rig_caps ftdx10_caps = diff --git a/rigs/yaesu/ftdx10.h b/rigs/yaesu/ftdx10.h index 7863efd24..3db0bd4ba 100644 --- a/rigs/yaesu/ftdx10.h +++ b/rigs/yaesu/ftdx10.h @@ -65,7 +65,7 @@ #define FTDX10_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ - RIG_FUNC_RIT|RIG_FUNC_XIT|RIG_FUNC_TUNER) + RIG_FUNC_RIT|RIG_FUNC_XIT|RIG_FUNC_TUNER|RIG_FUNC_APF) /* TBC */ #define FTDX10_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ diff --git a/rigs/yaesu/ftdx101.c b/rigs/yaesu/ftdx101.c index f5a1af47b..db9fdd7aa 100644 --- a/rigs/yaesu/ftdx101.c +++ b/rigs/yaesu/ftdx101.c @@ -63,12 +63,75 @@ const struct confparams ftdx101d_ext_levels[] = RIG_CONF_COMBO, { .c = { .combostr = { "AUTO", "12 kHz", "3 kHz", "1.2 kHz (optional)", "600 Hz", "300 Hz (optional)", NULL } } } }, + { + TOK_KEYER, + "KEYER", + "Keyer", + "Keyer on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_APF_FREQ, + "APF_FREQ", + "APF frequency", + "Audio peak filter frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -250, .max = 250, .step = 10 } }, + }, + { + TOK_APF_WIDTH, + "APF_WIDTH", + "APF width", + "Audio peak filter width", + NULL, + RIG_CONF_COMBO, + { .c = { .combostr = { "Narrow", "Medium", "Wide", NULL } } }, + }, + { + TOK_CONTOUR, + "CONTOUR", + "Contour", + "Contour on/off", + NULL, + RIG_CONF_CHECKBUTTON, + }, + { + TOK_CONTOUR_FREQ, + "CONTOUR_FREQ", + "Contour frequency", + "Contour frequency", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 10, .max = 3200, .step = 1 } }, + }, + { + TOK_CONTOUR_LEVEL, + "CONTOUR_LEVEL", + "Contour level", + "Contour level (dB)", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = -40, .max = 20, .step = 1 } }, + }, + { + TOK_CONTOUR_WIDTH, + "CONTOUR_WIDTH", + "Contour width", + "Contour width", + NULL, + RIG_CONF_NUMERIC, + { .n = { .min = 1, .max = 11, .step = 1 } }, + }, { RIG_CONF_END, NULL, } }; int ftdx101d_ext_tokens[] = { - TOK_ROOFING_FILTER, TOK_BACKEND_NONE + TOK_ROOFING_FILTER, TOK_KEYER, TOK_APF_FREQ, TOK_APF_WIDTH, + TOK_CONTOUR, TOK_CONTOUR_FREQ, TOK_CONTOUR_LEVEL, TOK_CONTOUR_WIDTH, + TOK_BACKEND_NONE }; const struct rig_caps ftdx101d_caps = diff --git a/rigs/yaesu/ftdx101.h b/rigs/yaesu/ftdx101.h index de63cc6f1..ce4c5971d 100644 --- a/rigs/yaesu/ftdx101.h +++ b/rigs/yaesu/ftdx101.h @@ -64,7 +64,7 @@ #define FTDX101_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\ - RIG_FUNC_RIT|RIG_FUNC_XIT|RIG_FUNC_TUNER) + RIG_FUNC_RIT|RIG_FUNC_XIT|RIG_FUNC_TUNER|RIG_FUNC_APF) /* TBC */ #define FTDX101_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 10d1dfa75..87090d94c 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -391,6 +391,18 @@ static int set_roofing_filter(RIG *rig, vfo_t vfo, int index); static int set_roofing_filter_for_width(RIG *rig, vfo_t vfo, int width); static int get_roofing_filter(RIG *rig, vfo_t vfo, struct newcat_roofing_filter **roofing_filter); +static int newcat_set_apf_frequency(RIG *rig, vfo_t vfo, int freq); +static int newcat_get_apf_frequency(RIG *rig, vfo_t vfo, int *freq); +static int newcat_set_apf_width(RIG *rig, vfo_t vfo, int choice); +static int newcat_get_apf_width(RIG *rig, vfo_t vfo, int *choice); +static int newcat_set_contour(RIG *rig, vfo_t vfo, int status); +static int newcat_get_contour(RIG *rig, vfo_t vfo, int *status); +static int newcat_set_contour_frequency(RIG *rig, vfo_t vfo, int freq); +static int newcat_get_contour_frequency(RIG *rig, vfo_t vfo, int *freq); +static int newcat_set_contour_level(RIG *rig, vfo_t vfo, int level); +static int newcat_get_contour_level(RIG *rig, vfo_t vfo, int *level); +static int newcat_set_contour_width(RIG *rig, vfo_t vfo, int width); +static int newcat_get_contour_width(RIG *rig, vfo_t vfo, int *width); static ncboolean newcat_valid_command(RIG *rig, char const *const command); /* @@ -5575,6 +5587,27 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) cat_term); break; + case RIG_FUNC_APF: + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + + if (is_ftdx101d || is_ftdx101mp) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c2%04d%c", main_sub_vfo, status ? 1 : 0, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%04d%c", status ? 1 : 0, cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%02d%c", main_sub_vfo, status ? 2 : 0, cat_term); + } else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%02d%c", status ? 2 : 0, cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + break; + default: RETURNFUNC(-RIG_EINVAL); } @@ -5796,6 +5829,25 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "XT%c", cat_term); break; + case RIG_FUNC_APF: + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c2%c", main_sub_vfo, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%c", cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo, cat_term); + } else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%c", cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + break; default: RETURNFUNC(-RIG_EINVAL); } @@ -5877,6 +5929,21 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) *status = (retfunc[0] == '1') ? 1 : 0; break; + case RIG_FUNC_APF: + if (is_ftdx101d || is_ftdx101mp) { + *status = (retfunc[last_char_index] == '1') ? 1 : 0; + } else if (is_ftdx10 || is_ft991 || is_ft891) { + *status = (retfunc[last_char_index] == '1') ? 1 : 0; + } else if (is_ftdx5000) { + *status = (retfunc[last_char_index] == '2') ? 1 : 0; + } else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) { + *status = (retfunc[last_char_index] == '2') ? 1 : 0; + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + break; + default: RETURNFUNC(-RIG_EINVAL); } @@ -5903,6 +5970,8 @@ int newcat_get_parm(RIG *rig, setting_t parm, value_t *val) int newcat_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) { + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + ENTERFUNC; switch (token) @@ -5910,6 +5979,35 @@ int newcat_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) case TOK_ROOFING_FILTER: RETURNFUNC(set_roofing_filter(rig, vfo, val.i)); + case TOK_KEYER: + if (!newcat_valid_command(rig, "ML")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KR%d%c", val.i ? 1 : 0, + cat_term); + + RETURNFUNC(newcat_set_cmd(rig)); + + case TOK_APF_FREQ: + RETURNFUNC(newcat_set_apf_frequency(rig, vfo, val.f)); + + case TOK_APF_WIDTH: + RETURNFUNC(newcat_set_apf_width(rig, vfo, val.i)); + + case TOK_CONTOUR: + RETURNFUNC(newcat_set_contour(rig, vfo, val.i)); + + case TOK_CONTOUR_FREQ: + RETURNFUNC(newcat_set_contour_frequency(rig, vfo, val.f)); + + case TOK_CONTOUR_LEVEL: + RETURNFUNC(newcat_set_contour_level(rig, vfo, val.f)); + + case TOK_CONTOUR_WIDTH: + RETURNFUNC(newcat_set_contour_width(rig, vfo, val.f)); + default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported ext level %s\n", __func__, rig_strlevel(token)); @@ -5919,7 +6017,10 @@ int newcat_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) int newcat_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) { + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + char *result; int retval; + int value; ENTERFUNC; @@ -5939,6 +6040,95 @@ int newcat_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) break; } + case TOK_KEYER: + if (!newcat_valid_command(rig, "KR")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KR%c", cat_term); + + retval = newcat_get_cmd(rig); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + /* skip command */ + result = priv->ret_data + strlen(priv->cmd_str) - 1; + /* chop term */ + priv->ret_data[strlen(priv->ret_data) - 1] = '\0'; + + val->i = result[0] == '0' ? 0 : 1; + break; + + case TOK_APF_FREQ: + retval = newcat_get_apf_frequency(rig, vfo, &value); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + val->f = value; + break; + + case TOK_APF_WIDTH: + retval = newcat_get_apf_width(rig, vfo, &value); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + val->i = value; + break; + + case TOK_CONTOUR: + retval = newcat_get_contour(rig, vfo, &value); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + val->i = value; + break; + + case TOK_CONTOUR_WIDTH: + retval = newcat_get_contour_width(rig, vfo, &value); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + val->f = value; + break; + + case TOK_CONTOUR_FREQ: + retval = newcat_get_contour_frequency(rig, vfo, &value); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + val->f = value; + break; + + case TOK_CONTOUR_LEVEL: + retval = newcat_get_contour_level(rig, vfo, &value); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + val->f = value; + break; + default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported ext level %s\n", __func__, rig_strlevel(token)); @@ -10214,3 +10404,431 @@ int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch) RETURNFUNC(newcat_set_cmd(rig)); } +static int newcat_set_apf_frequency(RIG *rig, vfo_t vfo, int freq) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; + + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + // Range seems to be -250..250 Hz in 10 Hz steps + if (is_ftdx101d || is_ftdx101mp) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c3%04d%c", main_sub_vfo, (freq + 250) / 10, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO03%04d%c", (freq + 250) / 10, cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%02d%c", (freq + 250) / 10, cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + RETURNFUNC(newcat_set_cmd(rig)); +} + +static int newcat_get_apf_frequency(RIG *rig, vfo_t vfo, int *freq) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; + int err; + int ret_data_len; + char *ret_data; + + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c3%c", main_sub_vfo, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO03%c", cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO02%c", cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + if ((err = newcat_get_cmd(rig)) != RIG_OK) + { + RETURNFUNC(err); + } + + ret_data_len = strlen(priv->ret_data); + + /* skip command */ + ret_data = priv->ret_data + strlen(priv->cmd_str) - 1; + rig_debug(RIG_DEBUG_TRACE, "%s: ret_data='%s'\n", __func__, ret_data); + /* chop term */ + priv->ret_data[ret_data_len - 1] = '\0'; + + int raw_value = atoi(ret_data); + + // Range seems to be -250..250 Hz in 10 Hz steps + *freq = raw_value * 10 - 250; + + RETURNFUNC(RIG_OK); +} + +static int newcat_set_apf_width(RIG *rig, vfo_t vfo, int choice) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + + if (!newcat_valid_command(rig, "EX")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp || is_ftdx10) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030201%d%c", choice, cat_term); + } else if (is_ft991) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX111%d%c", choice, cat_term); + } else if (is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1201%d%c", choice, cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%d%c", choice, cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX107%d%c", choice, cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + RETURNFUNC(newcat_set_cmd(rig)); +} + +static int newcat_get_apf_width(RIG *rig, vfo_t vfo, int *choice) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + int err; + int ret_data_len; + char *ret_data; + + if (!newcat_valid_command(rig, "EX")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp || is_ftdx10) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030201%c", cat_term); + } else if (is_ft991) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX111%c", cat_term); + } else if (is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1201%c", cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%c", cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX107%c", cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + if ((err = newcat_get_cmd(rig)) != RIG_OK) + { + RETURNFUNC(err); + } + + ret_data_len = strlen(priv->ret_data); + + /* skip command */ + ret_data = priv->ret_data + strlen(priv->cmd_str) - 1; + rig_debug(RIG_DEBUG_TRACE, "%s: ret_data='%s'\n", __func__, ret_data); + /* chop term */ + priv->ret_data[ret_data_len - 1] = '\0'; + + *choice = atoi(ret_data); + + RETURNFUNC(RIG_OK); +} + +static int newcat_set_contour(RIG *rig, vfo_t vfo, int status) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; + + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%04d%c", main_sub_vfo, status ? 1 : 0, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%04d%c", status ? 1 : 0, cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%02d%c", main_sub_vfo, status ? 1 : 0, cat_term); + } else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%02d%c", status ? 1 : 0, cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + RETURNFUNC(newcat_set_cmd(rig)); +} + +static int newcat_get_contour(RIG *rig, vfo_t vfo, int *status) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; + int err; + int ret_data_len; + char *ret_data; + int last_char_index; + + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%c", cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c0%c", main_sub_vfo, cat_term); + } else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO00%c", cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + if ((err = newcat_get_cmd(rig)) != RIG_OK) + { + RETURNFUNC(err); + } + + ret_data_len = strlen(priv->ret_data); + + /* skip command */ + ret_data = priv->ret_data + strlen(priv->cmd_str) - 1; + rig_debug(RIG_DEBUG_TRACE, "%s: ret_data='%s'\n", __func__, ret_data); + /* chop term */ + priv->ret_data[ret_data_len - 1] = '\0'; + + last_char_index = strlen(ret_data) - 1; + + *status = (ret_data[last_char_index] == '1') ? 1 : 0; + + RETURNFUNC(RIG_OK); +} + +static int newcat_set_contour_frequency(RIG *rig, vfo_t vfo, int freq) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; + + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp) { + // Range is 10..3200 Hz + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%04d%c", main_sub_vfo, freq, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + // Range is 10..3200 Hz + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%04d%c", freq, cat_term); + } else if (is_ftdx5000) { + // Range is 100..4000 Hz in 100 Hz steps + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%01d%c", main_sub_vfo, freq / 100, cat_term); + } else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) { + // Range is 100..4000 Hz in 100 Hz steps + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%02d%c", freq / 100, cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + RETURNFUNC(newcat_set_cmd(rig)); +} + +static int newcat_get_contour_frequency(RIG *rig, vfo_t vfo, int *freq) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + char main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; + int err; + int ret_data_len; + char *ret_data; + + if (!newcat_valid_command(rig, "CO")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%c", main_sub_vfo, cat_term); + } else if (is_ftdx10 || is_ft991 || is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%c", cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO%c1%c", main_sub_vfo, cat_term); + } else if (is_ftdx3000 || is_ftdx1200 || is_ft2000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CO01%c", cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + if ((err = newcat_get_cmd(rig)) != RIG_OK) + { + RETURNFUNC(err); + } + + ret_data_len = strlen(priv->ret_data); + + /* skip command */ + ret_data = priv->ret_data + strlen(priv->cmd_str) - 1; + rig_debug(RIG_DEBUG_TRACE, "%s: ret_data='%s'\n", __func__, ret_data); + /* chop term */ + priv->ret_data[ret_data_len - 1] = '\0'; + + int raw_value = atoi(ret_data); + + if (is_ftdx101d || is_ftdx101mp || is_ftdx10 || is_ft991 || is_ft891) { + *freq = raw_value; + } else if (is_ftdx5000 || is_ftdx3000 || is_ftdx1200 || is_ft2000) { + *freq = raw_value * 100; + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + RETURNFUNC(RIG_OK); +} + +static int newcat_set_contour_level(RIG *rig, vfo_t vfo, int level) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + + if (!newcat_valid_command(rig, "EX")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp || is_ftdx10) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030202%+03d%c", level, cat_term); + } else if (is_ft991) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%+03d%c", level, cat_term); + } else if (is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1202%+03d%c", level, cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%+03d%c", level, cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX108%+03d%c", level, cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + RETURNFUNC(newcat_set_cmd(rig)); +} + +static int newcat_get_contour_level(RIG *rig, vfo_t vfo, int *level) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + int err; + int ret_data_len; + char *ret_data; + + if (!newcat_valid_command(rig, "EX")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp || is_ftdx10) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030202%c", cat_term); + } else if (is_ft991) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX112%c", cat_term); + } else if (is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1202%c", cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%c", cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX108%c", cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + if ((err = newcat_get_cmd(rig)) != RIG_OK) + { + RETURNFUNC(err); + } + + ret_data_len = strlen(priv->ret_data); + + /* skip command */ + ret_data = priv->ret_data + strlen(priv->cmd_str) - 1; + rig_debug(RIG_DEBUG_TRACE, "%s: ret_data='%s'\n", __func__, ret_data); + /* chop term */ + priv->ret_data[ret_data_len - 1] = '\0'; + + *level = atoi(ret_data); + + RETURNFUNC(RIG_OK); +} + +static int newcat_set_contour_width(RIG *rig, vfo_t vfo, int width) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + + if (!newcat_valid_command(rig, "EX")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp || is_ftdx10) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030203%02d%c", width, cat_term); + } else if (is_ft991) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%02d%c", width, cat_term); + } else if (is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1203%02d%c", width, cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX114%02d%c", width, cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX109%02d%c", width, cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + RETURNFUNC(newcat_set_cmd(rig)); +} + +static int newcat_get_contour_width(RIG *rig, vfo_t vfo, int *width) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + int err; + int ret_data_len; + char *ret_data; + + if (!newcat_valid_command(rig, "EX")) + { + RETURNFUNC(-RIG_ENAVAIL); + } + + if (is_ftdx101d || is_ftdx101mp || is_ftdx10) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX030203%c", cat_term); + } else if (is_ft991) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX113%c", cat_term); + } else if (is_ft891) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX1203%c", cat_term); + } else if (is_ftdx5000) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX114%c", cat_term); + } else if (is_ftdx3000 || is_ftdx1200) { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX109%c", cat_term); + } else { + RETURNFUNC(-RIG_ENIMPL); + } + + if ((err = newcat_get_cmd(rig)) != RIG_OK) + { + RETURNFUNC(err); + } + + ret_data_len = strlen(priv->ret_data); + + /* skip command */ + ret_data = priv->ret_data + strlen(priv->cmd_str) - 1; + rig_debug(RIG_DEBUG_TRACE, "%s: ret_data='%s'\n", __func__, ret_data); + /* chop term */ + priv->ret_data[ret_data_len - 1] = '\0'; + + *width = atoi(ret_data); + + RETURNFUNC(RIG_OK); +} diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index e11ef2a5f..7daac8806 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -226,5 +226,12 @@ int newcat_send_voice_mem(RIG *rig, vfo_t vfo, int ch); #define TOKEN_BACKEND(t) (t) #define TOK_ROOFING_FILTER TOKEN_BACKEND(100) +#define TOK_KEYER TOKEN_BACKEND(101) +#define TOK_APF_FREQ TOKEN_BACKEND(102) +#define TOK_APF_WIDTH TOKEN_BACKEND(103) +#define TOK_CONTOUR TOKEN_BACKEND(104) +#define TOK_CONTOUR_FREQ TOKEN_BACKEND(105) +#define TOK_CONTOUR_LEVEL TOKEN_BACKEND(106) +#define TOK_CONTOUR_WIDTH TOKEN_BACKEND(107) #endif /* _NEWCAT_H */