kopia lustrzana https://github.com/Hamlib/Hamlib
Added FT950 "EX117" ANTIVOX level_set/get.
Added FT950 COMP Level_set/get. Added "AB" for FT950 VFO copy. Changed Command "VV" FT950 to FALSE. Added RIG_LEVEL_VOX bounds checking. Keep at ms for GRIG2. Added RIG_LEVEL_BKINDL bounds checking. Keep at ms for GRIG2. Changed newcat_set/get_freq to not set or change priv->current_vfo *** Want to NOT ping-pong vfos when changing freq. *** Changed newcat_get/set_rit logic. Changed newcat_get/set_xit logic. Changed RIG_LEVEL_IF logic. Found odd compiler problem with %+04d versus %+.4d Fixed some scale references between FT450 and FT950. Some code cleanup. Sorry cvs diff -wB Some testing on GRIG2 GUI and FlDigi. Terry KJ4EED git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2497 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.9
rodzic
6686489197
commit
3b71851086
|
@ -8,7 +8,7 @@
|
|||
* via serial interface to an FT-950 using the "CAT" interface
|
||||
*
|
||||
*
|
||||
* $Id: ft950.h,v 1.4 2008-12-06 02:37:45 mrtembry Exp $
|
||||
* $Id: ft950.h,v 1.5 2008-12-10 23:53:56 mrtembry Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -57,7 +57,8 @@
|
|||
RIG_LEVEL_MICGAIN|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH|\
|
||||
RIG_LEVEL_KEYSPD|RIG_LEVEL_AF|RIG_LEVEL_AGC|\
|
||||
RIG_LEVEL_METER|RIG_LEVEL_BKINDL|RIG_LEVEL_SQL|\
|
||||
RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY)
|
||||
RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_COMP|\
|
||||
RIG_LEVEL_ANTIVOX)
|
||||
|
||||
#define FT950_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\
|
||||
RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\
|
||||
|
|
153
yaesu/newcat.c
153
yaesu/newcat.c
|
@ -13,7 +13,7 @@
|
|||
* FT-950, FT-450. Much testing remains. -N0NB
|
||||
*
|
||||
*
|
||||
* $Id: newcat.c,v 1.16 2008-12-07 23:16:51 mrtembry Exp $
|
||||
* $Id: newcat.c,v 1.17 2008-12-10 23:53:56 mrtembry Exp $
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -171,7 +171,7 @@ yaesu_newcat_commands_t valid_commands[] = {
|
|||
{"VM", TRUE, TRUE, TRUE, FALSE },
|
||||
{"VR", TRUE, FALSE, FALSE, FALSE },
|
||||
{"VS", TRUE, TRUE, TRUE, FALSE },
|
||||
{"VV", TRUE, TRUE, FALSE, FALSE },
|
||||
{"VV", TRUE, FALSE, FALSE, FALSE },
|
||||
{"VX", TRUE, TRUE, TRUE, TRUE },
|
||||
{"XT", FALSE, TRUE, TRUE, TRUE },
|
||||
};
|
||||
|
@ -310,10 +310,8 @@ int newcat_close(RIG *rig) {
|
|||
* rig_set_freq
|
||||
*
|
||||
* Set frequency for a given VFO
|
||||
*
|
||||
* If vfo is set to RIG_VFO_CUR then vfo from priv_data is used.
|
||||
* If vfo differs from stored value then VFO will be set to the
|
||||
* passed vfo.
|
||||
* RIG_TARGETABLE_VFO
|
||||
* Does not SET priv->current_vfo
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -344,15 +342,19 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
|
|||
freq < caps->rx_range_list2[0].start || freq > caps->rx_range_list2[0].end)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
if (vfo == RIG_VFO_CURR) {
|
||||
vfo = priv->current_vfo; /* from previous vfo cmd */
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo);
|
||||
} else if (vfo != priv->current_vfo) {
|
||||
/* force a VFO change if requested vfo value differs from stored value */
|
||||
err = newcat_set_vfo(rig, vfo);
|
||||
if (err != RIG_OK)
|
||||
//if (vfo == RIG_VFO_CURR) {
|
||||
// vfo = priv->current_vfo; /* from previous vfo cmd */
|
||||
// rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo);
|
||||
//} else if (vfo != priv->current_vfo) {
|
||||
// /* force a VFO change if requested vfo value differs from stored value */
|
||||
// err = newcat_set_vfo(rig, vfo);
|
||||
// if (err != RIG_OK)
|
||||
// return err;
|
||||
//}
|
||||
|
||||
err = newcat_set_vfo_from_alias(rig, &vfo);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
switch (vfo) {
|
||||
case RIG_VFO_A:
|
||||
|
@ -392,6 +394,8 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
|
|||
* rig_get_freq
|
||||
*
|
||||
* Return Freq for a given VFO
|
||||
* RIG_TARGETABLE_FREQ
|
||||
* Does not SET priv->current_vfo
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -411,15 +415,19 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
|
|||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
|
||||
if (vfo == RIG_VFO_CURR) {
|
||||
err = newcat_get_vfo(rig, &priv->current_vfo);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
//if (vfo == RIG_VFO_CURR) {
|
||||
// err = newcat_get_vfo(rig, &priv->current_vfo);
|
||||
// if (err != RIG_OK)
|
||||
// return err;
|
||||
|
||||
vfo = priv->current_vfo; /* from previous get_vfo cmd */
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: priv->current_vfo = 0x%02x\n", __func__, vfo);
|
||||
}
|
||||
// vfo = priv->current_vfo; /* from previous get_vfo cmd */
|
||||
// rig_debug(RIG_DEBUG_TRACE,
|
||||
// "%s: priv->current_vfo = 0x%02x\n", __func__, vfo);
|
||||
//}
|
||||
|
||||
err = newcat_set_vfo_from_alias(rig, &vfo);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
switch(vfo) {
|
||||
case RIG_VFO_A:
|
||||
|
@ -1056,21 +1064,18 @@ int newcat_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
|
|||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
int err;
|
||||
shortfreq_t tmp_rit;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
|
||||
tmp_rit = rit;
|
||||
rit = abs(rit);
|
||||
if (rit > rig->caps->max_rit)
|
||||
if (abs(rit) > rig->caps->max_rit)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
if (tmp_rit == 0)
|
||||
if (rit == 0)
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRT0%c", cat_term, cat_term);
|
||||
else if (tmp_rit < 0)
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRD%04ld%cRT1%c", cat_term, rit, cat_term, cat_term);
|
||||
else if (rit < 0)
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRD%04d%cRT1%c", cat_term, abs(rit), cat_term, cat_term);
|
||||
else
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRU%04ld%cRT1%c", cat_term, rit, cat_term, cat_term);
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRU%04d%cRT1%c", cat_term, abs(rit), cat_term, cat_term);
|
||||
|
||||
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
|
||||
if (err != RIG_OK)
|
||||
|
@ -1136,24 +1141,21 @@ int newcat_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit)
|
|||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
int err;
|
||||
shortfreq_t tmp_xit;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
|
||||
if (!newcat_valid_command(rig, "XT"))
|
||||
return -RIG_ENAVAIL;
|
||||
|
||||
tmp_xit = xit;
|
||||
xit = abs(xit);
|
||||
if (xit > rig->caps->max_xit)
|
||||
if (abs(xit) > rig->caps->max_xit)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
if (tmp_xit == 0)
|
||||
if (xit == 0)
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cXT0%c", cat_term, cat_term);
|
||||
else if (tmp_xit < 0)
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRD%04ld%cXT1%c", cat_term, xit, cat_term, cat_term);
|
||||
else if (xit < 0)
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRD%04d%cXT1%c", cat_term, abs(xit), cat_term, cat_term);
|
||||
else
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRU%04ld%cXT1%c", cat_term, xit, cat_term, cat_term);
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRU%04d%cXT1%c", cat_term, abs(xit), cat_term, cat_term);
|
||||
|
||||
err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str));
|
||||
if (err != RIG_OK)
|
||||
|
@ -1496,8 +1498,7 @@ int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
|
|||
int err;
|
||||
int i;
|
||||
char cmdstr[16];
|
||||
float scale;
|
||||
char c;
|
||||
int scale;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -1509,7 +1510,7 @@ int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
switch (level) {
|
||||
case RIG_LEVEL_RFPOWER:
|
||||
scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100. : 255.;
|
||||
scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100 : 255;
|
||||
sprintf(cmdstr, "PC%03d%c", (int)(scale * val.f), cat_term);
|
||||
break;
|
||||
case RIG_LEVEL_AF:
|
||||
|
@ -1526,11 +1527,9 @@ int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
|
|||
}
|
||||
break;
|
||||
case RIG_LEVEL_IF:
|
||||
if (val.i < 0)
|
||||
c = '-';
|
||||
else
|
||||
c = '+'; /* FT950 IF Shift needs "+0000" for center */
|
||||
sprintf(cmdstr, "IS0%c%04d;", c, abs(val.i));
|
||||
if (abs(val.i) > rig->caps->max_ifshift)
|
||||
return -RIG_EINVAL;
|
||||
sprintf(cmdstr, "IS0%+.4d;", val.i); /* format problem with %+04d */
|
||||
break;
|
||||
case RIG_LEVEL_CWPITCH:
|
||||
if (val.i < 300)
|
||||
|
@ -1539,7 +1538,6 @@ int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
|
|||
i = 1050;
|
||||
else
|
||||
i = val.i;
|
||||
|
||||
sprintf(cmdstr, "KP%02d;", 2*((i+50-300)/100));
|
||||
break;
|
||||
case RIG_LEVEL_KEYSPD:
|
||||
|
@ -1593,10 +1591,17 @@ int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
|
|||
sprintf(cmdstr, "RL0%02d;", (int)(10*val.f)+1);
|
||||
break;
|
||||
case RIG_LEVEL_COMP:
|
||||
sprintf(cmdstr, "PL%03d;", (int)(255*val.f));
|
||||
scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100 : 255;
|
||||
sprintf(cmdstr, "PL%03d;", (int)(scale * val.f));
|
||||
break;
|
||||
case RIG_LEVEL_BKINDL:
|
||||
/* FIXME: should be tenth of dots, newcat expects ms */
|
||||
/* GUI GRIG2 expects ms so keep FT450 and FT950 BKIN DELAY in ms for now */
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT950) || newcat_is_rig(rig, RIG_MODEL_FT450)) {
|
||||
if (((val.i > 0) && (val.i < 30)) || (val.i > 3000)) /* 0000, is rejected by FT950 */
|
||||
return -RIG_EINVAL;
|
||||
sprintf(cmdstr, "SD%04d;", val.i);
|
||||
} else
|
||||
sprintf(cmdstr, "SD%04d;", val.i);
|
||||
break;
|
||||
case RIG_LEVEL_SQL:
|
||||
|
@ -1604,12 +1609,28 @@ int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val)
|
|||
break;
|
||||
case RIG_LEVEL_VOX:
|
||||
/* VOX delay, arg int (tenth of seconds), expects ms */
|
||||
/* GUI GRIG2 expects ms so keep FT950 and FT450 VOX delay in ms */
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT950)) {
|
||||
if (((val.i >= 0) && (val.i < 30)) || (val.i > 3000))
|
||||
return -RIG_EINVAL;
|
||||
sprintf(cmdstr, "VD%04d;", val.i);
|
||||
} else if (newcat_is_rig(rig, RIG_MODEL_FT450)) {
|
||||
if (((val.i >= 0) && (val.i < 100)) || (val.i > 3000))
|
||||
return -RIG_EINVAL;
|
||||
sprintf(cmdstr, "VD%04d;", val.i);
|
||||
} else
|
||||
sprintf(cmdstr, "VD%04d;", val.i*100);
|
||||
break;
|
||||
case RIG_LEVEL_VOXGAIN:
|
||||
scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100. : 255.;
|
||||
scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100 : 255;
|
||||
sprintf(cmdstr, "VG%03d;", (int)(scale * val.f));
|
||||
break;
|
||||
case RIG_LEVEL_ANTIVOX:
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT950))
|
||||
sprintf(cmdstr, "EX117%03d;", (int)(100 * val.f));
|
||||
else
|
||||
return -RIG_EINVAL;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
@ -1706,6 +1727,12 @@ int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val)
|
|||
case RIG_LEVEL_ALC:
|
||||
cmdstr = "RM4;";
|
||||
break;
|
||||
case RIG_LEVEL_ANTIVOX:
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT950))
|
||||
cmdstr = "EX117;";
|
||||
else
|
||||
return -RIG_EINVAL;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
@ -1735,6 +1762,8 @@ int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val)
|
|||
switch (level) {
|
||||
case RIG_LEVEL_RFPOWER:
|
||||
case RIG_LEVEL_VOXGAIN:
|
||||
case RIG_LEVEL_COMP:
|
||||
case RIG_LEVEL_ANTIVOX:
|
||||
scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100. : 255.;
|
||||
val->f = (float)atoi(retlvl)/scale;
|
||||
break;
|
||||
|
@ -1742,25 +1771,26 @@ int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val)
|
|||
case RIG_LEVEL_MICGAIN:
|
||||
case RIG_LEVEL_RF:
|
||||
case RIG_LEVEL_SQL:
|
||||
case RIG_LEVEL_COMP:
|
||||
case RIG_LEVEL_SWR:
|
||||
case RIG_LEVEL_ALC:
|
||||
val->f = (float)atoi(retlvl)/255.;
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_BKINDL: /* FIXME FT950 FT450 works with GUI GRIG2; */
|
||||
case RIG_LEVEL_RAWSTR:
|
||||
case RIG_LEVEL_KEYSPD:
|
||||
case RIG_LEVEL_BKINDL: /* FIXME */
|
||||
case RIG_LEVEL_IF:
|
||||
val->i = atoi(retlvl);
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_NR:
|
||||
val->f = (float)(atoi(retlvl)-1)/10.;
|
||||
break;
|
||||
case RIG_LEVEL_VOX:
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT950) || newcat_is_rig(rig, RIG_MODEL_FT450)) {
|
||||
val->i = atoi(retlvl); /* ms, works with GRIG2 */
|
||||
} else {
|
||||
/* VOX delay, arg int (tenth of seconds) */
|
||||
val->i = atoi(retlvl)/100;
|
||||
}
|
||||
break;
|
||||
case RIG_LEVEL_PREAMP:
|
||||
if (retlvl[0] < '0' || retlvl[0] > '9')
|
||||
|
@ -1821,10 +1851,10 @@ int newcat_set_func(RIG * rig, vfo_t vfo, setting_t func, int status)
|
|||
|
||||
switch (func) {
|
||||
case RIG_FUNC_ANF:
|
||||
sprintf(cmdstr, "BC%d;", status ? 1 : 0);
|
||||
sprintf(cmdstr, "BC0%d;", status ? 1 : 0);
|
||||
break;
|
||||
case RIG_FUNC_MN:
|
||||
sprintf(cmdstr, "BP00%d;", status ? 1 : 0);
|
||||
sprintf(cmdstr, "BP00%03d;", status ? 1 : 0);
|
||||
break;
|
||||
case RIG_FUNC_FBKIN:
|
||||
sprintf(cmdstr, "BI%d;", status ? 1 : 0);
|
||||
|
@ -1884,7 +1914,7 @@ int newcat_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status)
|
|||
|
||||
switch (func) {
|
||||
case RIG_FUNC_ANF:
|
||||
cmdstr = "BC;";
|
||||
cmdstr = "BC0;";
|
||||
break;
|
||||
case RIG_FUNC_MN:
|
||||
cmdstr = "BP00;";
|
||||
|
@ -1943,8 +1973,10 @@ int newcat_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status)
|
|||
priv->ret_data[ret_data_len-1] = '\0';
|
||||
|
||||
switch (func) {
|
||||
case RIG_FUNC_ANF:
|
||||
case RIG_FUNC_MN:
|
||||
*status = (retfunc[2] == '0') ? 0 : 1;
|
||||
break;
|
||||
case RIG_FUNC_ANF:
|
||||
case RIG_FUNC_FBKIN:
|
||||
case RIG_FUNC_LOCK:
|
||||
case RIG_FUNC_MON:
|
||||
|
@ -2156,7 +2188,10 @@ int newcat_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op)
|
|||
cmdstr = "AC002;";
|
||||
break;
|
||||
case RIG_OP_CPY:
|
||||
if (newcat_is_rig(rig, RIG_MODEL_FT450))
|
||||
cmdstr = "VV;";
|
||||
else
|
||||
cmdstr = "AB;"; /* VFO_A to VFO_B */
|
||||
break;
|
||||
case RIG_OP_XCHG:
|
||||
cmdstr = "SV;";
|
||||
|
@ -2669,13 +2704,13 @@ int newcat_set_vfo_from_alias(RIG * rig, vfo_t * vfo) {
|
|||
struct newcat_priv_data *priv;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: raw vfo = 0x%02x\n", __func__, *vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: alias vfo = 0x%02x\n", __func__, *vfo);
|
||||
|
||||
switch (*vfo) {
|
||||
case RIG_VFO_A:
|
||||
case RIG_VFO_B:
|
||||
case RIG_VFO_MEM:
|
||||
/* pass these through */
|
||||
/* passes through */
|
||||
break;
|
||||
case RIG_VFO_CURR: /* RIG_VFO_RX == RIG_VFO_CURR */
|
||||
case RIG_VFO_VFO:
|
||||
|
|
Ładowanie…
Reference in New Issue