- appropriate RIG_AGC* mapping

- implemented RIG_LEVEL_ALC/RIG_LEVEL_SWR
- icom_mem_get_split_vfo() needs RIG_OP_XCHG


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2874 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.11
Stéphane Fillod, F8CFE 2010-04-14 19:56:10 +00:00
rodzic 306be5176b
commit 16e6443f65
2 zmienionych plików z 65 dodań i 20 usunięć

Wyświetl plik

@ -791,9 +791,6 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
lvl_len = 2;
to_bcd_be(lvlbuf, (long long)icom_val, lvl_len*2);
/* Optimize:
* sort the switch cases with the most frequent first
*/
switch (level) {
case RIG_LEVEL_PREAMP:
lvl_cn = C_CTL_FUNC;
@ -887,10 +884,16 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
case RIG_LEVEL_AGC:
lvl_cn = C_CTL_FUNC;
lvl_sc = S_FUNC_AGC;
if (rig->caps->rig_model == RIG_MODEL_ICR75) {
lvl_len = 1;
lvlbuf[0] = val.i;
}
lvl_len = 1;
switch (val.i) {
case RIG_AGC_SLOW: lvlbuf[0] = D_AGC_SLOW; break;
case RIG_AGC_MEDIUM: lvlbuf[0] = D_AGC_MID; break;
case RIG_AGC_FAST: lvlbuf[0] = D_AGC_FAST; break;
case RIG_AGC_SUPERFAST: lvlbuf[0] = D_AGC_SUPERFAST; break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported LEVEL_AGC %d", val.i);
return -RIG_EINVAL;
}
break;
case RIG_LEVEL_BKINDL:
lvl_cn = C_CTL_LVL;
@ -946,6 +949,12 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
/*
* icom_get_level
* Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL
*
* TODO (missing RIG_LEVEL):
* - S_RFML: Read real RFpower-meter level
* - S_CMP: Read COMP-meter level
* - S_VD : Read Vd-meter level
* - S_ID : Read Id-meter level
*/
int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
@ -962,15 +971,21 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
priv = (struct icom_priv_data*)rs->priv;
lvl2_len = 0;
/* Optimize:
* sort the switch cases with the most frequent first
*/
switch (level) {
switch (level) {
case RIG_LEVEL_STRENGTH:
case RIG_LEVEL_RAWSTR:
lvl_cn = C_RD_SQSM;
lvl_sc = S_SML;
break;
case RIG_LEVEL_ALC:
lvl_cn = C_RD_SQSM;
lvl_sc = S_ALC;
break;
case RIG_LEVEL_SWR:
lvl_cn = C_RD_SQSM;
lvl_sc = S_SWR;
break;
case RIG_LEVEL_PREAMP:
lvl_cn = C_CTL_FUNC;
lvl_sc = S_FUNC_PAMP;
@ -1114,8 +1129,28 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
switch (level) {
case RIG_LEVEL_RAWSTR:
/* raw value */
val->i = icom_val;
break;
case RIG_LEVEL_AGC:
switch (icom_val) {
case D_AGC_SLOW: val->i = RIG_AGC_SLOW; break;
case D_AGC_MID: val->i = RIG_AGC_MEDIUM; break;
case D_AGC_FAST: val->i = RIG_AGC_FAST; break;
case D_AGC_SUPERFAST: val->i = RIG_AGC_SUPERFAST; break;
default:
rig_debug(RIG_DEBUG_ERR,"Unexpected AGC 0x%02x", icom_val);
return -RIG_EPROTO;
}
break;
case RIG_LEVEL_ALC:
/* 120 max on IC-7600 */
val->f = (float)icom_val/120;
break;
case RIG_LEVEL_SWR:
/* {0->1, 48->1.5, 80->2} on IC-7600 */
val->f = 1. + (float)icom_val/80;
break;
case RIG_LEVEL_PREAMP:
if (icom_val == 0) {
val->i = 0;
@ -1746,7 +1781,8 @@ int icom_mem_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
/* this hacks works only when in memory mode
* I have no clue how to detect split in regular VFO mode
*/
if (rig->state.current_vfo != RIG_VFO_MEM)
if (rig->state.current_vfo != RIG_VFO_MEM ||
!rig_has_vfo_op(rig, RIG_OP_XCHG))
return -RIG_ENAVAIL;
retval = icom_vfo_op(rig, vfo, RIG_OP_XCHG);
@ -1856,9 +1892,6 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
fctbuf[0] = status? 0x01:0x00;
fct_len = rig->caps->rig_model == RIG_MODEL_ICR8500 ? 0 : 1;
/* Optimize:
* sort the switch cases with the most frequent first
*/
switch (func) {
case RIG_FUNC_FAGC:
fct_cn = C_CTL_FUNC;
@ -1984,9 +2017,6 @@ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
int ack_len=sizeof(ackbuf), retval;
int fct_cn, fct_sc; /* Command Number, Subcommand */
/* Optimize:
* sort the switch cases with the most frequent first
*/
switch (func) {
case RIG_FUNC_FAGC:
fct_cn = C_CTL_FUNC;

Wyświetl plik

@ -195,6 +195,14 @@
#define D_PAMP1 0x01
#define D_PAMP2 0x02
/*
* Set AGC (S_FUNC_AGC) data
*/
#define D_AGC_FAST 0x00
#define D_AGC_MID 0x01
#define D_AGC_SLOW 0x02
#define D_AGC_SUPERFAST 0x03 /* IC746 pro */
/*
* Set antenna (C_SET_ANT) subcommands
*/
@ -225,14 +233,17 @@
#define S_LVL_MICGAIN 0x0b /* MIC gain setting */
#define S_LVL_KEYSPD 0x0c /* Key Speed setting */
#define S_LVL_NOTCHF 0x0d /* Notch freq. setting */
#define S_LVL_COMP 0x0e /* Compressor level setting */
#define S_LVL_COMP 0x0e /* Compressor level setting */
#define S_LVL_BKINDL 0x0f /* BKin delay setting */
#define S_LVL_BALANCE 0x10 /* Balance setting (Dual watch) */
#define S_LVL_AGC 0x11 /* AGC (7800) */
#define S_LVL_NB 0x12 /* NB setting */
#define S_LVL_DIGI 0x13 /* DIGI-SEL (7800) */
#define S_LVL_DRIVE 0x14 /* DRIVE gain setting */
#define S_LVL_MON 0x15 /* Monitor gain setting */
#define S_LVL_VOXGAIN 0x16 /* VOX gain setting */
#define S_LVL_ANTIVOX 0x17 /* Anti VOX gain setting */
#define S_LVL_CONTRAST 0x18 /* CONTRAST level setting */
#define S_LVL_BRIGHT 0x19 /* BRIGHT level setting */
/*
@ -244,6 +255,8 @@
#define S_SWR 0x12 /* Read SWR-meter level */
#define S_ALC 0x13 /* Read ALC-meter level */
#define S_CMP 0x14 /* Read COMP-meter level */
#define S_VD 0x15 /* Read Vd-meter level */
#define S_ID 0x16 /* Read Id-meter level */
/*
* Function settings (C_CTL_FUNC) subcommands Set and Read
@ -271,6 +284,8 @@
#define S_FUNC_AFC 0x4A /* Auto Frequency Control (AFC) setting */
#define S_FUNC_DTCS 0x4B /*DTCS tone code squelch setting*/
#define S_FUNC_VSC 0x4C /* voice squelch control useful for scanning*/
#define S_FUNC_MANAGC 0x4D /* manual AGC */
#define S_FUNC_DIGISEL 0x4E /* DIGI-SEL */
#define S_FUNC_TW_PK 0x4F /* RTTY Twin Peak filter 0= off 1 = on */
#define S_FUNC_DIAL_LK 0x50 /* Dial lock */
@ -352,7 +367,7 @@
#define C_OMNI6_XMT 0x16
/*
* C_CTL_MODE Misc CI-V Mode settings
* S_MEM_MODE_SLCT Misc CI-V Mode settings
*/
#define S_PRM_BEEP 0x02
#define S_PRM_CWPITCH 0x10