From 842e769948deb3f6dd395872c0ee16f6c605ec1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Tue, 4 Aug 2009 15:21:14 +0000 Subject: [PATCH] - implemented RIG_FUNC_AFC - fixed some PCR1000 filter list, added set/get_powerstat - wire up RIG_LEVEL_CWPITCH and RIG_FUNC_VSC - moved some prototypes to pcr.c git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2717 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- pcr/pcr.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++-- pcr/pcr.h | 18 ---------------- pcr/pcr1000.c | 14 +++++++----- pcr/pcr1500.c | 3 ++- 4 files changed, 69 insertions(+), 26 deletions(-) diff --git a/pcr/pcr.c b/pcr/pcr.c index 593d90751..f876fb8a3 100644 --- a/pcr/pcr.c +++ b/pcr/pcr.c @@ -101,6 +101,26 @@ struct pcr_country pcr_countries[] = { { 0x0F, "FCC Generic 2" }, }; + +static int pcr_set_volume(RIG *rig, float level); +static int pcr_set_squelch(RIG *rig, float level); +static int pcr_set_if_shift(RIG *rig, int level); +static int pcr_set_agc(RIG *rig, int status); // J45xx +static int pcr_set_afc(RIG *rig, int status); // LD820xx +static int pcr_set_nb(RIG *rig, int status); // J46xx +static int pcr_set_attenuator(RIG *rig, int status); // J47xx +static int pcr_set_anl(RIG *rig, int status); // J4Dxx + +static int pcr_set_bfo_shift(RIG *rig, int level); // J4Axx +static int pcr_set_vsc(RIG *rig, int level); // J50xx +static int pcr_set_dsp(RIG *rig, int level); // J80xx +static int pcr_set_dsp_state(RIG *rig, int level); // J8100=off J8101=on +static int pcr_set_dsp_noise_reducer(RIG *rig, int level); // J82xx +static int pcr_set_dsp_auto_notch(RIG *rig, int level); // J83xx + +static int pcr_check_ok(RIG * rig); + + #define PCR_COUNTRIES (sizeof(pcr_countries) / sizeof(struct pcr_country)) static int @@ -811,6 +831,9 @@ pcr_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val) case RIG_LEVEL_IF: return pcr_set_if_shift(rig, val.i); + case RIG_LEVEL_CWPITCH: /* BFO */ + return pcr_set_bfo_shift(rig, val.i); + case RIG_LEVEL_AGC: /* this is implemented as a level even though it is a binary function * as far as PCR is concerned. There is no AGC on/off for a "set func", @@ -952,6 +975,14 @@ pcr_set_func(RIG * rig, vfo_t vfo, setting_t func, int status) break; + case RIG_FUNC_AFC: /* Tracking Filter */ + if (status == 0) + return pcr_set_afc(rig, 0); + else + return pcr_set_afc(rig, 1); + + break; + case RIG_FUNC_TSQL: if (priv->last_mode != MD_FM) return -RIG_ERJCTED; @@ -961,6 +992,14 @@ pcr_set_func(RIG * rig, vfo_t vfo, setting_t func, int status) else return pcr_set_ctcss_sql(rig, vfo, priv->last_ctcss_sql); + case RIG_FUNC_VSC: /* Voice Scan Control */ + if (status == 0) + return pcr_set_vsc(rig, 0); + else + return pcr_set_vsc(rig, 1); + + break; + default: rig_debug(RIG_DEBUG_VERBOSE, "%s: default\n", __func__); return -RIG_EINVAL; @@ -1149,6 +1188,23 @@ pcr_set_agc(RIG * rig, int status) return err; } +/* + * pcr_set_afc(RIG *rig, int level); + * Assumes rig!=NULL, rig->state.priv!=NULL + * + * Sets the Tracking Filter on or off based on the status argument. + * 00 = on, 01 (non zero) is off + * + * Format is LD820xx - where xx is 00 to ff in hex + * + */ +int +pcr_set_afc(RIG * rig, int status) +{ + rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %d\n", __func__, status); + return pcr_set_level_cmd(rig, "LD820", status ? 0 : 1); +} + /* * pcr_set_nb(RIG *rig, int level); * Assumes rig!=NULL, rig->state.priv!=NULL @@ -1212,14 +1268,14 @@ pcr_set_attenuator(RIG * rig, int status) * > 80 Plus shift (in 10 Hz steps) * 80 Centre * - * Format is J4Axx - where xx is 00 to FF in hex, and specifies 255 squelch levels + * Format is J4Axx - where xx is 00 to FF in hex, and specifies 255 levels * XXX command undocumented? */ int pcr_set_bfo_shift(RIG * rig, int level) { rig_debug(RIG_DEBUG_TRACE, "%s: level is %d\n", __func__, level); - return pcr_set_level_cmd(rig, "J4A", level); + return pcr_set_level_cmd(rig, "J4A", 0x80 + level/10); } /* diff --git a/pcr/pcr.h b/pcr/pcr.h index 1a47ca49b..7788becb8 100644 --- a/pcr/pcr.h +++ b/pcr/pcr.h @@ -85,30 +85,12 @@ int pcr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int pcr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int pcr_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val); -int pcr_set_comm_rate(RIG *rig, int baud_rate); - -static int pcr_set_volume(RIG *rig, float level); -static int pcr_set_squelch(RIG *rig, float level); -int pcr_set_if_shift(RIG *rig, int level); -int pcr_set_agc(RIG *rig, int status); // J45xx -int pcr_set_nb(RIG *rig, int status); // J46xx -int pcr_set_attenuator(RIG *rig, int status); // J47xx -int pcr_set_anl(RIG *rig, int status); // J4Dxx - -int pcr_set_bf0(RIG *rig, int level); // J4Axx -int pcr_set_vsc(RIG *rig, int level); // J50xx -int pcr_set_dsp(RIG *rig, int level); // J80xx -int pcr_set_dsp_state(RIG *rig, int level); // J8100=off J8101=on -int pcr_set_dsp_noise_reducer(RIG *rig, int level); // J82xx -int pcr_set_dsp_auto_notch(RIG *rig, int level); // J83xx - int pcr_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); int pcr_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); int pcr_set_trn(RIG * rig, int trn); int pcr_decode_event(RIG *rig); int pcr_set_powerstat(RIG * rig, powerstat_t status); int pcr_get_powerstat(RIG * rig, powerstat_t *status); -static int pcr_check_ok(RIG * rig); /* ------------------------------------------------------------------ */ diff --git a/pcr/pcr1000.c b/pcr/pcr1000.c index 02f08b355..d19e0c704 100644 --- a/pcr/pcr1000.c +++ b/pcr/pcr1000.c @@ -1,6 +1,6 @@ /* * Hamlib PCR backend - PCR-1000 description - * Copyright (c) 2001-2003 by Stephane Fillod and Darren Hatcher + * Copyright (c) 2001-2009 by Stephane Fillod and Darren Hatcher * * $Id: pcr1000.c,v 1.11 2009-01-27 19:05:59 fillods Exp $ * @@ -33,7 +33,8 @@ #define PCR1000_MODES ( RIG_MODE_AM | RIG_MODE_FM | RIG_MODE_WFM | RIG_MODE_CW | RIG_MODE_SSB ) -#define PCR1000_FUNC ( RIG_FUNC_NB | RIG_FUNC_TSQL | RIG_FUNC_NB | RIG_FUNC_ANF | RIG_FUNC_NR ) +#define PCR1000_FUNC ( RIG_FUNC_NB | RIG_FUNC_TSQL | RIG_FUNC_NB | \ + RIG_FUNC_ANF | RIG_FUNC_NR | RIG_FUNC_AFC ) #define PCR1000_LEVEL ( \ RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_SQL | RIG_LEVEL_IF | \ @@ -116,12 +117,12 @@ const struct rig_caps pcr1000_caps = { }, /* mode/filter list, remember: order matters! */ .filters = { + { RIG_MODE_FM | RIG_MODE_AM, kHz(15) }, + { RIG_MODE_FM | RIG_MODE_AM, kHz(6) }, { RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_AM, kHz(2.8)}, - { RIG_MODE_FM | RIG_MODE_AM, kHz(6) }, - { RIG_MODE_FM | RIG_MODE_AM, kHz(15) }, - { RIG_MODE_WFM | RIG_MODE_FM | RIG_MODE_AM, kHz(50) }, { RIG_MODE_WFM, kHz(230) }, + { RIG_MODE_WFM | RIG_MODE_FM | RIG_MODE_AM, kHz(50) }, RIG_FLT_END, }, @@ -153,4 +154,7 @@ const struct rig_caps pcr1000_caps = { .set_trn = pcr_set_trn, .decode_event = pcr_decode_event, + + .set_powerstat = pcr_set_powerstat, + .get_powerstat = pcr_get_powerstat, }; diff --git a/pcr/pcr1500.c b/pcr/pcr1500.c index 617da0b3e..270b924a1 100644 --- a/pcr/pcr1500.c +++ b/pcr/pcr1500.c @@ -35,7 +35,8 @@ #define PCR1500_MODES_NAR ( RIG_MODE_CW | RIG_MODE_SSB ) #define PCR1500_MODES ( PCR1500_MODES_NAR | PCR1500_MODES_WIDE ) -#define PCR1500_FUNC ( RIG_FUNC_NB | RIG_FUNC_TSQL | RIG_FUNC_NB | RIG_FUNC_ANF | RIG_FUNC_NR ) +#define PCR1500_FUNC ( RIG_FUNC_NB | RIG_FUNC_TSQL | RIG_FUNC_NB | \ + RIG_FUNC_ANF | RIG_FUNC_NR | RIG_FUNC_AFC ) #define PCR1500_LEVEL ( \ RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_SQL | RIG_LEVEL_IF | \