diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 7be7a99aa..95230ff53 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -823,7 +823,7 @@ typedef uint64_t setting_t; #define RIG_FUNC_TBURST (1ULL<<29) /*!< \c TBURST -- 1750 Hz tone burst */ #define RIG_FUNC_TUNER (1ULL<<30) /*!< \c TUNER -- Enable automatic tuner */ #define RIG_FUNC_XIT (1ULL<<31) /*!< \c XIT -- Transmitter Incremental Tuning */ -#define RIG_FUNC_BIT32 (1ULL<<32) /* available for future RIG_FUNC items */ +#define RIG_FUNC_NB2 (1ULL<<32) /*!< \c NB2 -- 2nd Noise Blanker */ #define RIG_FUNC_BIT33 (1ULL<<33) /* available for future RIG_FUNC items */ #define RIG_FUNC_BIT34 (1ULL<<34) /* available for future RIG_FUNC items */ #define RIG_FUNC_BIT35 (1ULL<<35) /* available for future RIG_FUNC items */ @@ -2253,7 +2253,7 @@ rigerror HAMLIB_PARAMS((int errnum)); extern HAMLIB_EXPORT(int) rig_setting2idx HAMLIB_PARAMS((setting_t s)); -#define rig_idx2setting(i) (1UL<<(i)) +#define rig_idx2setting(i) (1ULL<<(i)) /* * Even if these functions are prefixed with "rig_", they are not rig specific diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index ecfea4b15..8a8010062 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -1449,6 +1449,16 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) return -RIG_EINVAL; } + char c; + if (kmode <= 9) + { + c = '0' + kmode; + } + else + { + c = 'A' + kmode - 10; + } + if (RIG_MODEL_TS990S == rig->caps->rig_model) { /* The TS990s has targetable read mode but can only set the mode @@ -1457,18 +1467,9 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) setting caps.targetable_vfo to not include RIG_TARGETABLE_MODE since the toggle is not required for reading the mode. */ - char c; vfo_t curr_vfo; err = kenwood_get_vfo_main_sub (rig, &curr_vfo); if (err != RIG_OK) return err; - if (kmode <= 9) - { - c = '0' + kmode; - } - else - { - c = 'A' + kmode - 10; - } if (vfo != RIG_VFO_CURR && vfo != curr_vfo) { err = kenwood_set_vfo_main_sub (rig, vfo); @@ -1484,7 +1485,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) } else { - snprintf(buf, sizeof (buf), "MD%c", '0' + kmode); + snprintf(buf, sizeof (buf), "MD%c", c); err = kenwood_transaction(rig, buf, NULL, 0); } if (err != RIG_OK) return err; @@ -2026,11 +2027,28 @@ int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) if (!rig) return -RIG_EINVAL; - char buf[6]; /* longest cmd is GTxxx */ + char buf[10]; /* longest cmd is GTxxx */ switch (func) { case RIG_FUNC_NB: - snprintf(buf, sizeof (buf), "NB%c", (status == 0) ? '0' : '1'); + case RIG_FUNC_NB2: + /* newer Kenwoods have a second noise blanker */ + if (RIG_MODEL_TS890S == rig->caps->rig_model) { + switch(func) { + case RIG_FUNC_NB: + snprintf(buf, sizeof (buf), "NB1%c", (status == 0) ? '0' : '1'); + break; + case RIG_FUNC_NB2: + snprintf(buf, sizeof (buf), "NB2%c", (status == 0) ? '0' : '1'); + break; + default: + rig_debug(RIG_DEBUG_ERR, "%s: expected 0,1, or 2 and got %d\n", __func__, status); + return -RIG_EINVAL; + } + } + else { + snprintf(buf, sizeof (buf), "NB%c", (status == 0) ? '0' : '1'); + } return kenwood_transaction(rig, buf, NULL, 0); case RIG_FUNC_ABM: @@ -2141,6 +2159,9 @@ int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) case RIG_FUNC_NB: return get_kenwood_func(rig, "NB", status); + case RIG_FUNC_NB2: + return get_kenwood_func(rig, "NB2", status); + case RIG_FUNC_ABM: return get_kenwood_func(rig, "AM", status); diff --git a/kenwood/kenwood.h b/kenwood/kenwood.h index 9a1950bfc..c1ca29a0f 100644 --- a/kenwood/kenwood.h +++ b/kenwood/kenwood.h @@ -27,7 +27,7 @@ #include #include "token.h" -#define BACKEND_VER "1.0" +#define BACKEND_VER "1.1" #define EOM_KEN ';' #define EOM_TH '\r' diff --git a/kenwood/ts480.c b/kenwood/ts480.c index 8a5c382a2..2f3a02ecb 100644 --- a/kenwood/ts480.c +++ b/kenwood/ts480.c @@ -423,9 +423,9 @@ const struct rig_caps ts890s_caps = { .rig_model = RIG_MODEL_TS890S, .model_name = "TS-890S", .mfg_name = "Kenwood", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", - .status = RIG_STATUS_ALPHA, + .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG_MICDATA, .dcd_type = RIG_DCD_RIG, diff --git a/tests/sprintflst.c b/tests/sprintflst.c index fdec2c739..256277d5f 100644 --- a/tests/sprintflst.c +++ b/tests/sprintflst.c @@ -103,7 +103,7 @@ int sprintf_vfo(char *str, vfo_t vfo) int sprintf_mode(char *str, rmode_t mode) { - int i, len = 0; + uint64_t i, len = 0; *str = '\0'; @@ -112,9 +112,9 @@ int sprintf_mode(char *str, rmode_t mode) return 0; } - for (i = 0; i < 30; i++) + for (i = 0; i < 63; i++) { - const char *ms = rig_strrmode(mode & (1UL << i)); + const char *ms = rig_strrmode(mode & (1ULL << i)); if (!ms || !ms[0]) { @@ -132,7 +132,7 @@ int sprintf_mode(char *str, rmode_t mode) int sprintf_func(char *str, setting_t func) { - int i, len = 0; + uint64_t i, len = 0; *str = '\0';