[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 2b2786cd4761f604c3b75
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2020-09-18 04:26:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 2b2786cd4761f604c3b752089c0216a39621e37c (commit) from f58314852047b10a210f7b841598f52ff10e07bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2b2786cd4761f604c3b752089c0216a39621e37c Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Sep 17 23:24:40 2020 -0500 Fix PowerSdr MICGAIN for levels -40 to 10 it returns https://github.com/Hamlib/Hamlib/issues/382 diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 9ffcaf91..5571c6dd 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -48,7 +48,7 @@ #define F6K_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3) /* PowerSDR differences */ -#define POWERSDR_LEVEL_ALL (RIG_LEVEL_SLOPE_HIGH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_KEYSPD|RIG_LEVEL_RFPOWER_METER) +#define POWERSDR_LEVEL_ALL (RIG_LEVEL_SLOPE_HIGH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_KEYSPD|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_MICGAIN) static rmode_t flex_mode_table[KENWOOD_MODE_TABLE_MAX] = @@ -631,6 +631,41 @@ int flex6k_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) return err; } + +/* + * powersdr_set_level + */ +int powersdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) +{ + char cmd[KENWOOD_MAX_BUF_LEN]; + int retval; + int ival; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + switch (level) + { + case RIG_LEVEL_MICGAIN: + ival = val.f * (10 - -40) - 40; + snprintf(cmd, sizeof(cmd) - 1, "ZZMG%03d", ival); + retval = kenwood_transaction(rig, cmd, NULL, 0); + + if (retval != RIG_OK) + { + return retval; + } + + break; + + default: + return kenwood_set_level(rig, vfo, level, val); + } + + rig_debug(RIG_DEBUG_VERBOSE, "%s exiting\n", __func__); + + return RIG_OK; +} + /* * powersdr_get_level */ @@ -655,6 +690,11 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) len = 5; break; + case RIG_LEVEL_MICGAIN: + cmd = "ZZMG"; + len = 4; + break; + default: return kenwood_get_level(rig, vfo, level, val); } @@ -682,6 +722,13 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) val->f /= 100; break; + + case RIG_LEVEL_MICGAIN: + n = sscanf(lvlbuf + len, "%f", &val->f); + // Thetis returns -40 to 10 -- does PowerSDR do the same? + // Setting + val->f = (val->f - -40) / (10 - -40); + break; } return RIG_OK; @@ -845,7 +892,7 @@ const struct rig_caps powersdr_caps = .has_get_func = RIG_FUNC_NONE, /* has VOX but not implemented here */ .has_set_func = RIG_FUNC_NONE, .has_get_level = POWERSDR_LEVEL_ALL, - .has_set_level = F6K_LEVEL_ALL, + .has_set_level = POWERSDR_LEVEL_ALL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ @@ -937,7 +984,7 @@ const struct rig_caps powersdr_caps = .set_ptt = flex6k_set_ptt, // TODO copy over kenwood_[set|get]_level and modify to handle DSP filter values // correctly - use actual values instead of indices - .set_level = kenwood_set_level, + .set_level = powersdr_set_level, .get_level = powersdr_get_level, //.set_ant = kenwood_set_ant_no_ack, //.get_ant = kenwood_get_ant, ----------------------------------------------------------------------- Summary of changes: rigs/kenwood/flex6xxx.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |