kopia lustrzana https://github.com/Hamlib/Hamlib
get_ptt patch from Terry
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2477 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.9
rodzic
d8bedaf04d
commit
84e247b8bd
|
@ -13,7 +13,7 @@
|
|||
* FT-950, FT-450. Much testing remains. -N0NB
|
||||
*
|
||||
*
|
||||
* $Id: newcat.c,v 1.7 2008-11-03 21:53:28 fillods Exp $
|
||||
* $Id: newcat.c,v 1.8 2008-11-16 14:49:12 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -428,7 +428,7 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
|
|||
}
|
||||
|
||||
/* Build the command string */
|
||||
snprintf(command, sizeof(command) - 1, "F%c", c);
|
||||
snprintf(command, sizeof(command), "F%c", c);
|
||||
if (!newcat_valid_command(rig, command))
|
||||
return -RIG_ENAVAIL;
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term);
|
||||
|
@ -682,7 +682,7 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo) {
|
|||
}
|
||||
|
||||
/* Build the command string */
|
||||
snprintf(command, sizeof(command) - 1, "VS");
|
||||
snprintf(command, sizeof(command), "VS");
|
||||
if (!newcat_valid_command(rig, command))
|
||||
return -RIG_ENAVAIL;
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, c, cat_term);
|
||||
|
@ -723,7 +723,7 @@ int newcat_get_vfo(RIG *rig, vfo_t *vfo) {
|
|||
state = &rig->state;
|
||||
|
||||
/* Build the command string */
|
||||
snprintf(command, sizeof(command) - 1, "VS");
|
||||
snprintf(command, sizeof(command), "VS");
|
||||
if (!newcat_valid_command(rig, command))
|
||||
return -RIG_ENAVAIL;
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s;", command);
|
||||
|
@ -833,9 +833,55 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
int newcat_get_ptt(RIG * rig, vfo_t vfo, ptt_t * ptt)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
char c;
|
||||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
int err;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
|
||||
return -RIG_ENAVAIL;
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s;", "TX");
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str);
|
||||
|
||||
/* Get PTT */
|
||||
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/* Check that command termination is correct */
|
||||
if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data);
|
||||
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, PTT value = %c\n", __func__, err, priv->ret_data, priv->ret_data[2]);
|
||||
|
||||
if (strcmp(priv->ret_data, "?;") == 0) {
|
||||
rig_debug(RIG_DEBUG_TRACE, "Unrecognized command, getting PTT\n");
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
c = priv->ret_data[2];
|
||||
switch (c) {
|
||||
case '0': /* FT-950 "TX OFF", Original Release Firmware */
|
||||
*ptt = RIG_PTT_OFF;
|
||||
break;
|
||||
case '1' : /* Just because, what the CAT Manual Shows */
|
||||
case '2' : /* FT-950 Radio: Mic, Dataport, CW "TX ON" */
|
||||
case '3' : /* FT-950 CAT port: Radio in "TX ON" mode [Not what the CAT Manual Shows] */
|
||||
*ptt = RIG_PTT_ON;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue