kopia lustrzana https://github.com/Hamlib/Hamlib
use binary mode VFO requests
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2193 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.6.2
rodzic
ee8925dfc2
commit
6cabb43d44
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Hamlib TenTenc backend - TT-565 description
|
* Hamlib TenTenc backend - TT-565 description
|
||||||
* Copyright (c) 2004-2006 by Stephane Fillod & Martin Ewing
|
* Copyright (c) 2004-2007 by Stephane Fillod & Martin Ewing
|
||||||
*
|
*
|
||||||
* $Id: orion.c,v 1.17 2006-10-30 20:17:58 aa6e Exp $
|
* $Id: orion.c,v 1.18 2007-03-02 16:29:11 aa6e 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
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
* Support LEVEL_VOX, VOXGAIN, ANTIVOX
|
* Support LEVEL_VOX, VOXGAIN, ANTIVOX
|
||||||
* Support LEVEL_NR as Orion NB setting (firmware bug), FUNC_NB -> NB=0,4
|
* Support LEVEL_NR as Orion NB setting (firmware bug), FUNC_NB -> NB=0,4
|
||||||
* Add get_, set_ant (ignores rx only ant)
|
* Add get_, set_ant (ignores rx only ant)
|
||||||
|
* Use binary mode for VFO read / write, for speed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Known issues & to-do list:
|
/* Known issues & to-do list:
|
||||||
|
@ -236,10 +237,28 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
{
|
{
|
||||||
int cmd_len, retval;
|
int cmd_len, retval;
|
||||||
char cmdbuf[TT565_BUFSIZE];
|
char cmdbuf[TT565_BUFSIZE];
|
||||||
|
unsigned int myfreq;
|
||||||
|
|
||||||
cmd_len = sprintf (cmdbuf, "*%cF%"PRIll EOM,
|
/* ASCII mode (former)
|
||||||
which_vfo(rig, vfo),
|
* cmd_len = sprintf (cmdbuf, "*%cF%"PRIll EOM,
|
||||||
(long long)freq);
|
* which_vfo(rig, vfo),
|
||||||
|
* (long long)freq);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Set frequency using Orion's binary mode (short) sequence.
|
||||||
|
The short sequence transfers faster and may require less Orion
|
||||||
|
firmware effort. */
|
||||||
|
|
||||||
|
/* Construct command packet by brute force. */
|
||||||
|
myfreq = freq;
|
||||||
|
cmd_len = 7;
|
||||||
|
cmdbuf[0] = '*';
|
||||||
|
cmdbuf[1] = which_vfo(rig,vfo);
|
||||||
|
cmdbuf[2] = (myfreq & 0xff000000) >> 24;
|
||||||
|
cmdbuf[3] = (myfreq & 0x00ff0000) >> 16;
|
||||||
|
cmdbuf[4] = (myfreq & 0x0000ff00) >> 8;
|
||||||
|
cmdbuf[5] = myfreq & 0x000000ff;
|
||||||
|
cmdbuf[6] = '\r'; /* i.e. EOM */
|
||||||
|
|
||||||
retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL);
|
retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL);
|
||||||
|
|
||||||
|
@ -257,9 +276,16 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
{
|
{
|
||||||
int cmd_len, resp_len, retval;
|
int cmd_len, resp_len, retval;
|
||||||
|
unsigned int binf;
|
||||||
char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE];
|
char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE];
|
||||||
|
|
||||||
cmd_len = sprintf(cmdbuf, "?%cF" EOM,
|
/* ASCII mode (former)
|
||||||
|
* cmd_len = sprintf(cmdbuf, "?%cF" EOM,
|
||||||
|
* which_vfo(rig, vfo));
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Get freq with Orion binary mode short sequence, as above. */
|
||||||
|
cmd_len = sprintf(cmdbuf, "?%c" EOM,
|
||||||
which_vfo(rig, vfo));
|
which_vfo(rig, vfo));
|
||||||
|
|
||||||
resp_len = sizeof(respbuf);
|
resp_len = sizeof(respbuf);
|
||||||
|
@ -267,14 +293,16 @@ int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
/* Test for valid binary mode return. */
|
||||||
if (respbuf[2] != 'F' || resp_len <= 3) {
|
if (respbuf[1] != which_vfo(rig,vfo) || resp_len <= 5) {
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n",
|
rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n",
|
||||||
__FUNCTION__, respbuf);
|
__FUNCTION__, respbuf);
|
||||||
return -RIG_EPROTO;
|
return -RIG_EPROTO;
|
||||||
}
|
}
|
||||||
|
/* Convert binary to integer, endedness independent */
|
||||||
*freq = (freq_t) atof(respbuf+3);
|
binf = (unsigned char)respbuf[2]<<24 | (unsigned char)respbuf[3]<<16
|
||||||
|
| (unsigned char)respbuf[4]<<8 | (unsigned char)respbuf[5];
|
||||||
|
*freq = (freq_t) binf;
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue