Prepare eventual move from freq_t as a "long long" to a "double" type.

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1569 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.0
Stéphane Fillod, F8CFE 2003-10-20 22:15:02 +00:00
rodzic 15a88a78dd
commit 91df9591f4
13 zmienionych plików z 107 dodań i 67 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Alinco backend - main file * Hamlib Alinco backend - main file
* Copyright (c) 2001-2003 by Stephane Fillod * Copyright (c) 2001-2003 by Stephane Fillod
* *
* $Id: alinco.c,v 1.17 2003-10-01 19:31:53 fillods Exp $ * $Id: alinco.c,v 1.18 2003-10-20 22:15:01 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -193,7 +193,7 @@ int alinco_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL; return -RIG_EINVAL;
/* at least 6 digits */ /* at least 6 digits */
freq_len = sprintf(freqbuf, AL CMD_RXFREQ "%06Ld" EOM, freq); freq_len = sprintf(freqbuf, AL CMD_RXFREQ "%06Ld" EOM, (long long)freq);
return alinco_transaction (rig, freqbuf, freq_len, NULL, NULL); return alinco_transaction (rig, freqbuf, freq_len, NULL, NULL);
} }
@ -233,7 +233,7 @@ int alinco_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/* extract RX freq */ /* extract RX freq */
freqbuf[16] = '\0'; freqbuf[16] = '\0';
sscanf(freqbuf+6, "%lld", freq); sscanf(freqbuf+6, "%"FREQFMT, freq);
return RIG_OK; return RIG_OK;
} }
@ -388,7 +388,7 @@ int alinco_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
return -RIG_EINVAL; return -RIG_EINVAL;
/* at least 6 digits */ /* at least 6 digits */
freq_len = sprintf(freqbuf, AL CMD_TXFREQ "%06Ld" EOM, tx_freq); freq_len = sprintf(freqbuf, AL CMD_TXFREQ "%06Ld" EOM, (long long)tx_freq);
retval = alinco_transaction (rig, freqbuf, freq_len, NULL, NULL); retval = alinco_transaction (rig, freqbuf, freq_len, NULL, NULL);
@ -410,7 +410,7 @@ int alinco_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
/* extract TX freq first, as RX kills freqbuf[16] */ /* extract TX freq first, as RX kills freqbuf[16] */
freqbuf[26] = '\0'; freqbuf[26] = '\0';
sscanf(freqbuf+16, "%lld", tx_freq); sscanf(freqbuf+16, "%"FREQFMT, tx_freq);
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - main file * Hamlib AOR backend - main file
* Copyright (c) 2000-2003 by Stephane Fillod * Copyright (c) 2000-2003 by Stephane Fillod
* *
* $Id: aor.c,v 1.25 2003-10-01 19:31:54 fillods Exp $ * $Id: aor.c,v 1.26 2003-10-20 22:15:01 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -112,22 +112,23 @@ int aor_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
unsigned char freqbuf[BUFSZ], ackbuf[BUFSZ]; unsigned char freqbuf[BUFSZ], ackbuf[BUFSZ];
int freq_len, ack_len, retval; int freq_len, ack_len, retval;
int lowhz; int lowhz;
long long f = (long long)freq;
/* /*
* actually, frequency must be like nnnnnnnnm0, * actually, frequency must be like nnnnnnnnm0,
* where m must be 0 or 5 (for 50Hz). * where m must be 0 or 5 (for 50Hz).
*/ */
lowhz = freq % 100; lowhz = f % 100;
freq /= 100; f /= 100;
if (lowhz < 25) if (lowhz < 25)
lowhz = 0; lowhz = 0;
else if (lowhz < 75) else if (lowhz < 75)
lowhz = 50; lowhz = 50;
else else
lowhz = 100; lowhz = 100;
freq = freq*100 + lowhz; f = f*100 + lowhz;
freq_len = sprintf(freqbuf,"RF%010lld" EOM, freq); freq_len = sprintf(freqbuf,"RF%010lld" EOM, f);
retval = aor_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len); retval = aor_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len);
if (retval != RIG_OK) if (retval != RIG_OK)
@ -145,6 +146,7 @@ int aor_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char *rfp; char *rfp;
int freq_len, retval; int freq_len, retval;
unsigned char freqbuf[BUFSZ]; unsigned char freqbuf[BUFSZ];
long long f;
retval = aor_transaction (rig, "RX" EOM, 3, freqbuf, &freq_len); retval = aor_transaction (rig, "RX" EOM, 3, freqbuf, &freq_len);
if (retval != RIG_OK) if (retval != RIG_OK)
@ -157,7 +159,8 @@ int aor_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EPROTO; return -RIG_EPROTO;
} }
sscanf(rfp+2,"%lld", freq); sscanf(rfp+2,"%lld", &f);
*freq = f;
return RIG_OK; return RIG_OK;
} }
@ -226,10 +229,10 @@ int aor_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
case RIG_MODE_AM: case RIG_MODE_AM:
switch(width) { switch(width) {
case RIG_PASSBAND_NORMAL: case RIG_PASSBAND_NORMAL:
case kHz(9): aormode = MD_AM; break; case s_kHz(9): aormode = MD_AM; break;
case kHz(12): aormode = MD_WAM; break; case s_kHz(12): aormode = MD_WAM; break;
case kHz(3): aormode = MD_NAM; break; case s_kHz(3): aormode = MD_NAM; break;
default: default:
rig_debug(RIG_DEBUG_ERR, rig_debug(RIG_DEBUG_ERR,
"aor_set_mode: unsupported passband %d %d\n", "aor_set_mode: unsupported passband %d %d\n",
@ -244,9 +247,9 @@ int aor_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
case RIG_MODE_FM: case RIG_MODE_FM:
switch(width) { switch(width) {
case RIG_PASSBAND_NORMAL: case RIG_PASSBAND_NORMAL:
case kHz(12): aormode = MD_NFM; break; case s_kHz(12): aormode = MD_NFM; break;
case kHz(9): aormode = MD_SFM; break; case s_kHz(9): aormode = MD_SFM; break;
default: default:
rig_debug(RIG_DEBUG_ERR, rig_debug(RIG_DEBUG_ERR,
"aor_set_mode: unsupported passband %d %d\n", "aor_set_mode: unsupported passband %d %d\n",

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib AOR backend - AR3000 description * Hamlib AOR backend - AR3000 description
* Copyright (c) 2000-2003 by Stephane Fillod * Copyright (c) 2000-2003 by Stephane Fillod
* *
* $Id: ar3000.c,v 1.2 2003-10-01 19:31:54 fillods Exp $ * $Id: ar3000.c,v 1.3 2003-10-20 22:15:01 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -202,13 +202,13 @@ int ar3k_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{ {
unsigned char freqbuf[BUFSZ]; unsigned char freqbuf[BUFSZ];
int freq_len, retval; int freq_len, retval;
int lowhz; unsigned lowhz;
/* /*
* actually, frequency must be like nnnn.nnnnm, * actually, frequency must be like nnnn.nnnnm,
* where m must be 0 or 5 (for 50Hz). * where m must be 0 or 5 (for 50Hz).
*/ */
lowhz = freq % 100; lowhz = ((unsigned)freq) % 100;
freq /= 100; freq /= 100;
if (lowhz < 25) if (lowhz < 25)
lowhz = 0; lowhz = 0;
@ -248,7 +248,7 @@ int ar3k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rfp = strchr(freqbuf, 'Y'); rfp = strchr(freqbuf, 'Y');
if (!rfp) if (!rfp)
return -RIG_EPROTO; return -RIG_EPROTO;
sscanf(rfp+1,"%lld", freq); sscanf(rfp+1,"%"FREQFMT, freq);
*freq *= 10; *freq *= 10;
return RIG_OK; return RIG_OK;

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Drake backend - main file * Hamlib Drake backend - main file
* Copyright (c) 2001-2003 by Stephane Fillod * Copyright (c) 2001-2003 by Stephane Fillod
* *
* $Id: drake.c,v 1.6 2003-10-01 19:31:54 fillods Exp $ * $Id: drake.c,v 1.7 2003-10-20 22:15:01 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -98,7 +98,7 @@ int drake_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
* 10Hz resolution * 10Hz resolution
* TODO: round nearest? * TODO: round nearest?
*/ */
freq_len = sprintf(freqbuf,"F%07Ld" EOM, freq/10); freq_len = sprintf(freqbuf,"F%07d" EOM, (unsigned int)freq/10);
retval = drake_transaction(rig, freqbuf, freq_len, ackbuf, &ack_len); retval = drake_transaction(rig, freqbuf, freq_len, ackbuf, &ack_len);
return retval; return retval;

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib CI-V backend - IC-R7000 description * Hamlib CI-V backend - IC-R7000 description
* Copyright (c) 2000-2003 by Stephane Fillod * Copyright (c) 2000-2003 by Stephane Fillod
* *
* $Id: icr7000.c,v 1.5 2003-10-01 19:31:57 fillods Exp $ * $Id: icr7000.c,v 1.6 2003-10-20 22:15:01 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -55,7 +55,7 @@ const struct rig_caps icr7000_caps = {
.rig_model = RIG_MODEL_ICR7000, .rig_model = RIG_MODEL_ICR7000,
.model_name = "ICR-7000", .model_name = "ICR-7000",
.mfg_name = "Icom", .mfg_name = "Icom",
.version = "0.2", .version = "0.2.1",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_ALPHA, .status = RIG_STATUS_ALPHA,
.rig_type = RIG_TYPE_RECEIVER, .rig_type = RIG_TYPE_RECEIVER,
@ -162,14 +162,16 @@ const struct rig_caps icr7000_caps = {
*/ */
static int r7000_set_freq(RIG *rig, vfo_t vfo, freq_t freq) static int r7000_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{ {
long long f = (long long)freq;
/* /*
* The R7000 cannot set freqencies higher than 1GHz, * The R7000 cannot set freqencies higher than 1GHz,
* this is done by flipping a switch on the front panel and * this is done by flipping a switch on the front panel and
* stripping the most significant digit. * stripping the most significant digit.
* This is the only change with the common icom_set_freq * This is the only change with the common icom_set_freq
*/ */
freq %= GHz(1); f %= (long long)GHz(1);
return icom_set_freq(rig, vfo, freq); return icom_set_freq(rig, vfo, (freq_t)f);
} }

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - API header * Hamlib Interface - API header
* Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton * Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton
* *
* $Id: rig.h,v 1.86 2003-10-01 19:50:41 fillods Exp $ * $Id: rig.h,v 1.87 2003-10-20 22:15:01 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -255,6 +255,7 @@ typedef enum {
* Hamlib has no support yet for fractional number of Hertz. * Hamlib has no support yet for fractional number of Hertz.
*/ */
typedef signed long long freq_t; typedef signed long long freq_t;
#define FREQFMT "lli"
/** /**
* \brief Short frequency type * \brief Short frequency type
@ -267,6 +268,11 @@ typedef signed long shortfreq_t;
#define MHz(f) ((freq_t)((f)*(freq_t)1000000)) #define MHz(f) ((freq_t)((f)*(freq_t)1000000))
#define GHz(f) ((freq_t)((f)*(freq_t)1000000000)) #define GHz(f) ((freq_t)((f)*(freq_t)1000000000))
#define s_Hz(f) ((shortfreq_t)(f))
#define s_kHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000))
#define s_MHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000000))
#define s_GHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000000000))
#define RIG_FREQ_NONE Hz(0) #define RIG_FREQ_NONE Hz(0)
@ -329,7 +335,7 @@ typedef int vfo_t;
#define RIG_TARGETABLE_ALL 0xffffffffU #define RIG_TARGETABLE_ALL 0xffffffffU
#define RIG_PASSBAND_NORMAL Hz(0) #define RIG_PASSBAND_NORMAL s_Hz(0)
/** /**
* \brief Passband width, in Hz * \brief Passband width, in Hz
* \sa rig_passband_normal, rig_passband_narrow, rig_passband_wide * \sa rig_passband_normal, rig_passband_narrow, rig_passband_wide

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib JRC backend - main file * Hamlib JRC backend - main file
* Copyright (c) 2001-2003 by Stephane Fillod * Copyright (c) 2001-2003 by Stephane Fillod
* *
* $Id: jrc.c,v 1.9 2003-10-01 19:31:57 fillods Exp $ * $Id: jrc.c,v 1.10 2003-10-20 22:15:01 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -123,7 +123,7 @@ int jrc_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (freq >= GHz(10)) if (freq >= GHz(10))
return -RIG_EINVAL; return -RIG_EINVAL;
freq_len = sprintf(freqbuf, "F%10Ld" EOM, freq); freq_len = sprintf(freqbuf, "F%10Ld" EOM, (long long)freq);
return jrc_transaction (rig, freqbuf, freq_len, NULL, NULL); return jrc_transaction (rig, freqbuf, freq_len, NULL, NULL);
} }
@ -136,6 +136,7 @@ int jrc_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
int freq_len, retval; int freq_len, retval;
char freqbuf[BUFSZ]; char freqbuf[BUFSZ];
long long f;
retval = jrc_transaction (rig, "F" EOM, 2, freqbuf, &freq_len); retval = jrc_transaction (rig, "F" EOM, 2, freqbuf, &freq_len);
if (retval != RIG_OK) if (retval != RIG_OK)
@ -149,7 +150,8 @@ int jrc_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
freqbuf[freq_len-1] = '\0'; freqbuf[freq_len-1] = '\0';
/* extract freq */ /* extract freq */
sscanf(freqbuf+1, "%llu", freq); sscanf(freqbuf+1, "%llu", &f);
*freq = f;
return RIG_OK; return RIG_OK;
} }
@ -839,8 +841,11 @@ int jrc_decode_event(RIG *rig)
*/ */
if (rig->callbacks.freq_event) { if (rig->callbacks.freq_event) {
long long f;
buf[14] = '\0'; /* side-effect: destroy AGC first digit! */ buf[14] = '\0'; /* side-effect: destroy AGC first digit! */
sscanf(buf+4, "%lld", &freq); sscanf(buf+4, "%lld", &f);
freq = f;
return rig->callbacks.freq_event(rig, RIG_VFO_CURR, freq, return rig->callbacks.freq_event(rig, RIG_VFO_CURR, freq,
rig->callbacks.freq_arg); rig->callbacks.freq_arg);
} }

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - main file * Hamlib Kenwood backend - main file
* Copyright (c) 2000-2003 by Stephane Fillod and others * Copyright (c) 2000-2003 by Stephane Fillod and others
* *
* $Id: kenwood.c,v 1.67 2003-10-01 19:31:58 fillods Exp $ * $Id: kenwood.c,v 1.68 2003-10-20 22:15:02 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -400,7 +400,7 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
vfo); vfo);
return -RIG_EINVAL; return -RIG_EINVAL;
} }
freq_len = sprintf(freqbuf,"F%c%011Ld;", vfo_letter, freq); freq_len = sprintf(freqbuf,"F%c%011Ld;", vfo_letter, (long long)freq);
ack_len = 0; ack_len = 0;
retval = kenwood_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len); retval = kenwood_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len);
@ -418,6 +418,7 @@ int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
unsigned char cmdbuf[4]; unsigned char cmdbuf[4];
int cmd_len, freq_len, retval; int cmd_len, freq_len, retval;
char vfo_letter; char vfo_letter;
long long f;
/* /*
* better FIXME: vfo==RIG_VFO_CURR * better FIXME: vfo==RIG_VFO_CURR
@ -451,7 +452,8 @@ int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
sscanf(freqbuf+2, "%lld", freq); sscanf(freqbuf+2, "%lld", &f);
*freq = (freq_t)f;
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - TH handheld primitives * Hamlib Kenwood backend - TH handheld primitives
* Copyright (c) 2001-2003 by Stephane Fillod * Copyright (c) 2001-2003 by Stephane Fillod
* *
* $Id: th.c,v 1.12 2003-10-01 19:31:58 fillods Exp $ * $Id: th.c,v 1.13 2003-10-20 22:15:02 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -202,9 +202,10 @@ th_decode_event (RIG *rig)
rmode_t mode; rmode_t mode;
int step, shift, rev, tone, ctcss, tonefq, ctcssfq; int step, shift, rev, tone, ctcss, tonefq, ctcssfq;
retval = sscanf(asyncbuf, "BUF %d,%lld,%d,%d,%d,%d,%d,,%d,,%d,%lld,%d", retval = sscanf(asyncbuf, "BUF %d,%"FREQFMT",%d,%d,%d,%d,%d,,%d,,%d,%"FREQFMT",%d",
&vfo, &freq, &step, &shift, &rev, &tone, &vfo, &freq, &step, &shift, &rev, &tone,
&ctcss, &tonefq, &ctcssfq, &offset, &mode); &ctcss, &tonefq, &ctcssfq, &offset, &mode);
if (retval != 11) { if (retval != 11) {
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BUF message '%s'\n", __FUNCTION__, asyncbuf); rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BUF message '%s'\n", __FUNCTION__, asyncbuf);
return -RIG_ERJCTED; return -RIG_ERJCTED;
@ -328,13 +329,14 @@ th_set_freq (RIG *rig, vfo_t vfo, freq_t freq)
{ {
char freqbuf[24], ackbuf[ACKBUF_LEN]; char freqbuf[24], ackbuf[ACKBUF_LEN];
int retval, step; int retval, step;
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__); rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
step = 0; step = 0;
if (step < 0 || step > 9) if (step < 0 || step > 9)
return -RIG_EINVAL; return -RIG_EINVAL;
sprintf(freqbuf, "FQ %011Ld,%d" EOM, freq, step); sprintf(freqbuf, "FQ %011Ld,%d" EOM, (long long)freq, step);
retval = th_transaction(rig, freqbuf, ackbuf, sizeof(ackbuf)); retval = th_transaction(rig, freqbuf, ackbuf, sizeof(ackbuf));
if (retval != RIG_OK) if (retval != RIG_OK)
return RIG_OK; return RIG_OK;
@ -356,6 +358,7 @@ th_get_freq (RIG *rig, vfo_t vfo, freq_t *freq)
{ {
char vch, freqbuf[ACKBUF_LEN]; char vch, freqbuf[ACKBUF_LEN];
int retval; int retval;
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__); rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
*freq = 0; *freq = 0;
@ -366,7 +369,7 @@ th_get_freq (RIG *rig, vfo_t vfo, freq_t *freq)
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
retval = sscanf(freqbuf, "FQ %lld", freq); retval = sscanf(freqbuf, "FQ %"FREQFMT, freq);
if (retval != 1) { if (retval != 1) {
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __FUNCTION__, freqbuf); rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __FUNCTION__, freqbuf);
return -RIG_ERJCTED; return -RIG_ERJCTED;

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib PCR backend - main file * Hamlib PCR backend - main file
* Copyright (c) 2001-2003 by Stephane Fillod and Darren Hatcher * Copyright (c) 2001-2003 by Stephane Fillod and Darren Hatcher
* *
* $Id: pcr.c,v 1.19 2003-10-01 19:31:59 fillods Exp $ * $Id: pcr.c,v 1.20 2003-10-20 22:15:02 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -269,7 +269,7 @@ int pcr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
priv = (struct pcr_priv_data *)rig->state.priv; priv = (struct pcr_priv_data *)rig->state.priv;
freq_len = sprintf(freqbuf,"K0%010Ld0%c0%c00" EOM, freq, freq_len = sprintf(freqbuf,"K0%010Ld0%c0%c00" EOM, (long long)freq,
priv->last_mode, priv->last_filter); priv->last_mode, priv->last_filter);
ack_len = 6; ack_len = 6;
@ -339,18 +339,18 @@ int pcr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
*/ */
case RIG_PASSBAND_NORMAL: break; case RIG_PASSBAND_NORMAL: break;
case kHz(2.8): pcrfilter = FLT_2_8kHz; break; case s_kHz(2.8): pcrfilter = FLT_2_8kHz; break;
case kHz(6): pcrfilter = FLT_6kHz; break; case s_kHz(6): pcrfilter = FLT_6kHz; break;
case kHz(15): pcrfilter = FLT_15kHz; break; case s_kHz(15): pcrfilter = FLT_15kHz; break;
case kHz(50): pcrfilter = FLT_50kHz; break; case s_kHz(50): pcrfilter = FLT_50kHz; break;
case kHz(230): pcrfilter = FLT_230kHz; break; case s_kHz(230): pcrfilter = FLT_230kHz; break;
default: default:
rig_debug(RIG_DEBUG_ERR,"pcr_set_mode: unsupported " rig_debug(RIG_DEBUG_ERR,"pcr_set_mode: unsupported "
"width %d\n", width); "width %d\n", width);
return -RIG_EINVAL; return -RIG_EINVAL;
} }
mdbuf_len = sprintf(mdbuf,"K0%010Ld0%c0%c00" EOM, priv->last_freq, mdbuf_len = sprintf(mdbuf,"K0%010Ld0%c0%c00" EOM, (long long)priv->last_freq,
pcrmode, pcrfilter); pcrmode, pcrfilter);
ack_len = 6; ack_len = 6;

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Tentec backend - Argonaut, Jupiter, RX-350 * Hamlib Tentec backend - Argonaut, Jupiter, RX-350
* Copyright (c) 2001-2003 by Stephane Fillod * Copyright (c) 2001-2003 by Stephane Fillod
* *
* $Id: tentec2.c,v 1.2 2003-10-01 19:32:03 fillods Exp $ * $Id: tentec2.c,v 1.3 2003-10-20 22:15:02 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -70,6 +70,7 @@ int tentec2_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int freq_len, retval; int freq_len, retval;
unsigned char freqbuf[16]; unsigned char freqbuf[16];
int vfo_val; int vfo_val;
unsigned long f = (unsigned long)freq;
/* /*
* TODO: make use of rig_state.current_vfo * TODO: make use of rig_state.current_vfo
@ -90,10 +91,10 @@ int tentec2_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
} }
freq_len = sprintf(freqbuf, "*%c%c%c%c%c" EOM, freq_len = sprintf(freqbuf, "*%c%c%c%c%c" EOM,
vfo_val, vfo_val,
(int)(freq >> 24) & 0xff, (int)(f >> 24) & 0xff,
(int)(freq >> 16) & 0xff, (int)(f >> 16) & 0xff,
(int)(freq >> 8) & 0xff, (int)(f >> 8) & 0xff,
(int)(freq & 0xff)); (int)(f & 0xff));
retval = write_block(&rs->rigport, freqbuf, freq_len); retval = write_block(&rs->rigport, freqbuf, freq_len);
if (retval != RIG_OK) if (retval != RIG_OK)

Wyświetl plik

@ -5,7 +5,7 @@
* It takes commands in interactive mode as well as * It takes commands in interactive mode as well as
* from command line options. * from command line options.
* *
* $Id: rigctl.c,v 1.46 2003-08-25 22:45:10 fillods Exp $ * $Id: rigctl.c,v 1.47 2003-10-20 22:15:02 fillods Exp $
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -145,6 +145,7 @@ declare_proto_rig(get_info);
declare_proto_rig(dump_caps); declare_proto_rig(dump_caps);
declare_proto_rig(set_ant); declare_proto_rig(set_ant);
declare_proto_rig(get_ant); declare_proto_rig(get_ant);
declare_proto_rig(reset);
@ -206,6 +207,7 @@ struct test_table test_list[] = {
{ 'z', "get_xit", get_xit, ARG_OUT, "XIT" }, { 'z', "get_xit", get_xit, ARG_OUT, "XIT" },
{ 0x83, "set_ant", set_ant, ARG_IN, "Antenna" }, { 0x83, "set_ant", set_ant, ARG_IN, "Antenna" },
{ 0x84, "get_ant", get_ant, ARG_OUT, "Antenna" }, { 0x84, "get_ant", get_ant, ARG_OUT, "Antenna" },
{ 0x85, "reset", reset, ARG_IN, "Reset" },
{ 0x00, "", NULL }, { 0x00, "", NULL },
}; };
@ -727,6 +729,14 @@ static int print_conf_list(const struct confparams *cfp, rig_ptr_t data)
printf(", %s", cfp->u.c.combostr[i]); printf(", %s", cfp->u.c.combostr[i]);
printf("\n"); printf("\n");
break; break;
case RIG_CONF_STRING:
printf("String.\n");
break;
case RIG_CONF_CHECKBUTTON:
printf("Check button.\n");
break;
default:
printf("Unkown conf\n");
} }
return 1; /* !=0, we want them all ! */ return 1; /* !=0, we want them all ! */
@ -784,7 +794,7 @@ declare_proto_rig(set_freq)
{ {
freq_t freq; freq_t freq;
sscanf(arg1, "%"LLFMT"d", &freq); sscanf(arg1, "%"FREQFMT, &freq);
return rig_set_freq(rig, vfo, freq); return rig_set_freq(rig, vfo, freq);
} }
@ -798,7 +808,7 @@ declare_proto_rig(get_freq)
return status; return status;
if (interactive) if (interactive)
printf("%s: ", cmd->arg1); /* i.e. "Frequency" */ printf("%s: ", cmd->arg1); /* i.e. "Frequency" */
printf("%lld\n", freq); printf("%lld\n", (long long)freq);
return status; return status;
} }
@ -1021,7 +1031,7 @@ declare_proto_rig(set_split_freq)
{ {
freq_t txfreq; freq_t txfreq;
sscanf(arg1, "%"LLFMT"d", &txfreq); sscanf(arg1, "%"FREQFMT, &txfreq);
return rig_set_split_freq(rig, vfo, txfreq); return rig_set_split_freq(rig, vfo, txfreq);
} }
@ -1036,7 +1046,7 @@ declare_proto_rig(get_split_freq)
return status; return status;
if (interactive) if (interactive)
printf("%s: ", cmd->arg1); printf("%s: ", cmd->arg1);
printf("%lld\n", txfreq); printf("%lld\n", (long long)txfreq);
return status; return status;
} }
@ -1132,7 +1142,7 @@ declare_proto_rig(power2mW)
printf("Power [0.0 .. 1.0]: "); printf("Power [0.0 .. 1.0]: ");
scanf("%f", &power); scanf("%f", &power);
printf("Frequency: "); printf("Frequency: ");
scanf("%"LLFMT"d", &freq); scanf("%"FREQFMT, &freq);
printf("Mode: "); printf("Mode: ");
scanf("%d", &mode); scanf("%d", &mode);
status = rig_power2mW(rig, &mwp, power, freq, mode); status = rig_power2mW(rig, &mwp, power, freq, mode);
@ -1436,7 +1446,7 @@ declare_proto_rig(get_channel)
static int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) static int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg)
{ {
printf("Event: freq changed to %lliHz on %s\n", freq, strvfo(vfo)); printf("Event: freq changed to %lliHz on %s\n", (long long)freq, strvfo(vfo));
return 0; return 0;
} }
@ -1609,4 +1619,12 @@ declare_proto_rig(get_ant)
return status; return status;
} }
declare_proto_rig(reset)
{
reset_t reset;
sscanf(arg1, "%d", &reset);
return rig_reset(rig, reset);
}

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Uniden backend - main file * Hamlib Uniden backend - main file
* Copyright (c) 2001-2003 by Stephane Fillod * Copyright (c) 2001-2003 by Stephane Fillod
* *
* $Id: uniden.c,v 1.7 2003-10-01 19:32:03 fillods Exp $ * $Id: uniden.c,v 1.8 2003-10-20 22:15:02 fillods Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -93,7 +93,7 @@ int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL; return -RIG_EINVAL;
/* exactly 8 digits */ /* exactly 8 digits */
freq_len = sprintf(freqbuf, "RF%08Ld" EOM, freq); freq_len = sprintf(freqbuf, "RF%08Ld" EOM, (long long)freq);
return uniden_transaction (rig, freqbuf, freq_len, NULL, NULL); return uniden_transaction (rig, freqbuf, freq_len, NULL, NULL);
} }