diff --git a/yaesu/ft857.c b/yaesu/ft857.c index a74cdde07..67bb7b7b5 100644 --- a/yaesu/ft857.c +++ b/yaesu/ft857.c @@ -571,18 +571,19 @@ int ft857_set_vfo(RIG *rig, vfo_t vfo) int ft857_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; - int n; if (vfo != RIG_VFO_CURR) { return -RIG_ENTARGET; } - if (check_cache_timeout(&p->fm_status_tv)) + if (check_cache_timeout(&p->fm_status_tv)) { + int n; if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) { return n; } + } *freq = from_bcd_be(p->fm_status, 8) * 10; @@ -661,18 +662,19 @@ static void get_mode(RIG *rig, struct ft857_priv_data *priv, rmode_t *mode, int ft857_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; - int n; if (vfo != RIG_VFO_CURR) { return -RIG_ENTARGET; } - if (check_cache_timeout(&p->fm_status_tv)) + if (check_cache_timeout(&p->fm_status_tv)) { + int n; if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) { return n; } + } get_mode(rig, p, mode, width); @@ -747,18 +749,19 @@ int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; - int n; - if (vfo != RIG_VFO_CURR) { return -RIG_ENTARGET; } - if (check_cache_timeout(&p->tx_status_tv)) + if (check_cache_timeout(&p->tx_status_tv)) { + int n; + if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_TX_STATUS)) < 0) { return n; } + } *ptt = ((p->tx_status & 0x80) == 0); @@ -768,13 +771,14 @@ int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) static int ft857_get_pometer_level(RIG *rig, value_t *val) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; - int n; - if (check_cache_timeout(&p->tx_status_tv)) + if (check_cache_timeout(&p->tx_status_tv)) { + int n; if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_TX_STATUS)) < 0) { return n; } + } /* Valid only if PTT is on */ if ((p->tx_status & 0x80) == 0) @@ -836,18 +840,19 @@ int ft857_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) int ft857_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; - int n; if (vfo != RIG_VFO_CURR) { return -RIG_ENTARGET; } - if (check_cache_timeout(&p->rx_status_tv)) + if (check_cache_timeout(&p->rx_status_tv)) { + int n; if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_RX_STATUS)) < 0) { return n; } + } /* TODO: consider bit 6 too ??? (CTCSS/DCS code match) */ if (p->rx_status & 0x80)