kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck warnings for ampctl_parse.c and redef amp_set_powerstat
rodzic
fac207d37b
commit
8a3df9735e
3428
kenwood/ts2k.c
3428
kenwood/ts2k.c
Plik diff jest za duży
Load Diff
174
kenwood/ts2k.h
174
kenwood/ts2k.h
|
@ -1,174 +0,0 @@
|
|||
/*
|
||||
* Hamlib TS2000 backend - main header
|
||||
* Copyright (c) 2000-2002 by Stephane Fillod
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* created from kenwood.h --Dale kd7eni
|
||||
*/
|
||||
|
||||
/*//+kd7eni*/
|
||||
|
||||
#ifndef _TS2K_H
|
||||
#define _TS2K_H
|
||||
|
||||
#undef _USEVFO
|
||||
|
||||
// imported from ts2000.h --Dale kd7eni
|
||||
/*
|
||||
* 103 available DCS codes
|
||||
*/
|
||||
static const tone_t ts2k_dcs_list[] = {
|
||||
23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54,
|
||||
65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131,
|
||||
132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174,
|
||||
205, 212, 223, 225, 226, 243, 244, 245, 246, 251, 252,
|
||||
255, 261, 263, 265, 266, 271, 274, 306, 311, 315, 325,
|
||||
331, 332, 343, 346, 351, 356, 364, 365, 371, 411, 412,
|
||||
413, 423, 431, 432, 445, 446, 452, 454, 455, 462, 464,
|
||||
465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606,
|
||||
612, 624, 627, 631, 632, 654, 662, 664, 703, 712, 723,
|
||||
731, 732, 734, 743, 754,
|
||||
0
|
||||
};
|
||||
|
||||
#define TS2K_PTT_ON_MAIN 8
|
||||
#define TS2K_CTRL_ON_MAIN 4
|
||||
#define TS2K_PTT_ON_SUB 2
|
||||
#define TS2K_CTRL_ON_SUB 1
|
||||
|
||||
// Needed to prevent ts2k_transaction (kenwood_transaction) from
|
||||
// expecting a reply from the ts2000 in cases where there is none.
|
||||
#define NOREPLY 0
|
||||
// some commands reply "?;" if rig currently in requested mode
|
||||
// usually, there is NOREPLY when mode is changed. This can be
|
||||
// put in the acknowledge length to signify the error is no error.
|
||||
#define BUGERR -1
|
||||
|
||||
//-kd7eni
|
||||
|
||||
#define EOM_KEN ";"
|
||||
#define EOM_TH "\r"
|
||||
|
||||
struct ts2k_priv_caps {
|
||||
/* read-only values */
|
||||
const char *cmdtrm; /* Command termination chars (ken=';' or th='\r') */
|
||||
/* changable values */
|
||||
// nothing
|
||||
};
|
||||
|
||||
#if 0 /* No private data for Kenwood backends. */
|
||||
struct ts2k_priv_data {
|
||||
int dummy; // placeholder for real entries.
|
||||
};
|
||||
#endif
|
||||
|
||||
extern int ts2k_init(RIG *rig);
|
||||
extern int ts2k_cleanup(RIG *rig);
|
||||
|
||||
|
||||
extern const int ts2k_ctcss_list[];
|
||||
|
||||
int ts2k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
||||
size_t *data_len);
|
||||
int ts2k_set_vfo(RIG *rig, vfo_t vfo);
|
||||
int ts2k_get_vfo(RIG *rig, vfo_t *vfo);
|
||||
int ts2k_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
int ts2k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
|
||||
int ts2k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
int ts2k_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
|
||||
int ts2k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
|
||||
int ts2k_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||
int ts2k_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
|
||||
int ts2k_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
|
||||
int ts2k_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone);
|
||||
int ts2k_set_tone(RIG *rig, vfo_t vfo, tone_t tone);
|
||||
int ts2k_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone);
|
||||
int ts2k_get_tone(RIG *rig, vfo_t vfo, tone_t *tone);
|
||||
int ts2k_set_Tones(RIG *rig, vfo_t vfo, tone_t tone, const char ct);
|
||||
int ts2k_get_Tones(RIG *rig, vfo_t vfo, tone_t *tone, const char *ct);
|
||||
int ts2k_set_powerstat(RIG *rig, powerstat_t status);
|
||||
int ts2k_get_powerstat(RIG *rig, powerstat_t *status);
|
||||
int ts2k_reset(RIG *rig, reset_t reset);
|
||||
int ts2k_send_morse(RIG *rig, vfo_t vfo, const char *msg);
|
||||
int ts2k_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
|
||||
int ts2k_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
|
||||
int ts2k_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
|
||||
int ts2k_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
|
||||
int ts2k_set_mem(RIG *rig, vfo_t vfo, int ch);
|
||||
int ts2k_get_mem(RIG *rig, vfo_t vfo, int *ch);
|
||||
const char* ts2k_get_info(RIG *rig);
|
||||
|
||||
int ts2k_get_trn(RIG *rig, int *trn);
|
||||
int ts2k_set_trn(RIG *rig, int trn);
|
||||
|
||||
/*
|
||||
* functions I've written -- Dale KD7ENI
|
||||
*/
|
||||
int ts2k_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch);
|
||||
int ts2k_scan_on(RIG *rig, char ch);
|
||||
int ts2k_scan_off(RIG *rig);
|
||||
int ts2k_get_channel(RIG *rig, channel_t *chan);
|
||||
int ts2k_set_channel(RIG *rig, const channel_t *chan);
|
||||
char *ts2k_get_ctrl(RIG *rig);
|
||||
int ts2k_set_ctrl(RIG *rig, int ptt, int ctrl);
|
||||
int ts2k_vfo_ctrl(RIG *rig, vfo_t vfo);
|
||||
int ts2k_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *tone);
|
||||
int ts2k_set_dcs_code(RIG *rig, vfo_t vfo, tone_t tone);
|
||||
int ts2k_get_int(char *c, int i);
|
||||
int ts2k_sat_off(RIG *rig, vfo_t vfo);
|
||||
int ts2k_sat_on(RIG *rig, vfo_t vfo);
|
||||
int ts2k_get_parm(RIG *rig, setting_t parm, value_t *val);
|
||||
int ts2k_set_parm(RIG *rig, setting_t parm, value_t val);
|
||||
int ts2k_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);
|
||||
int ts2k_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
|
||||
int ts2k_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *offs);
|
||||
int ts2k_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
|
||||
int ts2k_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *shift);
|
||||
int ts2k_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift);
|
||||
int ts2k_get_split(RIG *rig, vfo_t vfo, split_t *split);
|
||||
int ts2k_set_split(RIG *rig, vfo_t vfo, split_t split);
|
||||
int ts2k_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq);
|
||||
int ts2k_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq);
|
||||
int ts2k_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *txmode, pbwidth_t *txwidth);
|
||||
int ts2k_set_split_mode(RIG *rig, vfo_t vfo, rmode_t txmode, pbwidth_t txwidth);
|
||||
int ts2k_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts);
|
||||
int ts2k_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts);
|
||||
int ts2k_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *freq);
|
||||
int ts2k_set_xit(RIG *rig, vfo_t vfo, shortfreq_t freq);
|
||||
|
||||
/* end kd7eni functions */
|
||||
|
||||
extern const struct rig_caps thd7a_caps;
|
||||
extern const struct rig_caps thf7a_caps;
|
||||
extern const struct rig_caps thf7e_caps;
|
||||
extern const struct rig_caps ts450s_caps;
|
||||
extern const struct rig_caps ts50s_caps;
|
||||
extern const struct rig_caps ts570d_caps;
|
||||
extern const struct rig_caps ts570s_caps;
|
||||
extern const struct rig_caps ts790_caps;
|
||||
extern const struct rig_caps ts850_caps;
|
||||
extern const struct rig_caps ts870s_caps;
|
||||
extern const struct rig_caps ts950sdx_caps;
|
||||
extern const struct rig_caps ts2000_caps;
|
||||
|
||||
extern BACKEND_EXPORT(int) initrigs_ts2k(void *be_handle);
|
||||
extern BACKEND_EXPORT(rig_model_t) proberigs_ts2k(port_t *port);
|
||||
|
||||
#endif /* _TS2000_H */
|
|
@ -1,23 +0,0 @@
|
|||
Rig: TS-2000, ts2k.c Thought this might help. --Dale kd73ni
|
||||
n/i = not written, orig = original/rewritten, new = new, ok = works as written
|
||||
F: ok (no limit check) orig f: ok, (vfo only) orig
|
||||
M: ok orig m: ok (no vfo check) orig
|
||||
V: ok (trivial only) orig v: ok (trivial only) orig
|
||||
T: ok (even in CALL_C) orig t: ok orig
|
||||
R: ok new r: ok (vfo only) new
|
||||
O: bugs new o: ok new
|
||||
C: ok (requires exact) orig c: ok orig
|
||||
D: ok new d: ok new
|
||||
I: broken new i: broken new
|
||||
X: ok (TX only!) new x: replies new
|
||||
S: ok (default only!) new s: on (not broken!) new
|
||||
N: ok (default only) new n: ok new
|
||||
L: ok (PREAMP at least) new l: bad new
|
||||
U: bugs (VOX always on) new u: bugs orig
|
||||
P: ok (BEEP 0.0 works!) new p: ok new
|
||||
E: ok orig e: ok orig
|
||||
G: ok (up/down at least) new g: broken new
|
||||
H: n/i (rigctl too!) h: ok (needs work) new
|
||||
A: ok (see a) orig a: ok (sigio remains on) orig
|
||||
B: n/a _: ok (which Sea?) :) orig
|
||||
2: bugs (don't understand) orig #: ok (rigctl comment) new
|
|
@ -1,319 +0,0 @@
|
|||
/*
|
||||
* ts2k_menu.c (C) Copyright 2002 by Dale E. Edmons. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* License: GNU
|
||||
*/
|
||||
|
||||
/*
|
||||
* status: Never been compiled!
|
||||
*/
|
||||
|
||||
/*
|
||||
* Functions to initialize, read, set, and list menus
|
||||
* for the TS-2000. These functions will be added to
|
||||
* src/rig.c as rig_*menu_*() as time permits.
|
||||
*
|
||||
* This is likely a can of worms nobody has wanted to
|
||||
* deal with--until now. The ts2k is especially a
|
||||
* pain as you'll soon seen (but cool nonetheless.)
|
||||
*/
|
||||
|
||||
#include <rig.h>
|
||||
#include "ts2k.h"
|
||||
#include "ts2k_menu.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
* Set the menu number(s) and terminate with ";" (not ';')
|
||||
*/
|
||||
int ts2k_set_menu_no(RIG *rig, ts2k_menu_t *menu, int main, int sub)
|
||||
{
|
||||
int i;
|
||||
|
||||
menu->menu_no[0] = main;
|
||||
menu->menu_no[1] = sub;
|
||||
menu->menu_no[2] = menu->menu_no[3] = 0;
|
||||
|
||||
i = sprintf(&menu->cmd[0], "ex%03u%02u%01u%01u;", main, sub, 0, 0);
|
||||
|
||||
if (i != 10)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the menu number(s) from cmd[]
|
||||
*/
|
||||
int ts2k_get_menu_no(RIG *rig, ts2k_menu_t *menu, int *main, int *sub)
|
||||
{
|
||||
char tmp[30];
|
||||
int m, s;
|
||||
|
||||
if (menu == NULL)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
m = int_n(tmp, &menu->cmd[2], 3);
|
||||
s = int_n(tmp, &menu->cmd[7], 2);
|
||||
|
||||
menu->menu_no[0] = m;
|
||||
menu->menu_no[1] = s;
|
||||
menu->menu_no[2] = menu->menu_no[3] = 0;
|
||||
|
||||
if (main != NULL)
|
||||
{
|
||||
*main = m;
|
||||
}
|
||||
|
||||
if (sub != NULL)
|
||||
{
|
||||
*sub = s;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* When called by ts2k_pm_init we read all of
|
||||
* the rig's current menu options and set them
|
||||
* in the current menu array. We don't do the
|
||||
* memory allocation so you can init as many
|
||||
* as you want. The reason for this is huge.
|
||||
* First, after full reset the rig can access
|
||||
* menuA or menuB and different values retained.
|
||||
* Second, by sending "pm...;" we can select
|
||||
* Programmable Memory 0-5, with 0 being the
|
||||
* the default. Amazingly, each PM seems to
|
||||
* have its own menuA and menuB. Thus, all
|
||||
* told, we have up to twelve distinct menus
|
||||
* each with (potentially) unique values. We
|
||||
* do the allocation in the PM routines and
|
||||
* leave this one much simpler and just call
|
||||
* it up to twelve times with uniq ts2k_menu_t
|
||||
* pointers. Third, the user may wish to use
|
||||
* this to obtain a private copy for local use
|
||||
* and only has to call this routine to make
|
||||
* sure its current. (A ts2k_pm_t should be
|
||||
* allocated as well!)
|
||||
*/
|
||||
int ts2k_menu_init(RIG *rig, ts2k_menu_t *menu[])
|
||||
{
|
||||
int retval, i;
|
||||
ts2k_menu_t *m, *mref;
|
||||
|
||||
if (menu == NULL || menu == ts2k_menus)
|
||||
{
|
||||
rig_debug(rig, __func__": invalid menu pointer\n");
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
// One set of defaults has been globally defined (mref)
|
||||
for (i = 0, i < (sizeof(menu) / sizeof(ts2k_menu_t)); i++)
|
||||
{
|
||||
m = menu[i];
|
||||
mref = ts2k_menus[i];
|
||||
retval = ts2k_set_menu_no(rig, m, mref->menu[0], mref->menu[1]);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = ts2k_get_menu(rig, m);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
// FIXME: set some debug traces here?
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* read the rig and get the parameters for menu[n].
|
||||
* convert them to a ts2k_menu_t, and eventually to
|
||||
* a rig_menu_t. I do a lot of checking to ensure
|
||||
* nothing breaks (hi!).
|
||||
*/
|
||||
int ts2k_get_menu(RIG *rig, ts2k_menu_t *menu,)
|
||||
{
|
||||
int retval, i, j, k, acklen;
|
||||
char ack[30];
|
||||
|
||||
if (menu == NULL)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
else if ((toupper(menu->cmd[0]) != 'E')
|
||||
|| (toupper(menu->cmd[1]) != 'X'))
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
else if (menu->cmd[9] != ';')
|
||||
{
|
||||
retval = -RIG_EINVAL;
|
||||
}
|
||||
|
||||
retval = ts2k_transaction(rig, menu->cmd, 10, ack, &acklen);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
strncpy(menu->cmd, ack, 30);
|
||||
retval = ts2k_menu_parse(rig, menu);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Here, I expect everything to be setup for me.
|
||||
* All we do is determe the value and param_txt
|
||||
* for the menu item we are given.
|
||||
*
|
||||
* status: real ugly!
|
||||
*/
|
||||
int ts2k_menu_parse(RIG *rig, ts2k_menu_t *menu)
|
||||
{
|
||||
ts2k_menu_t *mref, *m;
|
||||
char *vptr;
|
||||
int on_off[] = { 01, 03, 04, 05, 07, 09, 17, 18, 23, 25, 26,
|
||||
27, 30, 34, 35, 36, 37, 43, 44, 52, 53, 63, 54, 55,
|
||||
-1
|
||||
},
|
||||
zero2nine =
|
||||
{
|
||||
|
||||
m = menu; // to lazy to spell menu-> all the time
|
||||
|
||||
if (m->cmd[0] == '\0' || m->cmd[1] == '\0')
|
||||
{
|
||||
return -RIG_EINVAL; // Caller has blown it!
|
||||
}
|
||||
|
||||
// find matching refence menu
|
||||
i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
mref = ts2k_menus[i];
|
||||
|
||||
if (mref == NULL) // Either Caller or I blew it!
|
||||
{
|
||||
return -RIG_EINTERNAL;
|
||||
}
|
||||
|
||||
if (mref->menu_no[i] == NULL)
|
||||
{
|
||||
return -RIG_EINVAL; // It has to match one!
|
||||
}
|
||||
|
||||
if (menu == ts2k_menus[i]) // Nobody changes our REF!
|
||||
{
|
||||
return -RIG_EINTERNAL;
|
||||
}
|
||||
|
||||
if (mref->menu[0] == m->menu[0])
|
||||
&& mref->menu[1] == m->menu[1]
|
||||
&& mref->menu[2] == m->menu[2]
|
||||
/*&& mref->menu[3] == m->menu[3]*/)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (++i)
|
||||
|
||||
/* Match the main menu and only look for sub-menus later */
|
||||
|
||||
// check for menus that are simple on/off first
|
||||
// FIXME: this isn't fast, it just eliminates alot of cases!
|
||||
for (i = 0; on_off == -1; i++)
|
||||
{
|
||||
if (m->menu[0] == m->menu[0])
|
||||
{
|
||||
m->val = m->cmd[9] - '0';
|
||||
m->param_txt = (m->val == 1) ? m_on : m_off;
|
||||
return RIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Use mref to do all we can
|
||||
retval = -RIG_EINTERNAL;
|
||||
|
||||
for (i = 0; mref->param_txt != NULL; i++)
|
||||
{
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
switch (mref->param_txt[i])
|
||||
{
|
||||
case m_tbd: // menu item under development!
|
||||
m->param_txt = m_tbd;
|
||||
vptr = malloc(17);
|
||||
|
||||
if (vptr == NULL)
|
||||
{
|
||||
return -RIG_NOMEM;
|
||||
}
|
||||
|
||||
for (j = 0; vptr[i] != ';' && i < 17; i++)
|
||||
{
|
||||
vptr[i] == m->cmd[i];
|
||||
}
|
||||
|
||||
vptr[i] = '\0';
|
||||
return -RIG_NIMPL;
|
||||
|
||||
case m_off:
|
||||
if (m->cmd[9] == '0')
|
||||
{
|
||||
m->param_txt = mref->param_txt[i];
|
||||
m->val = 0;
|
||||
retval = RIG_OK;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case m_num:
|
||||
default:
|
||||
return -RIG_NIMPL;
|
||||
}
|
||||
}
|
||||
|
||||
switch (m->menu[0])
|
||||
{
|
||||
|
||||
case 00:
|
||||
case 00:
|
||||
case 00:
|
||||
case 00:
|
||||
case 00:
|
||||
case 00:
|
||||
case 00:
|
||||
case 00:
|
||||
|
||||
default:
|
||||
return -RIG_EINTERNAL; // I'm requiring 100% match
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
// End of ts2k_menu.c
|
|
@ -1,240 +0,0 @@
|
|||
/*
|
||||
* ts2k_menu.h (C) Copyright 2002 by Dale E. Edmons. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* License: GNU (same as what hamlib currently is using)
|
||||
*/
|
||||
|
||||
/*
|
||||
* status: uncompiled. Haven't finished factory defaults.
|
||||
* anything with m_tbd is: to be developed
|
||||
*/
|
||||
|
||||
/* Header to implement menus equivalent to those on the TS-2000. */
|
||||
|
||||
// sub-menu defines
|
||||
#define MENU_A 1
|
||||
#define MENU_B 2
|
||||
#define MENU_C 3
|
||||
#define MENU_D 4
|
||||
#define MENU_E 5
|
||||
#define MENU_F 6
|
||||
|
||||
// parameter value text. may be used in any menu.
|
||||
const char m_on[]="On";
|
||||
const char m_off[]="Off";
|
||||
const char m_to[]="TO";
|
||||
const char m_co[]="CO";
|
||||
const char m_h_boost[]="High Boost";
|
||||
const char m_b_boost[]="Bass Boost";
|
||||
const char m_f_pass[]="F Pass";
|
||||
const char m_conven[]="Conven";
|
||||
const char m_user[]="User";
|
||||
const char m_auto[]="Auto";
|
||||
const char m_norm[]="Normal";
|
||||
const char m_inv[]="Inverse";
|
||||
const char m_low[]="Low";
|
||||
const char m_mid[]="Mid";
|
||||
const char m_hi[]="High";
|
||||
const char m_burst[]="Burst";
|
||||
const char m_cont[]="Cont";
|
||||
const char m_slow[]="Slow";
|
||||
const char m_fast[]="Fast";
|
||||
const char m_main[]="Main";
|
||||
const char m_sub[]="Sub";
|
||||
const char m_tnc_band[]="TNC Band";
|
||||
const char m_main_sub[]="Main & Sub";
|
||||
const char m_man[]="Manual";
|
||||
const char m_morse[]="Morse";
|
||||
const char m_voice[]="Voice";
|
||||
const char m_neg[]="Negative";
|
||||
const char m_pos[]="Positive";
|
||||
const char m_locked[]="Locked";
|
||||
const char m_cross[]="Cross";
|
||||
const char m_client[]="Client";
|
||||
const char m_commander[]="Commander";
|
||||
const char m_transporter[]="Transporter";
|
||||
const char m_font1[]="font1";
|
||||
const char m_font2[]="font2";
|
||||
const char m_num[8+2]; // storage for numeric constants
|
||||
const char m_text[8+2]; // storage for text constants
|
||||
//const char m_[]="";
|
||||
|
||||
// array valued constants (mostly) or other undefined text
|
||||
const char m_tbd[]="hamlib: t.b.d.";
|
||||
|
||||
// PF1 key assignments
|
||||
#define KEY_MENU_MAX 62
|
||||
#define KEY_KEY_MAX 90
|
||||
#define KEY_UNASSIGNED 99
|
||||
const char key_menu[]="Menu"; // menu # 0-62
|
||||
const char key_none[]="None";
|
||||
const char key_key[][KEY_KEY_MAX-KEY_MENU_MAX] = {
|
||||
"Voice1", Voice2", "Voice3", "RX Moni", "DSP Moni",
|
||||
"Quick Memo MR", "Quick Memo M.IN", "Split", "TF-SET",
|
||||
"A/B", "VFO/M", "A=B", "Scan", "M>VFO", "M.IN", "CW TUNE",
|
||||
"CH1", "CH2", "CH3", "Fine", "CLR", "Call", "CTRL",
|
||||
"1MHz", "ANT1/2", "N.B.", "N.R.", "B.C.", "A.N.",
|
||||
""
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char menu_no[];
|
||||
const char txt[];
|
||||
const char *param_txt[];
|
||||
char cmd[30];
|
||||
const int menu[4];
|
||||
int val; // same as P5
|
||||
} ts2k_menu_t;
|
||||
|
||||
/*
|
||||
* Defaults for menu_t.val were obtained via minicom
|
||||
* on my rig after doing a full reset to factory defaults.
|
||||
* (unfinished)
|
||||
*/
|
||||
|
||||
const ts2k_menu_t ts2k_menus[] = {
|
||||
{ "00", "Display Brightness", {m_off, m_num, NULL}, "", {00,0,0,0}, 3},
|
||||
{ "01", "Key Illumination", {m_off, m_on, NULL}, "", {01,0,0,0}, 1},
|
||||
{ "02", "Tuning Control Change Per Revolution", {m_num, NULL}, "", {02,0,0,0}, 1},
|
||||
{ "03", "Tune using MULTI/CH Frequency Step", {m_off, m_on, NULL}, "", {03,0,0,0}, 1},
|
||||
{ "04", "Round off VFO using MULTI/CH Control", {m_off, m_on, NULL}, "", {04,0,0,0}, 1},
|
||||
{ "05", "9kHz step size for MULTI/CH in AM Broadcast Band", {m_off, m_on, NULL}, "", {05,0,0,0}, 0},
|
||||
{ "06A", "Mem: Memory-VFO Split", {m_off, m_on, NULL}, "", {06,1,0,0}, 0},
|
||||
{ "06B", "Mem: Temporary Frequency change after Memory Recall", {m_off, m_on, NULL}, "", {06,2,0,0}, 0},
|
||||
{ "07", "Program scan partially slowed", {m_off, m_on, NULL}, "", {07,0,0,0}, 0},
|
||||
{ "08", "Program Slow-Scan Range", {m_num, NULL}, "", {08,0,0,0}, 0},
|
||||
{ "09", "Program scan hold", {m_off, m_on, NULL}, "", {09,0,0,0}, 0},
|
||||
{ "10", "Scan Resume Method", {m_to, m_co, NULL}, "", {10,0,0,0}, 0},
|
||||
{ "11", "Visual Scan Range", {m_tbd, NULL}, "", {11,0,0,0}, 0},
|
||||
{ "12", "Beep Volume", {m_off, m_num, NULL}, "", {12,0,0,0}, 0},
|
||||
{ "13", "Sidetone Volume", {m_off, m_num, NULL}, "", {13,0,0,0}, 0},
|
||||
{ "14", "Message Playback Volume", {m_off, m_num, NULL}, "", {14,0,0,0}, 0},
|
||||
{ "15", "Voice Volume", {m_off, m_num, NULL}, "", {15,0,0,0}, 0},
|
||||
{ "16", "Output Configuration for sp2 or headphones", {m_tbd, NULL}, "", {16,0,0,0}, 0},
|
||||
{ "17", "Reversed output configuration for sp2 or headphones", {m_off, m_on, NULL}, "", {17,0,0,0}, 0},
|
||||
{ "18", "RX-Dedicated antenna", {m_off, m_on, NULL}, "", {18,0,0,0}, 0},
|
||||
{ "19A", "S-Meter: SQ", {m_off, m_on, NULL}, "", {19,1,0,0}, 0},
|
||||
{ "19B", "S-Meter: Hang Time", {m_off, m_tbd, NULL}, "", {19,2,0,0}, 0},
|
||||
{ "20", "RX Equalizer", {m_off, m_h_boost, m_b_boost, m_conven, m_user, NULL}, "", {20,0,0,0}, 0},
|
||||
{ "21", "TX Equalizer", {m_off, m_h_boost, m_b_boost, m_conven, m_user, NULL}, "", {21,0,0,0}, 0},
|
||||
{ "22", "TX Filter Bandwidth for SSB or AM", {m_tbd, NULL}, "", {22,0,0,0}, 0},
|
||||
{ "23", "Fine Transmit power change step", {m_off, m_on, NULL}, "", {23,0,0,0}, 0},
|
||||
{ "24", "Time-out Timer", {m_off, m_tbd, NULL}, "", {24,0,0,0}, 0},
|
||||
{ "25", "Transverter Frequency Display", {m_off, m_on, NULL}, "", {25,0,0,0}, 0},
|
||||
{ "26", "TX Hold; Antenna tuner", {m_off, m_on, NULL}, "", {26,0,0,0}, 0},
|
||||
{ "27", "Antenna tuner while receiving", {m_off, m_on, NULL}, "", {27,0,0,0}, 0},
|
||||
{ "28A", "Linear Amp Control Relay: HF", {m_off, m_num, NULL}, "", {28,1,0,0}, 0},
|
||||
{ "28B", "Linear Amp Control Relay: 50MHz", {m_off, m_num, NULL}, "", {28,2,0,0}, 0},
|
||||
{ "28C", "Linear Amp Control Relay: 144MHz", {m_off, m_num, NULL}, "", {28,3,0,0}, 0},
|
||||
{ "28D", "Linear Amp Control Relay: 430MHz", {m_off, m_num, NULL}, "", {28,4,0,0}, 0},
|
||||
{ "28E", "Linear Amp Control Relay: 1.2GHz", {m_off, m_num, NULL}, "", {28,5,0,0}, 0},
|
||||
{ "29A", "CW Message: Playback Repeat", {m_off, m_on, NULL}, "", {29,1,0,0}, 0},
|
||||
{ "29B", "CW Message: Playback Interval", {m_num, NULL}, "", {29,2,0,0}, 0},
|
||||
{ "30", "Keying Priority over playback", {m_off, m_on, NULL}, "", {30,0,0,0}, 0},
|
||||
{ "31", "CW RX Pitch/TX sidetone frequency", {m_tbd, NULL}, "", {31,0,0,0}, 0},
|
||||
{ "32", "CW rise time", {m_tbd, NULL}, "", {32,0,0,0}, 0},
|
||||
{ "33", "CW weighting", {m_auto, m_tbd, NULL}, "", {33,0,0,0}, 0},
|
||||
{ "34", "Reversed CW weighting", {m_off, m_on, NULL}, "", {34,0,0,0}, 0},
|
||||
{ "35", "Bug key function", {m_off, m_on, NULL}, "", {35,0,0,0}, 0},
|
||||
{ "36", "Auto CW TX when keying in SSB", {m_off, m_on, NULL}, "", {36,0,0,0}, 0},
|
||||
{ "37", "Frequency correction for SSB-to-CW change", {m_off, m_on, NULL}, "", {37,0,0,0}, 0},
|
||||
{ "38", "FSK shift", {m_tbd, NULL}, "", {38,0,0,0}, 0},
|
||||
{ "39", "FSK key-down polarity", {m_norm, m_inv, NULL}, "", {39,0,0,0}, 0},
|
||||
{ "40", "FSK tone frequency", {m_tbd, NULL}, "", {40,0,0,0}, 0},
|
||||
{ "41", "FM mic gain", {m_low, m_mid, m_high, NULL}, "", {41,0,0,0}, 0},
|
||||
{ "42", "FM sub-tone type", {m_burst, m_cont, NULL}, "", {42,0,0,0}, 0},
|
||||
{ "43", "Auto repeater offset", {m_off, m_on, NULL}, "", {43,0,0,0}, 0},
|
||||
{ "44", "TX hold; 1750Hz tone", {m_off, m_on, NULL}, "", {44,0,0,0}, 0},
|
||||
{ "45A", "DTMF: Memory", {m_tbd, NULL}, "", {45,1,0,0}, 0},
|
||||
{ "45B", "DTMF: TX speed", {m_fast, m_slow, NULL}, "", {45,2,0,0}, 0},
|
||||
{ "45C", "DTMF: Pause duration", {m_tbd, NULL}, "", {45,3,0,0}, 0},
|
||||
{ "45D", "DTMF: Mic control", {m_off, m_on, NULL}, "", {45,4,0,0}, 0},
|
||||
{ "46", "TNC: Main/Sub", {m_main, m_sub, NULL}, "", {46,0,0,0}, 0},
|
||||
{ "47", "Data transfer rate; Built-in TNC", {m_tbd, NULL}, "", {47,0,0,0}, 0},
|
||||
{ "48", "DCD sense", {m_tnc, m_main_sub, NULL}, "", {48,0,0,0}, 0},
|
||||
{ "49A", "Packet Cluster: Tune", {m_auto, m_man, NULL}, "", {49,1,0,0}, 0},
|
||||
{ "49B", "Packet Cluster: RX confirmation tone", {m_off, m_morse, m_voice, NULL}, "", {49,2,0,0}, 0},
|
||||
{ "50A", "TNC: filter bandwidth", {m_off, m_on, NULL}, "", {50,1,0,0}, 0},
|
||||
{ "50B", "TNC: AF input level", {m_tbd, NULL}, "", {50,2,0,0}, 0},
|
||||
{ "50C", "TNC: Main band AF output level", {m_tbd, NULL}, "", {50,3,0,0}, 0},
|
||||
{ "50D", "TNC: Sub band AF output level", {m_tbd, NULL}, "", {50,4,0,0}, 0},
|
||||
{ "50E", "TNC: External", {m_main, m_sub, NULL}, "", {50,5,0,0}, 0},
|
||||
{ "50F", "TNC: Ext. Data transfer rate", {m_tbd, NULL}, "", {50,6,0,0}, 0},
|
||||
{ "51A", "Front panel PF key program", {key_menu, key_key, NULL}, "", {51,1,0,0}, 0},
|
||||
{ "51B", "Mic key program: PF1", {key_menu, key_key, NULL}, "", {51,2,0,0}, 0},
|
||||
{ "51C", "Mic key program: PF2", {key_menu, key_key, NULL}, "", {51,3,0,0}, 0},
|
||||
{ "51D", "Mic key program: PF3", {key_menu, key_key, NULL}, "", {51,4,0,0}, 0},
|
||||
{ "51E", "Mic key program: PF4", {key_menu, key_key, NULL}, "", {51,5,0,0}, 0},
|
||||
{ "52", "Settings copy to another transceiver", {m_off, m_on, NULL}, "", {52,0,0,0}, 0},
|
||||
{ "53", "Settings Copy to VFO", {m_off, m_on, NULL}, "", {53,0,0,0}, 0},
|
||||
{ "54", "TX inhibit", {m_off, m_on, NULL}, "", {54,0,0,0}, 0},
|
||||
{ "55", "Packet operation", {m_off, m_on, NULL}, "", {0550,0,0}, 0},
|
||||
{ "56", "COM connector parameters", {m_tbd, NULL}, "", {56,0,0,0}, 0},
|
||||
{ "57", "Auto power off", {m_off, m_on, NULL}, "", {57,0,0,0}, 0},
|
||||
{ "58", "Detachable-panel Display font in easy operation mode", {m_font1, m_font1, NULL}, "", {58,0,0,0}, 0},
|
||||
{ "59", "Panel display contrast", {m_tbd, NULL}, "", {59,0,0,0}, 0},
|
||||
{ "60", "Detachable-panel display reversal", {m_tbd, NULL}, "", {60,0,0,0}, 0},
|
||||
{ "61A", "Repeater mode select", {m_off, m_locked, m_cross, NULL}, "", {61,1,0,0}, 0},
|
||||
{ "61B", "TX hold; repeater", {m_off, m_on, NULL}, "", {61,2,0,0}, 0},
|
||||
{ "61C", "Remote Control ID code", {m_num, NULL}, "", {61,3,0,0}, 0},
|
||||
{ "61D", "Remote control acknowledge", {m_off, m_on, NULL}, "", {61,4,0,0}, 0},
|
||||
{ "61E", "Remote control", {m_off, m_on, NULL}, "", {61,5,0,0}, 0},
|
||||
{ "62A", "Commander callsign", {m_text, NULL}, "", {62,1,0,0}, 0},
|
||||
{ "62B", "Transporter callsign", {m_text, NULL}, "", {62,2,0,0}, 0},
|
||||
{ "62C", "Sky Command tone frequency", {m_tbd, NULL}, "", {62,3,0,0}, 0},
|
||||
{ "62D", "Sky command communication speed", {m_tbd, NULL}, "", {62,4,0,0}, 0},
|
||||
{ "62E", "Transceiver define", {m_off, m_client, m_command, m_transporter, NULL}, "", {62,5,0,0}, 0},
|
||||
{ NULL, NULL, NULL, {00,0,0,0}, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Items related to menu structure
|
||||
*/
|
||||
|
||||
// Programmable memories
|
||||
typedef struct {
|
||||
int curr; // PM now in use
|
||||
int orig; // what PM to restore on exit
|
||||
int orig_menu; // orignal menu in effect
|
||||
|
||||
int menu; // menuA or menuB of current PM
|
||||
|
||||
// the following set which PM's are private or public
|
||||
// they are set on init and enforced until exit
|
||||
unsigned int pub;
|
||||
unsigned int priv;
|
||||
#ifdef TS2K_ENFORCE_PM
|
||||
# define TS2K_PM_PUB ( (1<<2) | (1<<3) )
|
||||
# define TS2K_PM_PRIV ( (1<<0) | (1<<1) | (1<<4) | (1<<5) )
|
||||
#else
|
||||
# define TS2K_PM_PUB ( (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5) )
|
||||
# define TS2K_PM_PRIV (0)
|
||||
#endif
|
||||
|
||||
} ts2k_pm_t;
|
||||
|
||||
// Implemented/coded functions
|
||||
int ts2k_menu_init(RIG *rig, ts2k_menu_t *menu[]);
|
||||
int ts2k_menu_close(RIG *rig, ts2k_menu_t *menu[]);
|
||||
int ts2k_get_menu_no(RIG *rig, ts2k_menu_t *menu, int *main, int *sub);
|
||||
int ts2k_set_menu_no(RIG *rig, ts2k_menu_t *menu, int main, int sub);
|
||||
|
||||
// Unimplemented/uncoded functions
|
||||
char * ts2k_list_menu_no(RIG *rig, ts2k_menu_t *menu, int main, int sub);
|
||||
int ts2k_get_menu(RIG *rig, ts2k_menu_t *menu);
|
||||
int ts2k_set_menu(RIG *rig, ts2k_menu_t *menu);
|
||||
int ts2k_menu_parse(RIG *rig, ts2k_menu_t *menu);
|
||||
|
||||
/*
|
||||
* Related functions specific to this rig
|
||||
*/
|
||||
// Programmable memories[0, ..., 5] + menu[A, ..., B]
|
||||
int ts2k_get_menu_mode(RIG *rig, ts2k_menu_t *menu, ts2k_pm_t *pm);
|
||||
int ts2k_set_menu_mode(RIG *rig, ts2k_menu_t *menu, ts2k_pm_t *pm);
|
||||
|
||||
int ts2k_pm_init(RIG *rig, ts2k_pm_t *pm);
|
||||
int ts2k_pm_close(RIG *rig, ts2k_pm_t *pm);
|
||||
|
||||
// End ts2k_menu.c
|
|
@ -655,8 +655,6 @@ int HAMLIB_API amp_get_ext_level(AMP *amp, token_t level, value_t *val)
|
|||
return amp->caps->get_ext_level(amp, level, val);
|
||||
}
|
||||
|
||||
#if XXREMOVEDXX
|
||||
// Not referenced anywhere
|
||||
/**
|
||||
* \brief turn on/off the amplifier or standby/operate toggle
|
||||
* \param amp The amp handle
|
||||
|
@ -689,7 +687,6 @@ int HAMLIB_API amp_set_powerstat(AMP *amp, powerstat_t status)
|
|||
|
||||
return amp->caps->set_powerstat(amp, status);
|
||||
}
|
||||
#endif
|
||||
|
||||
int HAMLIB_API amp_get_powerstat(AMP *amp, powerstat_t *status)
|
||||
{
|
||||
|
|
|
@ -494,13 +494,13 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
char arg4[MAXARGSZ + 1], *p4 = NULL;
|
||||
char *p5 = NULL;
|
||||
char *p6 = NULL;
|
||||
static int last_was_ret = 1;
|
||||
|
||||
/* cmd, internal, ampctld */
|
||||
if (!(interactive && prompt && have_rl))
|
||||
{
|
||||
if (interactive)
|
||||
{
|
||||
static int last_was_ret = 1;
|
||||
if (prompt)
|
||||
{
|
||||
fprintf_flush(fout, "\nAmplifier command: ");
|
||||
|
@ -1060,7 +1060,7 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
|
|||
rp_getline(pmptstr);
|
||||
|
||||
/* Blank line entered */
|
||||
if (!(strcmp(input_line, "")))
|
||||
if (input_line && !(strcmp(input_line, "")))
|
||||
{
|
||||
fprintf(fout, "? for help, q to quit.\n");
|
||||
fflush(fout);
|
||||
|
|
Ładowanie…
Reference in New Issue