ft1000mp.c check use current_vfo for VFOB actions

Update for ENTERFUNC and RETURNFUNC and standardize debug statements
https://github.com/Hamlib/Hamlib/issues/561
pull/572/head^2
Michael Black W9MDB 2021-02-23 22:59:43 -06:00
rodzic e64c1e8eb7
commit b17f8dc9f6
1 zmienionych plików z 103 dodań i 91 usunięć

Wyświetl plik

@ -222,7 +222,7 @@ const struct rig_caps ft1000mp_caps =
RIG_MODEL(RIG_MODEL_FT1000MP), RIG_MODEL(RIG_MODEL_FT1000MP),
.model_name = "FT-1000MP", .model_name = "FT-1000MP",
.mfg_name = "Yaesu", .mfg_name = "Yaesu",
.version = "20210222.0", .version = "20210223.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
@ -356,7 +356,7 @@ const struct rig_caps ft1000mpmkv_caps =
RIG_MODEL(RIG_MODEL_FT1000MPMKV), RIG_MODEL(RIG_MODEL_FT1000MPMKV),
.model_name = "MARK-V FT-1000MP", .model_name = "MARK-V FT-1000MP",
.mfg_name = "Yaesu", .mfg_name = "Yaesu",
.version = "20210222.0", .version = "20210223.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
@ -490,7 +490,7 @@ const struct rig_caps ft1000mpmkvfld_caps =
RIG_MODEL(RIG_MODEL_FT1000MPMKVFLD), RIG_MODEL(RIG_MODEL_FT1000MPMKVFLD),
.model_name = "MARK-V Field FT-1000MP", .model_name = "MARK-V Field FT-1000MP",
.mfg_name = "Yaesu", .mfg_name = "Yaesu",
.version = "20210222.0", .version = "20210223.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
@ -629,15 +629,14 @@ int ft1000mp_init(RIG *rig)
{ {
struct ft1000mp_priv_data *priv; struct ft1000mp_priv_data *priv;
rig_debug(RIG_DEBUG_TRACE, "%s: called \n", __func__); ENTERFUNC;
rig->state.priv = (struct ft1000mp_priv_data *) calloc(1, rig->state.priv = (struct ft1000mp_priv_data *) calloc(1,
sizeof(struct ft1000mp_priv_data)); sizeof(struct ft1000mp_priv_data));
if (!rig->state.priv) /* whoops! memory shortage! */ if (!rig->state.priv) /* whoops! memory shortage! */
{ {
return -RIG_ENOMEM; RETURNFUNC(-RIG_ENOMEM);
} }
priv = rig->state.priv; priv = rig->state.priv;
@ -653,7 +652,7 @@ int ft1000mp_init(RIG *rig)
priv->read_update_delay = priv->read_update_delay =
FT1000MP_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ FT1000MP_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -665,9 +664,7 @@ int ft1000mp_init(RIG *rig)
int ft1000mp_cleanup(RIG *rig) int ft1000mp_cleanup(RIG *rig)
{ {
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (rig->state.priv) if (rig->state.priv)
{ {
@ -676,7 +673,7 @@ int ft1000mp_cleanup(RIG *rig)
rig->state.priv = NULL; rig->state.priv = NULL;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -691,14 +688,14 @@ int ft1000mp_open(RIG *rig)
struct ft1000mp_priv_data *p; struct ft1000mp_priv_data *p;
unsigned char *cmd; /* points to sequence to send */ unsigned char *cmd; /* points to sequence to send */
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); ENTERFUNC;
rig_s = &rig->state; rig_s = &rig->state;
p = (struct ft1000mp_priv_data *)rig_s->priv; p = (struct ft1000mp_priv_data *)rig_s->priv;
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: rig_open: write_delay = %i msec \n", rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: write_delay = %i msec \n", __func__,
rig_s->rigport.write_delay); rig_s->rigport.write_delay);
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: rig_open: post_write_delay = %i msec \n", rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: post_write_delay = %i msec \n", __func__,
rig_s->rigport.post_write_delay); rig_s->rigport.post_write_delay);
/* /*
@ -706,7 +703,7 @@ int ft1000mp_open(RIG *rig)
*/ */
memcpy(&p->p_cmd, &ncmd[FT1000MP_NATIVE_PACING].nseq, YAESU_CMD_LENGTH); memcpy(&p->p_cmd, &ncmd[FT1000MP_NATIVE_PACING].nseq, YAESU_CMD_LENGTH);
p->p_cmd[3] = p->pacing; /* get pacing value, and store in private cmd */ p->p_cmd[3] = p->pacing; /* get pacing value, and store in private cmd */
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: read pacing = %i\n", p->pacing); rig_debug(RIG_DEBUG_TRACE, "%s: read pacing = %i\n", __func__, p->pacing);
/* send PACING cmd to rig */ /* send PACING cmd to rig */
cmd = p->p_cmd; cmd = p->p_cmd;
@ -715,7 +712,7 @@ int ft1000mp_open(RIG *rig)
ft1000mp_get_vfo(rig, &rig->state.current_vfo); ft1000mp_get_vfo(rig, &rig->state.current_vfo);
/* TODO */ /* TODO */
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -727,8 +724,7 @@ int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
unsigned char *cmd; /* points to sequence to send */ unsigned char *cmd; /* points to sequence to send */
int cmd_index = 0; int cmd_index = 0;
rig_debug(RIG_DEBUG_TRACE, "%s: ft1000mp_set_freq called\n", __func__); ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv; p = (struct ft1000mp_priv_data *)rig->state.priv;
@ -754,11 +750,11 @@ int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
case RIG_VFO_MEM: case RIG_VFO_MEM:
/* TODO, hint: store current memory number */ /* TODO, hint: store current memory number */
return -RIG_ENIMPL; RETURNFUNC(-RIG_ENIMPL);
default: default:
rig_debug(RIG_DEBUG_WARN, "ft1000mp: unknown VFO %d\n", vfo); rig_debug(RIG_DEBUG_WARN, "%s: unknown VFO %d\n", __func__, vfo);
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
/* /*
@ -776,13 +772,15 @@ int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
cmd = p->p_cmd; /* get native sequence */ cmd = p->p_cmd; /* get native sequence */
write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
int ft1000mp_get_vfo_data(RIG *rig, vfo_t vfo) int ft1000mp_get_vfo_data(RIG *rig, vfo_t vfo)
{ {
int cmd_index, len, retval; int cmd_index, len, retval;
ENTERFUNC;
if (vfo == RIG_VFO_A || vfo == RIG_VFO_B) if (vfo == RIG_VFO_A || vfo == RIG_VFO_B)
{ {
cmd_index = FT1000MP_NATIVE_VFO_UPDATE; cmd_index = FT1000MP_NATIVE_VFO_UPDATE;
@ -800,7 +798,7 @@ int ft1000mp_get_vfo_data(RIG *rig, vfo_t vfo)
*/ */
retval = ft1000mp_get_update_data(rig, cmd_index, len); retval = ft1000mp_get_update_data(rig, cmd_index, len);
return retval; RETURNFUNC(retval);
} }
/* /*
* Return Freq for a given VFO * Return Freq for a given VFO
@ -816,11 +814,16 @@ int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo == RIG_VFO_CURR) {
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
vfo = rig->state.current_vfo;
}
retval = ft1000mp_get_vfo_data(rig, vfo); retval = ft1000mp_get_vfo_data(rig, vfo);
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
priv = (struct ft1000mp_priv_data *)rig->state.priv; priv = (struct ft1000mp_priv_data *)rig->state.priv;
@ -837,12 +840,12 @@ int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/* big endian integer, kinda */ /* big endian integer, kinda */
f = ((((((p[0] << 8) + p[1]) << 8) + p[2]) << 8) + p[3]) * 10 / 16; f = ((((((p[0] << 8) + p[1]) << 8) + p[2]) << 8) + p[3]) * 10 / 16;
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: freq = %"PRIfreq" Hz for VFO [%x]\n", f, rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for VFO [%x]\n", __func__, f,
vfo); vfo);
*freq = f; /* return displayed frequency */ *freq = f; /* return displayed frequency */
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -863,6 +866,10 @@ int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_debug(RIG_DEBUG_TRACE, "%s: generic mode = %s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: generic mode = %s\n", __func__,
rig_strrmode(mode)); rig_strrmode(mode));
if (vfo == RIG_VFO_CURR) {
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
vfo = rig->state.current_vfo;
}
/* /*
* translate mode from generic to ft1000mp specific * translate mode from generic to ft1000mp specific
*/ */
@ -939,7 +946,7 @@ int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
break; break;
default: default:
return -RIG_EINVAL; /* sorry, wrong MODE */ RETURNFUNC(-RIG_EINVAL); /* sorry, wrong MODE * */
} }
@ -954,9 +961,9 @@ int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
*/ */
ft1000mp_send_priv_cmd(rig, cmd_index); ft1000mp_send_priv_cmd(rig, cmd_index);
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: cmd_index = %i\n", cmd_index); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_index = %i\n", __func__, cmd_index);
return RIG_OK; /* good */ RETURNFUNC(RIG_OK); /* good */
} }
@ -973,14 +980,18 @@ int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
unsigned char mymode_ext; /* ft1000mp extra mode bit mode */ unsigned char mymode_ext; /* ft1000mp extra mode bit mode */
int retval; int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); ENTERFUNC;
if (vfo == RIG_VFO_CURR) {
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
vfo = rig->state.current_vfo;
}
retval = ft1000mp_get_vfo_data(rig, vfo); retval = ft1000mp_get_vfo_data(rig, vfo);
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
priv = (struct ft1000mp_priv_data *)rig->state.priv; priv = (struct ft1000mp_priv_data *)rig->state.priv;
@ -997,10 +1008,10 @@ int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
} }
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: mymode = %x (before)\n", mymode); rig_debug(RIG_DEBUG_TRACE, "%s: mymode = %x (before)\n", __func__, mymode);
mymode &= MODE_MASK; mymode &= MODE_MASK;
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: mymode = %x (after)\n", mymode); rig_debug(RIG_DEBUG_TRACE, "%s: mymode = %x (after)\n", __func__, mymode);
/* /*
* translate mode from ft1000mp to generic. * translate mode from ft1000mp to generic.
@ -1037,16 +1048,16 @@ int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
break; break;
default: default:
return -RIG_EINVAL; /* sorry, wrong mode */ RETURNFUNC(-RIG_EINVAL); /* sorry, wrong mode */
break; break;
} }
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: mode = %s\n", rig_strrmode(*mode)); rig_debug(RIG_DEBUG_TRACE, "%s: mode = %s\n", __func__, rig_strrmode(*mode));
/* TODO: set real IF filter selection */ /* TODO: set real IF filter selection */
*width = RIG_PASSBAND_NORMAL; *width = RIG_PASSBAND_NORMAL;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -1060,7 +1071,8 @@ int ft1000mp_set_vfo(RIG *rig, vfo_t vfo)
{ {
//unsigned char cmd_index = 0; /* index of sequence to send */ //unsigned char cmd_index = 0; /* index of sequence to send */
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: ft1000mp_set_vfo called %s\n", ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: called %s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
/* /*
@ -1092,11 +1104,11 @@ int ft1000mp_set_vfo(RIG *rig, vfo_t vfo)
case RIG_VFO_CURR: case RIG_VFO_CURR:
/* do nothing, we're already at it! */ /* do nothing, we're already at it! */
return RIG_OK; RETURNFUNC(RIG_OK);
default: default:
rig_debug(RIG_DEBUG_VERBOSE, "%s: Unknown default VFO %d\n", __func__, vfo); rig_debug(RIG_DEBUG_VERBOSE, "%s: Unknown default VFO %d\n", __func__, vfo);
return -RIG_EINVAL; /* sorry, wrong VFO */ RETURNFUNC(-RIG_EINVAL); /* sorry, wrong VFO */
} }
/* /*
@ -1105,7 +1117,7 @@ int ft1000mp_set_vfo(RIG *rig, vfo_t vfo)
ft1000mp_send_priv_cmd(rig, cmd_index); ft1000mp_send_priv_cmd(rig, cmd_index);
#endif #endif
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -1121,8 +1133,7 @@ int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
struct ft1000mp_priv_data *p; struct ft1000mp_priv_data *p;
int retval; int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv; p = (struct ft1000mp_priv_data *)rig->state.priv;
@ -1132,7 +1143,7 @@ int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
if (p->update_data[1] & 0x40) if (p->update_data[1] & 0x40)
@ -1151,7 +1162,7 @@ int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: vfo status = %x %x\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo status = %x %x\n", __func__,
p->update_data[0], p->update_data[1]); p->update_data[0], p->update_data[1]);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
@ -1160,11 +1171,10 @@ int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
struct rig_state *rs; struct rig_state *rs;
unsigned char *cmd; unsigned char *cmd;
ENTERFUNC;
rs = &rig->state; rs = &rig->state;
priv = (struct ft1000mp_priv_data *)rig->state.priv; priv = (struct ft1000mp_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called func\n", __func__);
switch (func) switch (func)
{ {
case RIG_FUNC_RIT: case RIG_FUNC_RIT:
@ -1180,7 +1190,7 @@ int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
cmd = priv->p_cmd; cmd = priv->p_cmd;
write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH); write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return RIG_OK; RETURNFUNC(RIG_OK);
case RIG_FUNC_XIT: case RIG_FUNC_XIT:
if (status) if (status)
@ -1195,14 +1205,14 @@ int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
cmd = priv->p_cmd; cmd = priv->p_cmd;
write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH); break; write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH); break;
return RIG_OK; RETURNFUNC(RIG_OK);
default: default:
rig_debug(RIG_DEBUG_ERR, "Unsupported set_func %s", rig_strfunc(func)); rig_debug(RIG_DEBUG_ERR, "%s: Unsupported set_func %s", __func__, rig_strfunc(func));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{ {
@ -1210,13 +1220,12 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
struct ft1000mp_priv_data *priv; struct ft1000mp_priv_data *priv;
unsigned char *p; unsigned char *p;
ENTERFUNC;
priv = (struct ft1000mp_priv_data *)rig->state.priv; priv = (struct ft1000mp_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!status) if (!status)
{ {
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
switch (func) switch (func)
@ -1227,7 +1236,7 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
if (vfo == RIG_VFO_B) if (vfo == RIG_VFO_B)
@ -1240,7 +1249,7 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
} }
*status = (*p & 2) ? 1 : 0; *status = (*p & 2) ? 1 : 0;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -1250,7 +1259,7 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
if (vfo == RIG_VFO_B) if (vfo == RIG_VFO_B)
@ -1263,17 +1272,17 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
} }
*status = (*p & 1) ? 1 : 0; *status = (*p & 1) ? 1 : 0;
return RIG_OK; RETURNFUNC(RIG_OK);
} }
default: default:
rig_debug(RIG_DEBUG_ERR, "Unsupported get_func %s", rig_strfunc(func)); rig_debug(RIG_DEBUG_ERR, "%s: Unsupported get_func %s", __func__, rig_strfunc(func));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
/* /*
@ -1281,17 +1290,19 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
*/ */
int ft1000mp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) int ft1000mp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{ {
ENTERFUNC;
if (rit != 0) if (rit != 0)
{ {
ft1000mp_set_func(rig, vfo, RIG_FUNC_RIT, 1); ft1000mp_set_func(rig, vfo, RIG_FUNC_RIT, 1);
} }
return ft1000mp_set_rxit(rig, vfo, rit); RETURNFUNC(ft1000mp_set_rxit(rig, vfo, rit));
} }
int ft1000mp_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit) int ft1000mp_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{ {
return ft1000mp_set_rxit(rig, vfo, rit); ENTERFUNC;
RETURNFUNC(ft1000mp_set_rxit(rig, vfo, rit));
} }
int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit) int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit)
@ -1301,7 +1312,7 @@ int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit)
unsigned char *cmd; /* points to sequence to send */ unsigned char *cmd; /* points to sequence to send */
int direction = 0; int direction = 0;
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); ENTERFUNC;
rs = &rig->state; rs = &rig->state;
priv = (struct ft1000mp_priv_data *)rs->priv; priv = (struct ft1000mp_priv_data *)rs->priv;
@ -1334,7 +1345,7 @@ int ft1000mp_set_rxit(RIG *rig, vfo_t vfo, shortfreq_t rit)
cmd = priv->p_cmd; /* get native sequence */ cmd = priv->p_cmd; /* get native sequence */
write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH); write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -1350,7 +1361,7 @@ int ft1000mp_get_rxit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
shortfreq_t f; shortfreq_t f;
int retval; int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); ENTERFUNC;
priv = (struct ft1000mp_priv_data *)rig->state.priv; priv = (struct ft1000mp_priv_data *)rig->state.priv;
@ -1358,7 +1369,7 @@ int ft1000mp_get_rxit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
if (vfo == RIG_VFO_B) if (vfo == RIG_VFO_B)
@ -1385,7 +1396,7 @@ int ft1000mp_get_rxit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
*rit = f; /* return displayed frequency */ *rit = f; /* return displayed frequency */
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -1398,6 +1409,7 @@ int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int retval; int retval;
int retry = rig->state.rigport.retry; int retry = rig->state.rigport.retry;
ENTERFUNC;
rs = &rig->state; rs = &rig->state;
priv = (struct ft1000mp_priv_data *)rs->priv; priv = (struct ft1000mp_priv_data *)rs->priv;
@ -1447,7 +1459,7 @@ int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported get_level %s", __func__, rig_debug(RIG_DEBUG_ERR, "%s: unsupported get_level %s", __func__,
rig_strlevel(level)); rig_strlevel(level));
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
memset(&priv->p_cmd, m, YAESU_CMD_LENGTH - 1); memset(&priv->p_cmd, m, YAESU_CMD_LENGTH - 1);
@ -1463,8 +1475,8 @@ int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
if (retval != YAESU_CMD_LENGTH) if (retval != YAESU_CMD_LENGTH)
{ {
rig_debug(RIG_DEBUG_ERR, "ft1000mp_get_level: ack NG %d", retval); rig_debug(RIG_DEBUG_ERR, "%s: ack NG %d", __func__, retval);
return retval; RETURNFUNC(retval);
} }
switch (level) switch (level)
@ -1484,23 +1496,24 @@ int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
} }
} }
rig_debug(RIG_DEBUG_TRACE, "ft1000mp_get_level: %d %d %f\n", lvl_data[0], rig_debug(RIG_DEBUG_TRACE, "%s: %d %d %f\n", __func__, lvl_data[0],
val->i, val->f); val->i, val->f);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
int ft1000mp_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) int ft1000mp_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{ {
unsigned char cmd_index; /* index of sequence to send */ unsigned char cmd_index; /* index of sequence to send */
rig_debug(RIG_DEBUG_TRACE, "ft1000mp: ft1000mp_set_ptt called %d\n", ptt); ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: called %d\n", __func__, ptt);
cmd_index = ptt ? FT1000MP_NATIVE_PTT_ON : FT1000MP_NATIVE_PTT_OFF; cmd_index = ptt ? FT1000MP_NATIVE_PTT_ON : FT1000MP_NATIVE_PTT_OFF;
ft1000mp_send_priv_cmd(rig, cmd_index); ft1000mp_send_priv_cmd(rig, cmd_index);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -1524,8 +1537,7 @@ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci,
int n; /* for read_ */ int n; /* for read_ */
int retry = rig->state.rigport.retry; int retry = rig->state.rigport.retry;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv; p = (struct ft1000mp_priv_data *)rig->state.priv;
rig_s = &rig->state; rig_s = &rig->state;
@ -1547,7 +1559,7 @@ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci,
} }
// while (retry-- && n == -RIG_ETIMEOUT); // while (retry-- && n == -RIG_ETIMEOUT);
return n; RETURNFUNC(n);
} }
@ -1566,9 +1578,7 @@ static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci)
unsigned char *cmd; /* points to sequence to send */ unsigned char *cmd; /* points to sequence to send */
unsigned char cmd_index; /* index of sequence to send */ unsigned char cmd_index; /* index of sequence to send */
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv; p = (struct ft1000mp_priv_data *)rig->state.priv;
rig_s = &rig->state; rig_s = &rig->state;
@ -1579,14 +1589,14 @@ static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: attempt to send incomplete sequence\n", rig_debug(RIG_DEBUG_TRACE, "%s: attempt to send incomplete sequence\n",
__func__); __func__);
return -RIG_EINVAL; RETURNFUNC(-RIG_EINVAL);
} }
cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */
rig_flush(&rig_s->rigport); rig_flush(&rig_s->rigport);
write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return RIG_OK; RETURNFUNC(RIG_OK);
} }
@ -1597,6 +1607,7 @@ int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
unsigned char cmd_index = 0; /* index of sequence to send */ unsigned char cmd_index = 0; /* index of sequence to send */
freq_t tx_freq; freq_t tx_freq;
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s called rx_vfo=%s, tx_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s called rx_vfo=%s, tx_vfo=%s\n", __func__,
rig_strvfo(vfo), rig_strvfo(tx_vfo)); rig_strvfo(vfo), rig_strvfo(tx_vfo));
@ -1612,7 +1623,7 @@ int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
default: default:
rig_debug(RIG_DEBUG_VERBOSE, "%s: Unknown split value = %d\n", __func__, split); rig_debug(RIG_DEBUG_VERBOSE, "%s: Unknown split value = %d\n", __func__, split);
return -RIG_EINVAL; /* sorry, wrong VFO */ RETURNFUNC(-RIG_EINVAL); /* sorry, wrong VFO */
} }
rig_get_freq(rig, RIG_VFO_B, &tx_freq); rig_get_freq(rig, RIG_VFO_B, &tx_freq);
@ -1624,7 +1635,7 @@ int ft1000mp_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
ft1000mp_send_priv_cmd(rig, cmd_index); ft1000mp_send_priv_cmd(rig, cmd_index);
rig_set_freq(rig, RIG_VFO_B, tx_freq); // restore orig frequency rig_set_freq(rig, RIG_VFO_B, tx_freq); // restore orig frequency
return RIG_OK; RETURNFUNC(RIG_OK);
} }
/* /*
@ -1637,8 +1648,7 @@ int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
struct ft1000mp_priv_data *p; struct ft1000mp_priv_data *p;
int retval; int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv; p = (struct ft1000mp_priv_data *)rig->state.priv;
@ -1648,7 +1658,7 @@ int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
if (retval < 0) if (retval < 0)
{ {
return retval; RETURNFUNC(retval);
} }
if (p->update_data[0] & 0x01) if (p->update_data[0] & 0x01)
@ -1662,17 +1672,19 @@ int ft1000mp_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
*split = RIG_SPLIT_OFF; *split = RIG_SPLIT_OFF;
} }
return RIG_OK; RETURNFUNC(RIG_OK);
} }
int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
{ {
ENTERFUNC;
int retval = rig_set_split_vfo(rig, vfo, RIG_SPLIT_ON, RIG_VFO_B); int retval = rig_set_split_vfo(rig, vfo, RIG_SPLIT_ON, RIG_VFO_B);
if (retval != RIG_OK) RETURNFUNC(retval); if (retval != RIG_OK) RETURNFUNC(retval);
return ft1000mp_set_freq(rig, RIG_VFO_B, tx_freq); RETURNFUNC(ft1000mp_set_freq(rig, RIG_VFO_B, tx_freq));
} }
int ft1000mp_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) int ft1000mp_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{ {
return ft1000mp_get_freq(rig, RIG_VFO_B, tx_freq); ENTERFUNC;
RETURNFUNC(ft1000mp_get_freq(rig, RIG_VFO_B, tx_freq));
} }