diff --git a/alinco/alinco.c b/alinco/alinco.c index 0bfec7caa..bc7e98ca2 100644 --- a/alinco/alinco.c +++ b/alinco/alinco.c @@ -2,7 +2,7 @@ * Hamlib Alinco backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: alinco.c,v 1.18 2003-10-20 22:15:01 fillods Exp $ + * $Id: alinco.c,v 1.19 2003-11-16 17:14:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -594,17 +594,14 @@ int alinco_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) */ int alinco_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { - struct alinco_priv_caps *priv; int retval, lvl_len; char lvlbuf[BUFSZ]; - priv = (struct alinco_priv_caps*)rig->caps->priv; - /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { - case RIG_LEVEL_STRENGTH: + case RIG_LEVEL_RAWSTR: /* read A/D converted value */ retval = alinco_transaction (rig, AL CMD_SMETER "1" EOM, strlen(AL CMD_SMETER "1" EOM), lvlbuf, &lvl_len); @@ -618,7 +615,7 @@ int alinco_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } lvlbuf[5] = '\0'; - val->i = rig_raw2val(atoi(lvlbuf+3), &priv->str_cal); + val->i = atoi(lvlbuf+3); break; case RIG_LEVEL_SQLSTAT: diff --git a/alinco/alinco.h b/alinco/alinco.h index 419c6d09e..66e1e46fa 100644 --- a/alinco/alinco.h +++ b/alinco/alinco.h @@ -2,7 +2,7 @@ * Hamlib Alinco backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: alinco.h,v 1.12 2003-04-16 22:30:38 fillods Exp $ + * $Id: alinco.h,v 1.13 2003-11-16 17:14:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -24,13 +24,8 @@ #define _ALINCO_H 1 #include -#include #include -struct alinco_priv_caps { - cal_table_t str_cal; -}; - int alinco_set_vfo(RIG *rig, vfo_t vfo); int alinco_get_vfo(RIG *rig, vfo_t *vfo); int alinco_set_freq(RIG *rig, vfo_t vfo, freq_t freq); diff --git a/alinco/dx77.c b/alinco/dx77.c index fc63cf3e9..6c7131ddb 100644 --- a/alinco/dx77.c +++ b/alinco/dx77.c @@ -2,7 +2,7 @@ * Hamlib Alinco backend - DX77 description * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: dx77.c,v 1.7 2003-10-01 19:31:54 fillods Exp $ + * $Id: dx77.c,v 1.8 2003-11-16 17:14:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -27,6 +27,7 @@ #include #include +#include "idx_builtin.h" #include "alinco.h" @@ -36,7 +37,7 @@ #define DX77_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TONE|RIG_FUNC_COMP) -#define DX77_LEVEL_ALL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH) +#define DX77_LEVEL_ALL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH) #define DX77_PARM_ALL (RIG_PARM_BEEP|RIG_PARM_BACKLIGHT) @@ -59,10 +60,6 @@ { 216, 60 }, \ } } -static const struct alinco_priv_caps dx77_priv_caps = { - DX77_STR_CAL -}; - /* * dx77 rig capabilities. * @@ -82,7 +79,7 @@ const struct rig_caps dx77_caps = { .rig_model = RIG_MODEL_DX77, .model_name = "DX-77", .mfg_name = "Alinco", -.version = "0.1", +.version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -106,7 +103,9 @@ const struct rig_caps dx77_caps = { .has_set_level = RIG_LEVEL_SET(DX77_LEVEL_ALL), .has_get_parm = DX77_PARM_ALL, .has_set_parm = RIG_PARM_SET(DX77_PARM_ALL), -.level_gran = {}, /* FIXME: granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, +}, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, @@ -163,7 +162,7 @@ const struct rig_caps dx77_caps = { {RIG_MODE_AM, kHz(2.7)}, RIG_FLT_END, }, -.priv = (void*)&dx77_priv_caps, +.str_cal = DX77_STR_CAL, .set_freq = alinco_set_freq, .get_freq = alinco_get_freq, diff --git a/icom/ic271.c b/icom/ic271.c index b95a51678..e4cfed991 100644 --- a/icom/ic271.c +++ b/icom/ic271.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-271 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic271.c,v 1.1 2003-11-10 16:01:21 fillods Exp $ + * $Id: ic271.c,v 1.2 2003-11-16 17:14:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -36,8 +36,6 @@ #define IC271_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) -#define IC271_STR_CAL { 0, { } } - /* * IC-271 A/E * IC-271 H is high power (75W) @@ -51,8 +49,7 @@ static const struct icom_priv_caps ic271_priv_caps = { 0x20, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - IC271_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic271_caps = { diff --git a/icom/ic275.c b/icom/ic275.c index c0bc65bf0..b417a890c 100644 --- a/icom/ic275.c +++ b/icom/ic275.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-275 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic275.c,v 1.5 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic275.c,v 1.6 2003-11-16 17:14:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -45,8 +45,7 @@ static const struct icom_priv_caps ic275_priv_caps = { 0x10, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - IC275_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic275_caps = { diff --git a/icom/ic471.c b/icom/ic471.c index 80581dfff..b6b8dec34 100644 --- a/icom/ic471.c +++ b/icom/ic471.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-471 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic471.c,v 1.1 2003-11-10 16:01:21 fillods Exp $ + * $Id: ic471.c,v 1.2 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -48,8 +48,7 @@ static const struct icom_priv_caps ic471_priv_caps = { 0x22, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - IC471_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic471_caps = { diff --git a/icom/ic475.c b/icom/ic475.c index cb00e512b..6b3e8408f 100644 --- a/icom/ic475.c +++ b/icom/ic475.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-475 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic475.c,v 1.5 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic475.c,v 1.6 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -45,8 +45,7 @@ static const struct icom_priv_caps ic475_priv_caps = { 0x14, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - IC475_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic475_caps = { diff --git a/icom/ic703.c b/icom/ic703.c index 08fc19da1..e6730c206 100644 --- a/icom/ic703.c +++ b/icom/ic703.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-703 * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic703.c,v 1.1 2003-11-05 20:40:26 fillods Exp $ + * $Id: ic703.c,v 1.2 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -29,6 +29,7 @@ #include "hamlib/rig.h" #include "icom.h" #include "bandplan.h" +#include "idx_builtin.h" #define IC703_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) @@ -37,7 +38,7 @@ #define IC703_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_ANF|RIG_FUNC_MON) -#define IC703_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_ALC|RIG_LEVEL_SWR|RIG_LEVEL_METER|RIG_LEVEL_COMP|RIG_LEVEL_RF|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_NR|RIG_LEVEL_IF|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT) +#define IC703_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR|RIG_LEVEL_ALC|RIG_LEVEL_SWR|RIG_LEVEL_METER|RIG_LEVEL_COMP|RIG_LEVEL_RF|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_NR|RIG_LEVEL_IF|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT) #define IC703_VFO_ALL (RIG_VFO_A|RIG_VFO_B) @@ -79,8 +80,7 @@ static const struct icom_priv_caps ic703_priv_caps = { 0x68, /* default address */ 0, /* 731 mode */ - ic706_ts_sc_list, - IC703_STR_CAL + ic706_ts_sc_list }; const struct rig_caps ic703_caps = { @@ -110,7 +110,9 @@ const struct rig_caps ic703_caps = { .has_set_level = RIG_LEVEL_SET(IC703_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ -.level_gran = {}, /* granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, + }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, @@ -178,6 +180,7 @@ const struct rig_caps ic703_caps = { {RIG_MODE_FM, kHz(9)}, /* narrow w/ bultin FL-94 */ RIG_FLT_END, }, +.str_cal = IC703_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, diff --git a/icom/ic706.c b/icom/ic706.c index 137e3dda1..8693929a3 100644 --- a/icom/ic706.c +++ b/icom/ic706.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-706 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic706.c,v 1.32 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic706.c,v 1.33 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -28,6 +28,7 @@ #include "hamlib/rig.h" #include "icom.h" +#include "idx_builtin.h" #define IC706_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM|RIG_MODE_WFM) #define IC706_1MHZ_TS_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) @@ -41,7 +42,7 @@ #define IC706IIG_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) -#define IC706IIG_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH) +#define IC706IIG_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR) #define IC706_VFO_ALL (RIG_VFO_A|RIG_VFO_B) @@ -104,8 +105,7 @@ static const struct icom_priv_caps ic706_priv_caps = { 0x48, /* default address */ 0, /* 731 mode */ - ic706_ts_sc_list, - IC706IIG_STR_CAL + ic706_ts_sc_list }; const struct rig_caps ic706_caps = { @@ -203,6 +203,7 @@ const struct rig_caps ic706_caps = { {RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */ RIG_FLT_END, }, +.str_cal = IC706IIG_STR_CAL, .priv = (void*)&ic706_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, @@ -235,8 +236,7 @@ const struct rig_caps ic706_caps = { static const struct icom_priv_caps ic706mkii_priv_caps = { 0x4e, /* default address */ 0, /* 731 mode */ - ic706_ts_sc_list, - IC706IIG_STR_CAL + ic706_ts_sc_list }; const struct rig_caps ic706mkii_caps = { @@ -336,6 +336,7 @@ const struct rig_caps ic706mkii_caps = { {RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */ RIG_FLT_END, }, +.str_cal = IC706IIG_STR_CAL, .priv = (void*)&ic706mkii_priv_caps, .rig_init = icom_init, @@ -371,8 +372,7 @@ const struct rig_caps ic706mkii_caps = { static const struct icom_priv_caps ic706mkiig_priv_caps = { 0x58, /* default address */ 0, /* 731 mode */ - ic706_ts_sc_list, - IC706IIG_STR_CAL + ic706_ts_sc_list }; const struct rig_caps ic706mkiig_caps = { @@ -384,7 +384,7 @@ const struct rig_caps ic706mkiig_caps = { .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_NONE, -.dcd_type = RIG_DCD_NONE, +.dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, @@ -402,7 +402,9 @@ const struct rig_caps ic706mkiig_caps = { .has_set_level = RIG_LEVEL_SET(IC706IIG_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ -.level_gran = {}, /* granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, + }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, @@ -482,6 +484,7 @@ const struct rig_caps ic706mkiig_caps = { {RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */ RIG_FLT_END, }, +.str_cal = IC706IIG_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, diff --git a/icom/ic718.c b/icom/ic718.c index 10abecf51..bfd558564 100644 --- a/icom/ic718.c +++ b/icom/ic718.c @@ -3,7 +3,7 @@ * Copyright (c) 2000-2003 by Stephane Fillod * Caps submitted by Chuck Gilkes WD0FCL/4 * - * $Id: ic718.c,v 1.5 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic718.c,v 1.6 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -29,6 +29,7 @@ #include "hamlib/rig.h" #include "icom.h" +#include "idx_builtin.h" #define IC718_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) @@ -43,7 +44,7 @@ #define IC718_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) -#define IC718_LEVEL_ALL (RIG_LEVEL_MICGAIN|RIG_LEVEL_NR|RIG_LEVEL_CWPITCH|RIG_LEVEL_KEYSPD|RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH) +#define IC718_LEVEL_ALL (RIG_LEVEL_MICGAIN|RIG_LEVEL_NR|RIG_LEVEL_CWPITCH|RIG_LEVEL_KEYSPD|RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR) #define IC718_VFO_ALL (RIG_VFO_A|RIG_VFO_B) @@ -57,8 +58,7 @@ static const struct icom_priv_caps IC718_priv_caps = { 0x5e, /* default address */ 0, /* 731 mode */ - ic718_ts_sc_list, - IC718_STR_CAL + ic718_ts_sc_list }; const struct rig_caps ic718_caps = { @@ -88,7 +88,9 @@ const struct rig_caps ic718_caps = { .has_set_level = RIG_LEVEL_SET(IC718_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ -.level_gran = {}, /* granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, + }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, diff --git a/icom/ic725.c b/icom/ic725.c index 365e1752f..14a50ba4e 100644 --- a/icom/ic725.c +++ b/icom/ic725.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-725 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic725.c,v 1.4 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic725.c,v 1.5 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -52,8 +52,7 @@ static const struct icom_priv_caps ic725_priv_caps = { 0x28, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - EMPTY_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic725_caps = { diff --git a/icom/ic726.c b/icom/ic726.c index 7e1ad791b..d9e2295c6 100644 --- a/icom/ic726.c +++ b/icom/ic726.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-726 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic726.c,v 1.1 2003-11-10 16:01:21 fillods Exp $ + * $Id: ic726.c,v 1.2 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -54,8 +54,7 @@ static const struct icom_priv_caps ic726_priv_caps = { 0x30, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - EMPTY_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic726_caps = { diff --git a/icom/ic735.c b/icom/ic735.c index abaa1fdae..0d4c5a133 100644 --- a/icom/ic735.c +++ b/icom/ic735.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-735 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic735.c,v 1.5 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic735.c,v 1.6 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -49,8 +49,7 @@ static const struct icom_priv_caps ic735_priv_caps = { 0x04, /* default address */ 1, /* 731 mode */ - ic737_ts_sc_list, - IC735_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic735_caps = { diff --git a/icom/ic736.c b/icom/ic736.c index 209e574f6..e093e8a22 100644 --- a/icom/ic736.c +++ b/icom/ic736.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-736 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic736.c,v 1.3 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic736.c,v 1.4 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -58,8 +58,7 @@ static const struct icom_priv_caps ic736_priv_caps = { 0x40, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - IC736_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic736_caps = { diff --git a/icom/ic765.c b/icom/ic765.c index 55688d9d4..692439d33 100644 --- a/icom/ic765.c +++ b/icom/ic765.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-765 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic765.c,v 1.1 2003-11-10 16:01:21 fillods Exp $ + * $Id: ic765.c,v 1.2 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -54,8 +54,7 @@ static const struct icom_priv_caps ic765_priv_caps = { 0x2c, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - EMPTY_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic765_caps = { diff --git a/icom/ic775.c b/icom/ic775.c index 144d57caa..2bc0c093e 100644 --- a/icom/ic775.c +++ b/icom/ic775.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-775 and variations * Copyright (c) 2000-2002 by Stephane Fillod * - * $Id: ic775.c,v 1.4 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic775.c,v 1.5 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -51,8 +51,7 @@ static const struct icom_priv_caps ic775_priv_caps = { 0x46, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - IC775_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic775_caps = { diff --git a/icom/ic781.c b/icom/ic781.c index 68ae0a548..16e9ae649 100644 --- a/icom/ic781.c +++ b/icom/ic781.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-781 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic781.c,v 1.1 2003-11-10 16:01:21 fillods Exp $ + * $Id: ic781.c,v 1.2 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -55,8 +55,7 @@ static const struct icom_priv_caps ic781_priv_caps = { 0x26, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - EMPTY_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic781_caps = { diff --git a/icom/ic821h.c b/icom/ic821h.c index cf58a28c1..ad390d71c 100644 --- a/icom/ic821h.c +++ b/icom/ic821h.c @@ -3,7 +3,7 @@ * Contributed by Francois Retief * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic821h.c,v 1.4 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic821h.c,v 1.5 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -50,8 +50,7 @@ static const struct icom_priv_caps ic821h_priv_caps = { 0x4c, /* default address */ 1, /* 731 mode */ - ic737_ts_sc_list, - IC821H_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic821h_caps = { diff --git a/icom/ic910.c b/icom/ic910.c index 0e6d7898a..30b73c3ee 100644 --- a/icom/ic910.c +++ b/icom/ic910.c @@ -3,7 +3,7 @@ * Contributed by Francois Retief * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic910.c,v 1.8 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic910.c,v 1.9 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -29,6 +29,7 @@ #include #include "icom.h" +#include "idx_builtin.h" /* * It seems some IC910 out there have weird firmware. Uncomment the following @@ -195,14 +196,14 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq) RIG_LEVEL_ATT| \ RIG_LEVEL_PREAMP) -#define IC910_STR_CAL { 0, { } } +#define IC910_STR_CAL { 0, { } } /* FIXME */ + /* */ static const struct icom_priv_caps ic910_priv_caps = { 0x60, /* default address */ 0, /* 731 mode */ - ic910_ts_sc_list, - IC910_STR_CAL + ic910_ts_sc_list }; const struct rig_caps ic910_caps = { @@ -228,11 +229,13 @@ const struct rig_caps ic910_caps = { .retry = 3, .has_get_func = IC910_FUNC_ALL, .has_set_func = IC910_FUNC_ALL | RIG_FUNC_RESUME, -.has_get_level = IC910_LEVEL_ALL | (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH), +.has_get_level = IC910_LEVEL_ALL | (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR), .has_set_level = IC910_LEVEL_ALL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, -.level_gran = {}, +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, +}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, @@ -288,9 +291,10 @@ const struct rig_caps ic910_caps = { RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { - {RIG_MODE_CW|RIG_MODE_SSB, kHz(2.3)}, /* buildin */ - {RIG_MODE_FM, kHz(15)}, /* buildin */ + {RIG_MODE_CW|RIG_MODE_SSB, kHz(2.3)}, /* builtin */ + {RIG_MODE_FM, kHz(15)}, /* builtin */ RIG_FLT_END, }, +.str_cal = IC910_STR_CAL, .priv = (void*)&ic910_priv_caps, .rig_init = icom_init, diff --git a/icom/ic970.c b/icom/ic970.c index b8b4ccdd1..386956649 100644 --- a/icom/ic970.c +++ b/icom/ic970.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of IC-970 and variations * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: ic970.c,v 1.4 2003-10-01 19:31:56 fillods Exp $ + * $Id: ic970.c,v 1.5 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -45,8 +45,7 @@ static const struct icom_priv_caps ic970_priv_caps = { 0x2e, /* default address */ 0, /* 731 mode */ - ic737_ts_sc_list, - IC970_STR_CAL + ic737_ts_sc_list }; const struct rig_caps ic970_caps = { diff --git a/icom/icr8500.c b/icom/icr8500.c index cf9cbcf27..cde7413c7 100644 --- a/icom/icr8500.c +++ b/icom/icr8500.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - IC-R8500 description * Copyright (c) 2000-2002 by Stephane Fillod * - * $Id: icr8500.c,v 1.17 2003-10-01 19:31:57 fillods Exp $ + * $Id: icr8500.c,v 1.18 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -27,6 +27,7 @@ #include #include "hamlib/rig.h" +#include "idx_builtin.h" #include "icom.h" @@ -35,15 +36,14 @@ #define ICR8500_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TSQL|RIG_FUNC_APF) -#define ICR8500_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_APF|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH) +#define ICR8500_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_APF|RIG_LEVEL_SQL|RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR) #define ICR8500_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) static const struct icom_priv_caps icr8500_priv_caps = { 0x4a, /* default address */ 0, /* 731 mode */ - r8500_ts_sc_list, - EMPTY_STR_CAL + r8500_ts_sc_list }; /* * ICR8500 rigs capabilities. @@ -76,7 +76,9 @@ const struct rig_caps icr8500_caps = { .has_set_level = RIG_LEVEL_SET(ICR8500_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ -.level_gran = {}, /* FIXME: granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, +}, .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS/DCS list */ .dcs_list = NULL, diff --git a/icom/omni.c b/icom/omni.c index a049bd023..3607f3217 100644 --- a/icom/omni.c +++ b/icom/omni.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of the TenTenc OMNI VI * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: omni.c,v 1.5 2003-10-01 19:31:57 fillods Exp $ + * $Id: omni.c,v 1.6 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -49,8 +49,7 @@ static const struct icom_priv_caps omnivip_priv_caps = { 0x04, /* default address */ 0, /* 731 mode */ - NULL, - OMNIVIP_STR_CAL + NULL }; const struct rig_caps omnivip_caps = { diff --git a/icom/optoscan.c b/icom/optoscan.c index a1181fc2b..17382dfe3 100644 --- a/icom/optoscan.c +++ b/icom/optoscan.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - OptoScan extensions * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: optoscan.c,v 1.9 2003-10-01 19:39:23 fillods Exp $ + * $Id: optoscan.c,v 1.10 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -458,7 +458,7 @@ int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if( level != RIG_LEVEL_AF ) { switch (level) { - case RIG_LEVEL_STRENGTH: + case RIG_LEVEL_RAWSTR: lvl_cn = C_RD_SQSM; lvl_sc = S_SML; break; @@ -507,8 +507,8 @@ int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } switch (level) { - case RIG_LEVEL_STRENGTH: - val->i = rig_raw2val(icom_val, &priv->str_cal); + case RIG_LEVEL_RAWSTR: + val->i = icom_val; break; case RIG_LEVEL_SQLSTAT: /* diff --git a/icom/os456.c b/icom/os456.c index bf2654463..d20679f83 100644 --- a/icom/os456.c +++ b/icom/os456.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of the OptoScan456 * Copyright (c) 2000-2003 by Stephane Fillod and Michael Smith * - * $Id: os456.c,v 1.8 2003-10-01 19:31:57 fillods Exp $ + * $Id: os456.c,v 1.9 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include #include +#include "idx_builtin.h" #include "icom.h" #include "tones.h" #include "token.h" @@ -41,7 +42,7 @@ extern struct confparams opto_ext_parms[]; #define OS456_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define OS456_VFO_ALL (RIG_VFO_A) -#define OS456_LEVELS (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF) +#define OS456_LEVELS (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF) #define OS456_SCAN_OPS (RIG_SCAN_PLT) /* * The signal strength data is in the form of two bytes, each consisting @@ -68,7 +69,6 @@ static const struct icom_priv_caps os456_priv_caps = { 0x80, /* default address */ 0, /* 731 mode */ NULL, - OS456_STR_CAL, .settle_time = 20, }; @@ -99,7 +99,9 @@ const struct rig_caps os456_caps = { .has_set_level = RIG_LEVEL_AF, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, -.level_gran = {}, +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, +}, .parm_gran = {}, .ctcss_list = full_ctcss_list, .dcs_list = full_dcs_list, @@ -142,6 +144,7 @@ const struct rig_caps os456_caps = { {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, kHz(15)}, /* TBC */ RIG_FLT_END, }, +.str_cal = OS456_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, diff --git a/icom/os535.c b/icom/os535.c index 68c2918af..914654ae8 100644 --- a/icom/os535.c +++ b/icom/os535.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - description of the OptoScan535 * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: os535.c,v 1.7 2003-10-01 19:31:57 fillods Exp $ + * $Id: os535.c,v 1.8 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include #include +#include "idx_builtin.h" #include "icom.h" #include "tones.h" #include "optoscan.h" @@ -40,7 +41,7 @@ extern struct confparams opto_ext_parms[]; #define OS535_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define OS535_VFO_ALL (RIG_VFO_A) -#define OS535_LEVELS (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF) +#define OS535_LEVELS (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF) #define OS535_SCAN_OPS (RIG_SCAN_PLT) #define OS535_STR_CAL { 2, { \ @@ -60,7 +61,6 @@ static const struct icom_priv_caps os535_priv_caps = { 0x80, /* default address */ 0, /* 731 mode */ NULL, - OS535_STR_CAL, .settle_time = 12, }; @@ -91,7 +91,9 @@ const struct rig_caps os535_caps = { .has_set_level = RIG_LEVEL_AF, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, -.level_gran = {}, +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, +}, .parm_gran = {}, .ctcss_list = full_ctcss_list, .dcs_list = full_dcs_list, @@ -134,6 +136,7 @@ const struct rig_caps os535_caps = { {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, kHz(15)}, /* TBC */ RIG_FLT_END, }, +.str_cal = OS535_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, diff --git a/jrc/jrc.c b/jrc/jrc.c index 976c5f6be..275467222 100644 --- a/jrc/jrc.c +++ b/jrc/jrc.c @@ -2,7 +2,7 @@ * Hamlib JRC backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: jrc.c,v 1.10 2003-10-20 22:15:01 fillods Exp $ + * $Id: jrc.c,v 1.11 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -413,17 +413,14 @@ int jrc_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) */ int jrc_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { - struct jrc_priv_caps *priv; int retval, lvl_len, lvl; char lvlbuf[BUFSZ]; - priv = (struct jrc_priv_caps*)rig->caps->priv; - /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { - case RIG_LEVEL_STRENGTH: + case RIG_LEVEL_RAWSTR: /* read A/D converted value */ retval = jrc_transaction (rig, "M" EOM, 2, lvlbuf, &lvl_len); if (retval != RIG_OK) @@ -436,7 +433,7 @@ int jrc_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } lvlbuf[4] = '\0'; - val->i = rig_raw2val(atoi(lvlbuf+1), &priv->str_cal); + val->i = atoi(lvlbuf+1); break; case RIG_LEVEL_SQLSTAT: @@ -579,12 +576,9 @@ int jrc_set_parm(RIG *rig, setting_t parm, value_t val) */ int jrc_get_parm(RIG *rig, setting_t parm, value_t *val) { - struct jrc_priv_caps *priv; int retval, lvl_len, i; char lvlbuf[BUFSZ]; - priv = (struct jrc_priv_caps*)rig->caps->priv; - /* Optimize: * sort the switch cases with the most frequent first */ @@ -867,6 +861,7 @@ DECLARE_INITRIG_BACKEND(jrc) { rig_debug(RIG_DEBUG_VERBOSE, "jrc: _init called\n"); + rig_register(&nrd535_caps); rig_register(&nrd545_caps); return RIG_OK; diff --git a/jrc/jrc.h b/jrc/jrc.h index 5968b351d..6685e576a 100644 --- a/jrc/jrc.h +++ b/jrc/jrc.h @@ -2,7 +2,7 @@ * Hamlib JRC backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: jrc.h,v 1.5 2003-04-16 22:30:40 fillods Exp $ + * $Id: jrc.h,v 1.6 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -24,11 +24,6 @@ #define _JRC_H 1 #include -#include - -struct jrc_priv_caps { - cal_table_t str_cal; -}; int jrc_open(RIG *rig); int jrc_close(RIG *rig); @@ -50,6 +45,7 @@ int jrc_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int jrc_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); int jrc_decode_event(RIG *rig); +extern const struct rig_caps nrd535_caps; extern const struct rig_caps nrd545_caps; diff --git a/jrc/nrd545.c b/jrc/nrd545.c index 39167845d..33427c373 100644 --- a/jrc/nrd545.c +++ b/jrc/nrd545.c @@ -2,7 +2,7 @@ * Hamlib JRC backend - NRD-545 DSP description * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: nrd545.c,v 1.5 2003-10-01 19:31:57 fillods Exp $ + * $Id: nrd545.c,v 1.6 2003-11-16 17:14:43 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -27,6 +27,7 @@ #include #include +#include "idx_builtin.h" #include "jrc.h" @@ -34,7 +35,7 @@ #define NRD545_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_LOCK|RIG_FUNC_ABM|RIG_FUNC_BC|RIG_FUNC_NR) -#define NRD545_LEVEL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_AGC|RIG_LEVEL_IF|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL) +#define NRD545_LEVEL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_AGC|RIG_LEVEL_IF|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL) /* FIXME: add more from "U" command */ #define NRD545_PARM (RIG_PARM_TIME|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP) @@ -49,10 +50,6 @@ { 255, 60 }, \ } } -static const struct jrc_priv_caps nrd545_priv_caps = { - NRD545_STR_CAL -}; - /* * NRD-545 rig capabilities. * @@ -85,7 +82,9 @@ const struct rig_caps nrd545_caps = { .has_set_level = RIG_LEVEL_SET(NRD545_LEVEL), .has_get_parm = RIG_PARM_TIME, .has_set_parm = RIG_PARM_SET(NRD545_PARM), -.level_gran = {}, /* FIXME: granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 255, +}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, @@ -138,7 +137,7 @@ const struct rig_caps nrd545_caps = { {NRD545_MODES, kHz(4.5)}, RIG_FLT_END, }, -.priv = (void*)&nrd545_priv_caps, +.str_cal = NRD545_STR_CAL, .rig_open = jrc_open, .rig_close = jrc_close, diff --git a/kachina/505dsp.c b/kachina/505dsp.c index 6b0e284dc..36ae5e901 100644 --- a/kachina/505dsp.c +++ b/kachina/505dsp.c @@ -2,7 +2,7 @@ * Hamlib Kachina backend - 505DSP description * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: 505dsp.c,v 1.5 2003-10-01 19:31:58 fillods Exp $ + * $Id: 505dsp.c,v 1.6 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -36,7 +36,7 @@ #define K505DSP_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TONE|RIG_FUNC_COMP) -#define K505DSP_LEVEL_ALL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH) +#define K505DSP_LEVEL_ALL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH) #define K505DSP_PARM_ALL (RIG_PARM_NONE) @@ -47,10 +47,6 @@ { 127, 20 }, \ } } -static const struct kachina_priv_caps k505dsp_priv_caps = { - K505DSP_STR_CAL -}; - /* * 505DSP rig capabilities. * @@ -153,7 +149,7 @@ const struct rig_caps k505dsp_caps = { {RIG_MODE_FM, kHz(6)}, RIG_FLT_END, }, -.priv = (void*)&k505dsp_priv_caps, +.str_cal = K505DSP_STR_CAL, .set_freq = kachina_set_freq, .set_mode = kachina_set_mode, diff --git a/kachina/kachina.h b/kachina/kachina.h index be8c5801a..591e40bf9 100644 --- a/kachina/kachina.h +++ b/kachina/kachina.h @@ -2,7 +2,7 @@ * Hamlib Kachina backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: kachina.h,v 1.4 2003-04-16 22:30:41 fillods Exp $ + * $Id: kachina.h,v 1.5 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -24,13 +24,8 @@ #define _KACHINA_H 1 #include -#include #include -struct kachina_priv_caps { - cal_table_t str_cal; -}; - int kachina_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int kachina_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); diff --git a/src/cal.h b/src/cal.h index 935e37711..f4fbe77df 100644 --- a/src/cal.h +++ b/src/cal.h @@ -2,7 +2,7 @@ * Hamlib Interface - calibration header * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton * - * $Id: cal.h,v 1.4 2001-07-13 19:08:15 f4cfe Exp $ + * $Id: cal.h,v 1.5 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -25,32 +25,6 @@ #include - -/* add rig_set_cal(cal_table), rig_get_calstat(rawmin,rawmax,cal_table), */ - -#define MAX_CAL_LENGTH 32 - -/* - * cal_table_t is a data type suited to hold linear calibration - * cal_table_t.size tell the number of plot cal_table_t.table contains - * If a value is below or equal to cal_table_t.table[0].raw, - * rig_raw2val() will return cal_table_t.table[0].val - * If a value is greater or equal to cal_table_t.table[cal_table_t.size-1].raw, - * rig_raw2val() will return cal_table_t.table[cal_table_t.size-1].val - */ -struct cal_cell { - int raw; - int val; -}; -struct cal_table { - int size; - struct cal_cell table[MAX_CAL_LENGTH]; -}; - -typedef struct cal_table cal_table_t; - -#define EMPTY_STR_CAL { 0, { { 0, 0 }, } } - extern HAMLIB_EXPORT(float) rig_raw2val(int rawval, const cal_table_t *cal); #endif /* _CAL_H */ diff --git a/src/idx_builtin.h b/src/idx_builtin.h index fb595d9ba..4f301e3bc 100644 --- a/src/idx_builtin.h +++ b/src/idx_builtin.h @@ -2,7 +2,7 @@ * Hamlib Interface - setting2idx for builtin constants * Copyright (c) 2002 by Stephane Fillod and Frank Singleton * - * $Id: idx_builtin.h,v 1.1 2002-11-04 22:23:09 fillods Exp $ + * $Id: idx_builtin.h,v 1.2 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -130,6 +130,7 @@ #define LVL_VOXDELAY setting2idx_builtin(RIG_LEVEL_VOXDELAY) #define LVL_ANTIVOX setting2idx_builtin(RIG_LEVEL_ANTIVOX) +#define LVL_RAWSTR setting2idx_builtin(RIG_LEVEL_RAWSTR) #define LVL_SQLSTAT setting2idx_builtin(RIG_LEVEL_SQLSTAT) #define LVL_SWR setting2idx_builtin(RIG_LEVEL_SWR) #define LVL_ALC setting2idx_builtin(RIG_LEVEL_ALC) diff --git a/src/rig.c b/src/rig.c index 99324d289..b07fd3657 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2,7 +2,7 @@ * Hamlib Interface - main file * Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton * - * $Id: rig.c,v 1.77 2003-10-01 19:44:00 fillods Exp $ + * $Id: rig.c,v 1.78 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -327,6 +327,9 @@ RIG *rig_init(rig_model_t rig_model) sizeof(struct tuning_step_list)*TSLSTSIZ); memcpy(rs->filters, caps->filters, sizeof(struct filter_list)*FLTLSTSIZ); + memcpy(&rs->str_cal, &caps->str_cal, + sizeof(cal_table_t)); + memcpy(rs->chan_list, caps->chan_list, sizeof(chan_t)*CHANLSTSIZ); rs->has_get_func = caps->has_get_func; @@ -336,6 +339,14 @@ RIG *rig_init(rig_model_t rig_model) rs->has_get_parm = caps->has_get_parm; rs->has_set_parm = caps->has_set_parm; + /* emulation by frontend */ + if ((caps->has_get_level & RIG_LEVEL_STRENGTH) == 0 && + (caps->has_get_level & RIG_LEVEL_RAWSTR) == RIG_LEVEL_RAWSTR) + rs->has_get_level |= RIG_LEVEL_STRENGTH; + + memcpy(rs->level_gran, caps->level_gran, sizeof(gran_t)*RIG_SETTING_MAX); + memcpy(rs->parm_gran, caps->parm_gran, sizeof(gran_t)*RIG_SETTING_MAX); + rs->max_rit = caps->max_rit; rs->max_xit = caps->max_xit; rs->max_ifshift = caps->max_ifshift; diff --git a/src/settings.c b/src/settings.c index 495872da7..34cc0c1b1 100644 --- a/src/settings.c +++ b/src/settings.c @@ -3,16 +3,16 @@ * \ingroup rig * \brief func/level/parm interface * \author Stephane Fillod - * \date 2000-2002 + * \date 2000-2003 * * Hamlib interface is a frontend implementing wrapper functions. */ /* * Hamlib Interface - func/level/parm - * Copyright (c) 2000-2002 by Stephane Fillod + * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: settings.c,v 1.2 2003-03-27 23:45:27 fillods Exp $ + * $Id: settings.c,v 1.3 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -42,7 +42,8 @@ #include #include -#include +#include "hamlib/rig.h" +#include "cal.h" #ifndef DOC_HIDDEN @@ -137,6 +138,22 @@ int rig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (caps->get_level == NULL || !rig_has_get_level(rig,level)) return -RIG_ENAVAIL; + /* + * Special case(frontend emulation): calibrated S-meter reading + */ + if (level == RIG_LEVEL_STRENGTH && + (caps->has_get_level & RIG_LEVEL_STRENGTH) == 0 && + rig_has_get_level(rig,RIG_LEVEL_RAWSTR)) { + + value_t rawstr; + retcode = rig_get_level(rig, vfo, RIG_LEVEL_RAWSTR, &rawstr); + if (retcode != RIG_OK) + return retcode; + val->i = (int)rig_raw2val(rawstr.i, &rig->state.str_cal); + return RIG_OK; + } + + if ((caps->targetable_vfo&RIG_TARGETABLE_ALL) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_level(rig, vfo, level, val); diff --git a/tentec/argonaut.c b/tentec/argonaut.c index 2c1aa9a04..489406b5f 100644 --- a/tentec/argonaut.c +++ b/tentec/argonaut.c @@ -2,7 +2,7 @@ * Hamlib TenTenc backend - TT-516 PC-Radio description * Copyright (c) 2003 by Stephane Fillod * - * $Id: argonaut.c,v 1.2 2003-10-01 19:32:02 fillods Exp $ + * $Id: argonaut.c,v 1.3 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -36,7 +36,7 @@ #define TT516_FUNCS (RIG_FUNC_NONE) -#define TT516_LEVELS (RIG_LEVEL_STRENGTH|/* RIG_LEVEL_NB| */ \ +#define TT516_LEVELS (RIG_LEVEL_RAWSTR|/* RIG_LEVEL_NB| */ \ RIG_LEVEL_SQL|/*RIG_LEVEL_PBT|*/ \ RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD| \ RIG_LEVEL_SWR|RIG_LEVEL_ATT) diff --git a/tentec/pegasus.c b/tentec/pegasus.c index a97ec7fd8..b0e1f1476 100644 --- a/tentec/pegasus.c +++ b/tentec/pegasus.c @@ -2,7 +2,7 @@ * Hamlib TenTenc backend - TT-550 PC-Radio description * Copyright (c) 2002-2003 by Stephane Fillod * - * $Id: pegasus.c,v 1.3 2003-10-01 19:32:03 fillods Exp $ + * $Id: pegasus.c,v 1.4 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -27,6 +27,7 @@ #include #include +#include "idx_builtin.h" #include "tentec.h" @@ -36,7 +37,7 @@ #define TT550_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_VOX|RIG_FUNC_ANF| \ RIG_FUNC_NR|RIG_FUNC_NB|RIG_FUNC_COMP) -#define TT550_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_STRENGTH| \ +#define TT550_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_RAWSTR| \ RIG_LEVEL_RF|RIG_LEVEL_COMP|RIG_LEVEL_VOX|RIG_LEVEL_SQL| \ RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD| \ RIG_LEVEL_SWR|RIG_LEVEL_ATT) @@ -52,10 +53,6 @@ { 10000, 20 }, \ } } -static const struct tentec_priv_caps tt550_priv_caps = { - TT550_STR_CAL -}; - /* * tt550 receiver capabilities. * @@ -92,7 +89,9 @@ const struct rig_caps tt550_caps = { .has_set_level = RIG_LEVEL_SET(TT550_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, -.level_gran = {}, /* FIXME: granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 99999, +}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, @@ -142,7 +141,7 @@ const struct rig_caps tt550_caps = { {RIG_MODE_AM|RIG_MODE_FM, kHz(8)}, RIG_FLT_END, }, -.priv = (void*)&tt550_priv_caps, +.str_cal = TT550_STR_CAL, .rig_init = tentec_init, .rig_cleanup = tentec_cleanup, diff --git a/tentec/rx320.c b/tentec/rx320.c index ec8b3c081..2ab01d27c 100644 --- a/tentec/rx320.c +++ b/tentec/rx320.c @@ -2,7 +2,7 @@ * Hamlib TenTenc backend - RX-320 PC-Radio description * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: rx320.c,v 1.4 2003-10-01 19:32:03 fillods Exp $ + * $Id: rx320.c,v 1.5 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -27,12 +27,13 @@ #include #include +#include "idx_builtin.h" #include "tentec.h" #define RX320_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB) -#define RX320_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_STRENGTH) +#define RX320_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_RAWSTR) #define RX320_VFO (RIG_VFO_A) @@ -45,10 +46,6 @@ { 10000, 20 }, \ } } -static const struct tentec_priv_caps rx320_priv_caps = { - RX320_STR_CAL -}; - /* * rx320 receiver capabilities. * @@ -85,7 +82,9 @@ const struct rig_caps rx320_caps = { .has_set_level = RIG_LEVEL_SET(RX320_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, -.level_gran = {}, /* FIXME: granularity */ +.level_gran = { + [LVL_RAWSTR].min.i = 0, [LVL_RAWSTR].max.i = 99999, +}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, @@ -120,7 +119,7 @@ const struct rig_caps rx320_caps = { {RIG_MODE_AM, kHz(6)}, RIG_FLT_END, }, -.priv = (void*)&rx320_priv_caps, +.str_cal = RX320_STR_CAL, .rig_init = tentec_init, .rig_cleanup = tentec_cleanup, diff --git a/tentec/tentec.c b/tentec/tentec.c index 9a073ad5b..a536f81b6 100644 --- a/tentec/tentec.c +++ b/tentec/tentec.c @@ -2,7 +2,7 @@ * Hamlib Tentec backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: tentec.c,v 1.11 2003-10-01 19:32:03 fillods Exp $ + * $Id: tentec.c,v 1.12 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -92,7 +92,6 @@ int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int * int tentec_init(RIG *rig) { struct tentec_priv_data *priv; - struct tentec_priv_caps *priv_caps; priv = (struct tentec_priv_data*)malloc(sizeof(struct tentec_priv_data)); @@ -100,7 +99,6 @@ int tentec_init(RIG *rig) /* whoops! memory shortage! */ return -RIG_ENOMEM; } - priv_caps = (struct tentec_priv_caps *)rig->caps->priv; memset(priv, 0, sizeof(struct tentec_priv_data)); @@ -113,7 +111,6 @@ int tentec_init(RIG *rig) priv->cwbfo = 0; priv->agc = 0.5; /* medium */ priv->lnvol = priv->spkvol = 0.0; /* mute */ - memcpy(&priv->str_cal, &priv_caps->str_cal, sizeof(cal_table_t)); rig->state.priv = (rig_ptr_t)priv; @@ -383,7 +380,7 @@ int tentec_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) * sort the switch cases with the most frequent first */ switch (level) { - case RIG_LEVEL_STRENGTH: + case RIG_LEVEL_RAWSTR: /* read A/D converted value */ lvl_len = 4; retval = tentec_transaction (rig, "X" EOM, 2, lvlbuf, &lvl_len); @@ -399,7 +396,7 @@ int tentec_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) lvlbuf[3] = '\0'; rig_debug(RIG_DEBUG_VERBOSE,"tentec_get_level: cmd=%c,hi=%d,lo=%d\n", lvlbuf[0],lvlbuf[1],lvlbuf[2]); - val->i = rig_raw2val((lvlbuf[1]<<8) + lvlbuf[2], &priv->str_cal); + val->i = (lvlbuf[1]<<8) + lvlbuf[2]; break; case RIG_LEVEL_AGC: diff --git a/tentec/tentec.h b/tentec/tentec.h index 206ba12b8..6d45994f8 100644 --- a/tentec/tentec.h +++ b/tentec/tentec.h @@ -2,7 +2,7 @@ * Hamlib Tentec backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: tentec.h,v 1.6 2003-05-12 22:29:59 fillods Exp $ + * $Id: tentec.h,v 1.7 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -24,11 +24,6 @@ #define _TENTEC_H 1 #include -#include - -struct tentec_priv_caps { - cal_table_t str_cal; -}; struct tentec_priv_data { rmode_t mode; /* detection mode */ @@ -43,9 +38,6 @@ struct tentec_priv_data { int ctf; /* Coarse Tune Factor */ int ftf; /* Fine Tune Factor */ int btf; /* Bfo Tune Factor, btval is ignored by RX-320 in AM MODE */ - - /* S-meter calibration data */ - cal_table_t str_cal; }; int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len); diff --git a/tests/rigctl.1 b/tests/rigctl.1 index 3be602e60..46462f9eb 100644 --- a/tests/rigctl.1 +++ b/tests/rigctl.1 @@ -213,7 +213,7 @@ AGC, BKINDL, BAL, METER, VOXGAIN, ANTIVOX. Plus "extra" levels. .TP .B l, get_level Get level value: also -SWR, ALC, SQLSTAT, STRENGTH. +SWR, ALC, SQLSTAT, STRENGTH, RAWSTR. .TP .B P, set_parm Set parm/value: diff --git a/yaesu/ft1000mp.c b/yaesu/ft1000mp.c index 30eb7855b..b84d4ea64 100644 --- a/yaesu/ft1000mp.c +++ b/yaesu/ft1000mp.c @@ -4,7 +4,7 @@ * This shared library provides an API for communicating * via serial interface to an FT-1000MP using the "CAT" interface * - * $Id: ft1000mp.c,v 1.2 2003-04-07 22:42:00 fillods Exp $ + * $Id: ft1000mp.c,v 1.3 2003-11-16 17:14:44 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -130,7 +130,7 @@ static const yaesu_cmd_set_t ncmd[] = { #define FT1000MP_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_LOCK /* |RIG_FUNC_TUNER */) /* FIXME */ -#define FT1000MP_LEVEL_GET (RIG_LEVEL_STRENGTH|RIG_LEVEL_ALC|RIG_LEVEL_SWR|RIG_LEVEL_RFPOWER|RIG_LEVEL_COMP|RIG_LEVEL_MICGAIN|RIG_LEVEL_CWPITCH) +#define FT1000MP_LEVEL_GET (RIG_LEVEL_RAWSTR|RIG_LEVEL_ALC|RIG_LEVEL_SWR|RIG_LEVEL_RFPOWER|RIG_LEVEL_COMP|RIG_LEVEL_MICGAIN|RIG_LEVEL_CWPITCH) #define FT1000MP_VFOS (RIG_VFO_A|RIG_VFO_B) #define FT1000MP_ANTS 0 /* FIXME: declare antenna connectors: ANT-A, ANT-B, RX ANT */ @@ -189,7 +189,6 @@ struct ft1000mp_priv_data { unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ yaesu_cmd_set_t pcs[FT1000MP_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[2*FT1000MP_STATUS_UPDATE_LENGTH];/* returned data--max value, some are less */ - cal_table_t str_cal; }; @@ -298,6 +297,7 @@ const struct rig_caps ft1000mp_caps = { RIG_FLT_END, }, + .str_cal = FT1000MP_STR_CAL, .priv = NULL, /* private data */ @@ -331,7 +331,6 @@ const struct rig_caps ft1000mp_caps = { int ft1000mp_init(RIG *rig) { struct ft1000mp_priv_data *p; - cal_table_t cal = FT1000MP_STR_CAL; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: ft1000mp_init called \n"); @@ -349,7 +348,6 @@ int ft1000mp_init(RIG *rig) { p->pacing = FT1000MP_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ p->read_update_delay = FT1000MP_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */ - memcpy(&p->str_cal, &cal, sizeof(cal)); rig->state.priv = (void*)p; @@ -930,7 +928,7 @@ int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) * sort the switch cases with the most frequent first */ switch (level) { - case RIG_LEVEL_STRENGTH: + case RIG_LEVEL_RAWSTR: if (vfo == RIG_VFO_CURR) vfo = priv->current_vfo; @@ -974,8 +972,8 @@ int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } switch (level) { - case RIG_LEVEL_STRENGTH: - val->i = rig_raw2val(lvl_data[0], &priv->str_cal); + case RIG_LEVEL_RAWSTR: + val->i = lvl_data[0]; break; default: if (RIG_LEVEL_IS_FLOAT(level))