static int thd72_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int retval; char c; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); switch (func) { case RIG_FUNC_AIP: retval = thd72_vfoc(rig, vfo, &c); if (retval != RIG_OK) { return retval; } return thd72_set_menu_item(rig, c == '0' ? 5 : 6, status); case RIG_FUNC_ARO: return thd72_set_menu_item(rig, 18, status); case RIG_FUNC_TONE: return thd72_set_freq_item(rig, vfo, 22, status); case RIG_FUNC_TSQL: return thd72_set_freq_item(rig, vfo, 24, status); default: return -RIG_EINVAL; } return RIG_OK; }
static int thd72_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int retval, lvl; char c, lvlc, cmd[10]; rig_debug(RIG_DEBUG_TRACE, "%s: called VFO=%s, level=%s, val=%g\n", __func__, rig_strvfo(vfo), rig_strlevel(level), val.f); retval = thd72_vfoc(rig, vfo, &c); if (retval != RIG_OK) { return retval; } switch (level) { case RIG_LEVEL_RFPOWER: if (val.f <= 0.01) { lvlc = '2'; } else if (val.f <= 0.10) { lvlc = '1'; } else { lvlc = '0'; } sprintf(cmd, "PC %c,%c", c, lvlc); return kenwood_simple_transaction(rig, cmd, 6); case RIG_LEVEL_VOXGAIN: return thd72_set_menu_item(rig, 8, (int)(val.f * 10.0 - 0.5)); case RIG_LEVEL_VOXDELAY: if (val.i > 20000) { lvl = 6; } else if (val.i > 10000) { lvl = val.i / 10000 + 3; } else { lvl = val.i / 2500; } return thd72_set_menu_item(rig, 9, lvl); case RIG_LEVEL_SQL: lvlc = '0' + (int)(val.f * 5); sprintf(cmd, "PC %c,%c", c, lvlc); return kenwood_simple_transaction(rig, cmd, 6); case RIG_LEVEL_BALANCE: /* FIXME - is balance 0.0 .. 1.0 or -1.0 .. 1.0? */ lvl = (int)(val.f * 4.0); return thd72_set_menu_item(rig, 13, lvl); default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Level %d\n", __func__, level); return -RIG_EINVAL; } return retval; }
static int thd72_set_parm(RIG *rig, setting_t parm, value_t val) { int l; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); switch (parm) { case RIG_PARM_APO: if (val.i == 0) l = 0; else if (val.i <= 15) l = 1; else if (val.i <= 30) l = 2; else l = 3; return thd72_set_menu_item(rig, 3, l); case RIG_PARM_TIME: default: return -RIG_EINVAL; } return RIG_OK; }