fix set_vfo/get_vfo for TS-440

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1120 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Stéphane Fillod, F8CFE 2002-07-10 21:45:44 +00:00
rodzic 11baf8ecfb
commit 947446c506
3 zmienionych plików z 82 dodań i 6 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - main file
* Copyright (c) 2000-2002 by Stephane Fillod
*
* $Id: kenwood.c,v 1.39 2002-07-08 22:53:25 fillods Exp $
* $Id: kenwood.c,v 1.40 2002-07-10 21:45: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
@ -263,6 +263,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
return retval;
}
/*
* kenwood_get_vfo
* Assumes rig!=NULL, !vfo
@ -298,6 +299,77 @@ int kenwood_get_vfo(RIG *rig, vfo_t *vfo)
return RIG_OK;
}
/*
* kenwood_old_set_vfo
* Assumes rig!=NULL
* for TS-940, TS-811, TS-711 and TS-440
*/
int kenwood_old_set_vfo(RIG *rig, vfo_t vfo)
{
unsigned char cmdbuf[16], ackbuf[16];
int cmd_len, ack_len = 0, retval;
char vfo_function;
/*
* FIXME: vfo==RIG_VFO_CURR
*/
switch (vfo) {
case RIG_VFO_VFO:
case RIG_VFO_A: vfo_function = '0'; break;
case RIG_VFO_B: vfo_function = '1'; break;
case RIG_VFO_MEM: vfo_function = '2'; break;
/* TODO : case RIG_VFO_C: */
default:
rig_debug(RIG_DEBUG_ERR,"kenwood_set_vfo: unsupported VFO %d\n",
vfo);
return -RIG_EINVAL;
}
cmd_len = sprintf(cmdbuf, "FN%c%s", vfo_function, cmd_trm(rig));
ack_len = 16;
retval = kenwood_transaction (rig, cmdbuf, cmd_len, ackbuf, &ack_len);
return retval;
}
/*
* kenwood_old_get_vfo
* Assumes rig!=NULL, !vfo
* for TS-940, TS-811, TS-711 and TS-440
*/
int kenwood_old_get_vfo(RIG *rig, vfo_t *vfo)
{
unsigned char vfobuf[50];
int vfo_len, retval;
/* query RX VFO */
vfo_len = 50;
retval = kenwood_transaction (rig, "FN;", 3, vfobuf, &vfo_len);
if (retval != RIG_OK)
return retval;
if (vfo_len != 4 || vfobuf[1] != 'N') {
rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer %s, "
"len=%d\n", __FUNCTION__, vfobuf, vfo_len);
return -RIG_ERJCTED;
}
/* TODO: replace 0,1,2,.. constants by defines */
switch (vfobuf[2]) {
case '0': *vfo = RIG_VFO_A; break;
case '1': *vfo = RIG_VFO_B; break;
case '2': *vfo = RIG_VFO_MEM; break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %c\n",
__FUNCTION__, vfobuf[2]);
return -RIG_EPROTO;
}
return RIG_OK;
}
/*
* kenwood_set_freq
* Assumes rig!=NULL

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - main header
* Copyright (c) 2000-2002 by Stephane Fillod
*
* $Id: kenwood.h,v 1.22 2002-07-05 23:22:11 fillods Exp $
* $Id: kenwood.h,v 1.23 2002-07-10 21:45: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
@ -49,6 +49,8 @@ int kenwood_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
size_t *data_len);
int kenwood_set_vfo(RIG *rig, vfo_t vfo);
int kenwood_get_vfo(RIG *rig, vfo_t *vfo);
int kenwood_old_set_vfo(RIG *rig, vfo_t vfo);
int kenwood_old_get_vfo(RIG *rig, vfo_t *vfo);
int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - TS440 description
* Copyright (c) 2000-2002 by Stephane Fillod
*
* $Id: ts440.c,v 1.1 2002-07-05 23:22:11 fillods Exp $
* $Id: ts440.c,v 1.2 2002-07-10 21:45: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
@ -49,9 +49,11 @@ static const struct kenwood_priv_caps ts440_priv_caps = {
* ts440 rig capabilities.
*
* TODO: scan, get/set_channel, RIT/XIT, Voice Recall, split
* FIXME: set/get_vfo with FNn;
*
* part of infos comes from http://www.n7uic.net/radio/kenwood/ts440/specs.htm
* http://public.srce.hr/9A1CDD/mods/kenwood/knwdif.mod
* http://www.ifrance.fr/clucas/modposte/ts440/mod440.htm
*
*/
const struct rig_caps ts440_caps = {
rig_model: RIG_MODEL_TS440,
@ -145,8 +147,8 @@ set_freq: kenwood_set_freq,
get_freq: kenwood_get_freq,
set_mode: kenwood_set_mode,
get_mode: kenwood_get_mode,
set_vfo: kenwood_set_vfo,
get_vfo: kenwood_get_vfo,
set_vfo: kenwood_old_set_vfo,
get_vfo: kenwood_old_get_vfo,
set_ptt: kenwood_set_ptt,
get_dcd: kenwood_get_dcd,
set_func: kenwood_set_func,