From a7b28a63d4ae7d094680f89d872ce0146b7d40f8 Mon Sep 17 00:00:00 2001 From: Michael Black Date: Sun, 19 Apr 2020 23:18:59 -0500 Subject: [PATCH] ft991 changes to work with gpredict --- rigs/yaesu/ft991.c | 157 ++++++++++++++++++++- rigs/yaesu/ft991.h | 71 +++++++--- rigs/yaesu/newcat.c | 332 +++++++++++++++----------------------------- rigs/yaesu/newcat.h | 111 ++++++++------- 4 files changed, 380 insertions(+), 291 deletions(-) diff --git a/rigs/yaesu/ft991.c b/rigs/yaesu/ft991.c index ca79b2981..f27f76c9d 100644 --- a/rigs/yaesu/ft991.c +++ b/rigs/yaesu/ft991.c @@ -188,6 +188,8 @@ const struct rig_caps ft991_caps = .get_ptt = newcat_get_ptt, .set_split_vfo = newcat_set_split_vfo, .get_split_vfo = newcat_get_split_vfo, + .set_split_freq = ft991_set_split_freq, + .get_split_freq = ft991_get_split_freq, .get_split_mode = ft991_get_split_mode, .set_split_mode = ft991_set_split_mode, .set_rit = newcat_set_rit, @@ -223,6 +225,104 @@ const struct rig_caps ft991_caps = }; + +static int +ft991_get_tx_split(RIG *rig, split_t *in_split) +{ + vfo_t cur_tx_vfo; + int rval; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (!rig || !in_split) + { + return (-RIG_EINVAL); + } + + rval = newcat_get_tx_vfo(rig, &cur_tx_vfo); + + if (rval != RIG_OK) + { + return (rval); + } + + if (cur_tx_vfo == RIG_VFO_B || cur_tx_vfo == RIG_VFO_MEM) + { + *in_split = RIG_SPLIT_ON; + } + else if (cur_tx_vfo == RIG_VFO_A) + { + *in_split = RIG_SPLIT_OFF; + } + else + { + return (-RIG_EINVAL); + } + + return (rval); +} + +int +ft991_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) +{ + int rval; + split_t is_split; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + rval = ft991_get_tx_split(rig, &is_split); + + if (rval != RIG_OK) + { + return (rval); + } + + if (is_split == RIG_SPLIT_OFF) + { + rval = newcat_set_tx_vfo(rig, RIG_VFO_B); + + if (rval != RIG_OK) + { + return (rval); + } + } + + rval = newcat_set_freq(rig, RIG_VFO_B, tx_freq); + rig_debug(RIG_DEBUG_VERBOSE, + "%s newcat_set_freq() rval = %d freq = %f\n", + __func__, rval, tx_freq); + return (rval); +} + +int +ft991_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) +{ + int rval; + split_t is_split; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + rval = ft991_get_tx_split(rig, &is_split); + + if (rval != RIG_OK) + { + return (rval); + } + + if (is_split == RIG_SPLIT_OFF) + { + *tx_freq = 0.0; + return (rval); + } + + rval = newcat_get_freq(rig, RIG_VFO_B, tx_freq); + rig_debug(RIG_DEBUG_VERBOSE, + "%s newcat_get_freq() rval = %d freq = %f\n", + __func__, rval, *tx_freq); + + return (rval); +} + /* * rig_get_split_mode* * @@ -250,6 +350,7 @@ int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, { struct newcat_priv_data *priv; int err; + ft991info *rdata; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -259,6 +360,7 @@ int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, } priv = (struct newcat_priv_data *)rig->state.priv; + rdata = (ft991info *)priv->ret_data; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "OI;"); @@ -267,12 +369,46 @@ int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, return err; } - *tx_mode = priv->ret_data[22]; + debug_ft991info_data(rdata); + + *tx_mode = newcat_rmode(rdata->mode); + rig_debug(RIG_DEBUG_VERBOSE, "%s opposite mode %s\n", __func__, + rig_strrmode(*tx_mode)); *tx_width = RIG_PASSBAND_NORMAL; return RIG_OK; } +static void debug_ft991info_data(const ft991info *rdata) +{ + + rig_debug(RIG_DEBUG_VERBOSE, "%s command %2.2s\n", + __func__, rdata->command); + rig_debug(RIG_DEBUG_VERBOSE, "%s memory_ch %3.3s\n", + __func__, rdata->memory_ch); + rig_debug(RIG_DEBUG_VERBOSE, "%s vfo_freq %9.9s\n", + __func__, rdata->vfo_freq); + rig_debug(RIG_DEBUG_VERBOSE, "%s clarifier %5.5s\n", + __func__, rdata->clarifier); + rig_debug(RIG_DEBUG_VERBOSE, "%s rx_clarifier %c\n", + __func__, rdata->rx_clarifier); + rig_debug(RIG_DEBUG_VERBOSE, "%s tx_clarifier %c\n", + __func__, rdata->tx_clarifier); + rig_debug(RIG_DEBUG_VERBOSE, "%s mode %c\n", + __func__, rdata->mode); + rig_debug(RIG_DEBUG_VERBOSE, "%s vfo_memory %c\n", + __func__, rdata->vfo_memory); + rig_debug(RIG_DEBUG_VERBOSE, "%s tone_mode %c\n", + __func__, rdata->tone_mode); + rig_debug(RIG_DEBUG_VERBOSE, "%s fixed %2.2s\n", + __func__, rdata->fixed); + rig_debug(RIG_DEBUG_VERBOSE, "%s repeater_offset %c\n", + __func__, rdata->repeater_offset); + rig_debug(RIG_DEBUG_VERBOSE, "%s terminator %c\n", + __func__, rdata->terminator); + +} + /* * rig_set_split_mode * @@ -302,6 +438,7 @@ int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, struct rig_state *state; int err; char restore_commands[NEWCAT_DATA_LEN]; + split_t is_split; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -310,6 +447,24 @@ int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, return -RIG_EINVAL; } + err = ft991_get_tx_split(rig, &is_split); + + if (err != RIG_OK) + { + return (err); + } + + if (is_split == RIG_SPLIT_OFF) + { + err = newcat_set_tx_vfo(rig, RIG_VFO_B); + + if (err != RIG_OK) + { + return (err); + } + } + + state = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s\n", __func__, rig_strvfo(vfo)); diff --git a/rigs/yaesu/ft991.h b/rigs/yaesu/ft991.h index 1109abf98..6b9c49065 100644 --- a/rigs/yaesu/ft991.h +++ b/rigs/yaesu/ft991.h @@ -38,10 +38,10 @@ /* Receiver caps */ #define FT991_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ - RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|\ + RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|\ RIG_MODE_C4FM) #define FT991_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ - RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) + RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define FT991_AM_RX_MODES (RIG_MODE_AM) #define FT991_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM|RIG_MODE_C4FM) #define FT991_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR) @@ -73,24 +73,24 @@ /* TBC */ #define FT991_STR_CAL { 16, \ - { \ - { 0, -54 }, /* S0 */ \ - { 12, -48 }, /* S1 */ \ - { 27, -42 }, /* S2 */ \ - { 40, -36 }, /* S3 */ \ - { 55, -30 }, /* S4 */ \ - { 65, -24 }, /* S5 */ \ - { 80, -18 }, /* S6 */ \ - { 95, -12 }, /* S7 */ \ - { 112, -6 }, /* S8 */ \ - { 130, 0 }, /* S9 */ \ - { 150, 10 }, /* +10 */ \ - { 172, 20 }, /* +20 */ \ - { 190, 30 }, /* +30 */ \ - { 220, 40 }, /* +40 */ \ - { 240, 50 }, /* +50 */ \ - { 255, 60 }, /* +60 */ \ - } } + { \ + { 0, -54 }, /* S0 */ \ + { 12, -48 }, /* S1 */ \ + { 27, -42 }, /* S2 */ \ + { 40, -36 }, /* S3 */ \ + { 55, -30 }, /* S4 */ \ + { 65, -24 }, /* S5 */ \ + { 80, -18 }, /* S6 */ \ + { 95, -12 }, /* S7 */ \ + { 112, -6 }, /* S8 */ \ + { 130, 0 }, /* S9 */ \ + { 150, 10 }, /* +10 */ \ + { 172, 20 }, /* +20 */ \ + { 190, 30 }, /* +30 */ \ + { 220, 40 }, /* +40 */ \ + { 240, 50 }, /* +50 */ \ + { 255, 60 }, /* +60 */ \ + } } /* @@ -123,9 +123,34 @@ #define FT991_POST_WRITE_DELAY 50 +typedef struct +{ + char command[2]; /* depends on command "IF", "MR", "MW" "OI" */ + char memory_ch[3]; /* 001 -> 117 */ + char vfo_freq[9]; /* 9 digit value in Hz */ + char clarifier[5]; /* '+' | '-', 0000 -> 9999 Hz */ + char rx_clarifier; /* '0' = off, '1' = on */ + char tx_clarifier; /* '0' = off, '1' = on */ + char mode; /* '1'=LSB, '2'=USB, '3'=CW, '4'=FM, '5'=AM, */ + /* '6'=RTTY-LSB, '7'=CW-R, '8'=DATA-LSB, */ + /* '9'=RTTY-USB,'A'=DATA-FM, 'B'=FM-N, */ + /* 'C'=DATA-USB, 'D'=AM-N, 'E'=C4FM */ + char vfo_memory; /* '0'=VFO, '1'=Memory, '2'=Memory Tune, */ + /* '3'=Quick Memory Bank, '4'=QMB-MT, '5'=PMS, '6'=HOME */ + char tone_mode; /* '0' = off, CTCSS '1' ENC, '2' ENC/DEC, */ + /* '3' = DCS ENC/DEC, '4' = ENC */ + char fixed[2]; /* Always '0', '0' */ + char repeater_offset; /* '0' = Simplex, '1' Plus, '2' minus */ + char terminator; /* ';' */ +} ft991info; + /* Prototypes */ static int ft991_init(RIG *rig); -static int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); -static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); - +static int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, + pbwidth_t *tx_width); +static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, + pbwidth_t tx_width); +static int ft991_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); +static int ft991_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq); +static void debug_ft991info_data(const ft991info *rdata); #endif /* _FT991_H */ diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 753391180..389db8921 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -250,8 +250,6 @@ const struct confparams newcat_cfg_params[] = /* NewCAT Internal Functions */ static ncboolean newcat_is_rig(RIG *rig, rig_model_t model); -static int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo); -static int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo); static int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo); static int newcat_scale_float(int scale, float fval); @@ -515,6 +513,11 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) return -RIG_ENAVAIL; } + if (!newcat_valid_command(rig, "FB")) + { + return -RIG_ENAVAIL; + } + priv = (struct newcat_priv_data *)rig->state.priv; caps = rig->caps; @@ -655,6 +658,11 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) return -RIG_ENAVAIL; } + if (!newcat_valid_command(rig, "FB")) + { + return -RIG_ENAVAIL; + } + err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) @@ -744,65 +752,10 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) rig_debug(RIG_DEBUG_VERBOSE, "%s: generic mode = %s \n", __func__, rig_strrmode(mode)); - switch (mode) + + priv->cmd_str[3] = newcat_modechar(mode); + if (priv->cmd_str[3] == '0') { - case RIG_MODE_LSB: - priv->cmd_str[3] = '1'; - break; - - case RIG_MODE_USB: - priv->cmd_str[3] = '2'; - break; - - case RIG_MODE_CW: - priv->cmd_str[3] = '3'; - break; - - case RIG_MODE_FM: - priv->cmd_str[3] = '4'; - break; - - case RIG_MODE_AM: - priv->cmd_str[3] = '5'; - break; - - case RIG_MODE_RTTY: - priv->cmd_str[3] = '6'; - break; - - case RIG_MODE_CWR: - priv->cmd_str[3] = '7'; - break; - - case RIG_MODE_PKTLSB: /* FT450 USER-L */ - priv->cmd_str[3] = '8'; - break; - - case RIG_MODE_RTTYR: - priv->cmd_str[3] = '9'; - break; - - case RIG_MODE_PKTFM: - priv->cmd_str[3] = 'A'; - break; - - case RIG_MODE_FMN: - priv->cmd_str[3] = 'B'; - break; - - case RIG_MODE_PKTUSB: /* FT450 USER-U */ - priv->cmd_str[3] = 'C'; - break; - - case RIG_MODE_AMN: - priv->cmd_str[3] = 'D'; - break; - - case RIG_MODE_C4FM: - priv->cmd_str[3] = 'E'; - break; - - default: return -RIG_EINVAL; } @@ -832,7 +785,6 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; char c; int err; - ncboolean narrow; char main_sub_vfo = '0'; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -877,101 +829,10 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) /* default, unless set otherwise */ *width = RIG_PASSBAND_NORMAL; - switch (c) + *mode = newcat_rmode_width(rig, vfo, c, width); + + if (*mode == '0') { - case '1': - *mode = RIG_MODE_LSB; - break; - - case '2': - *mode = RIG_MODE_USB; - break; - - case '3': - *mode = RIG_MODE_CW; - break; - - case '4': - *mode = RIG_MODE_FM; - err = newcat_get_narrow(rig, vfo, &narrow); - - if (narrow == TRUE) - { - *width = rig_passband_narrow(rig, *mode); - } - else - { - *width = rig_passband_normal(rig, *mode); - } - - return err; - - case '5': - *mode = RIG_MODE_AM; - err = newcat_get_narrow(rig, vfo, &narrow); - - if (narrow == TRUE) - { - *width = rig_passband_narrow(rig, *mode); - } - else - { - *width = rig_passband_normal(rig, *mode); - } - - return err; - - case '6': - *mode = RIG_MODE_RTTY; - break; - - case '7': - *mode = RIG_MODE_CWR; - break; - - case '8': - *mode = RIG_MODE_PKTLSB; /* FT450 USER-L */ - break; - - case '9': - *mode = RIG_MODE_RTTYR; - break; - - case 'A': - *mode = RIG_MODE_PKTFM; - err = newcat_get_narrow(rig, vfo, &narrow); - - if (narrow == TRUE) - { - *width = rig_passband_narrow(rig, *mode); - } - else - { - *width = rig_passband_normal(rig, *mode); - } - - return err; - - case 'B': - *mode = RIG_MODE_FMN; /* narrow */ - *width = rig_passband_narrow(rig, *mode); - return RIG_OK; - - case 'C': - *mode = RIG_MODE_PKTUSB; /* FT450 USER-U */ - break; - - case 'D': - *mode = RIG_MODE_AM; /* narrow, FT950 */ - *width = rig_passband_narrow(rig, *mode); - return RIG_OK; - - case 'E': - *mode = RIG_MODE_C4FM; /* narrow, FT950 */ - *width = rig_passband_narrow(rig, *mode); - return RIG_OK; - - default: return -RIG_EPROTO; } @@ -4356,38 +4217,7 @@ int newcat_set_channel(RIG *rig, const channel_t *chan) } /* MODE */ - switch (chan->mode) - { - case RIG_MODE_LSB: c_mode = '1'; break; - - case RIG_MODE_USB: c_mode = '2'; break; - - case RIG_MODE_CW: c_mode = '3'; break; - - case RIG_MODE_FM: c_mode = '4'; break; - - case RIG_MODE_AM: c_mode = '5'; break; - - case RIG_MODE_RTTY: c_mode = '6'; break; - - case RIG_MODE_CWR: c_mode = '7'; break; - - case RIG_MODE_PKTLSB: c_mode = '8'; break; - - case RIG_MODE_RTTYR: c_mode = '9'; break; - - case RIG_MODE_PKTFM: c_mode = 'A'; break; - - case RIG_MODE_FMN: c_mode = 'B'; break; - - case RIG_MODE_PKTUSB: c_mode = 'C'; break; - - case RIG_MODE_AMN: c_mode = 'D'; break; - - case RIG_MODE_C4FM: c_mode = 'E'; break; - - default: c_mode = '1'; break; - } + c_mode = newcat_modechar(chan->mode); /* VFO Fixed */ c_vfo = '0'; @@ -4571,38 +4401,10 @@ int newcat_get_channel(RIG *rig, channel_t *chan) chan->width = 0; retval = priv->ret_data + 20; + chan->mode = newcat_rmode(*retval); - switch (*retval) + if (chan->mode == RIG_MODE_NONE) { - case '1': chan->mode = RIG_MODE_LSB; break; - - case '2': chan->mode = RIG_MODE_USB; break; - - case '3': chan->mode = RIG_MODE_CW; break; - - case '4': chan->mode = RIG_MODE_FM; break; - - case '5': chan->mode = RIG_MODE_AM; break; - - case '6': chan->mode = RIG_MODE_RTTY; break; - - case '7': chan->mode = RIG_MODE_CWR; break; - - case '8': chan->mode = RIG_MODE_PKTLSB; break; - - case '9': chan->mode = RIG_MODE_RTTYR; break; - - case 'A': chan->mode = RIG_MODE_PKTFM; break; - - case 'B': chan->mode = RIG_MODE_FM; break; - - case 'C': chan->mode = RIG_MODE_PKTUSB; break; - - case 'D': chan->mode = RIG_MODE_AM; break; - - case 'E': chan->mode = RIG_MODE_C4FM; break; - - default: rig_debug(RIG_DEBUG_ERR, "%s: unknown mode=%c\n", __func__, *retval); chan->mode = RIG_MODE_LSB; } @@ -6057,7 +5859,7 @@ int newcat_get_vfo_mode(RIG *rig, vfo_t *vfo_mode) return -RIG_EPROTO; } - rig_debug(RIG_DEBUG_TRACE, "%s: offset=%d, width_frequeny=%d\n", __func__, + rig_debug(RIG_DEBUG_TRACE, "%s: offset=%d, width_frequency=%d\n", __func__, offset, priv->width_frequency); switch (priv->ret_data[offset]) @@ -6073,7 +5875,7 @@ int newcat_get_vfo_mode(RIG *rig, vfo_t *vfo_mode) } rig_debug(RIG_DEBUG_TRACE, "%s: vfo mode = %s\n", __func__, - rig_strrmode(*vfo_mode)); + rig_strvfo(*vfo_mode)); return err; } @@ -6349,3 +6151,95 @@ int newcat_set_cmd(RIG *rig) return rc; } + +struct { + rmode_t mode; + char modechar; + ncboolean chk_width; +} static const newcat_mode_conv[] = +{ + { RIG_MODE_LSB, '1', FALSE }, + { RIG_MODE_USB, '2', FALSE }, + { RIG_MODE_CW, '3', FALSE }, + { RIG_MODE_FM, '4', TRUE }, + { RIG_MODE_AM, '5', TRUE }, + { RIG_MODE_RTTY, '6', FALSE }, + { RIG_MODE_CWR, '7', FALSE }, + { RIG_MODE_PKTLSB, '8', FALSE }, + { RIG_MODE_RTTYR, '9', FALSE }, + { RIG_MODE_PKTFM, 'A', TRUE }, + { RIG_MODE_FMN, 'B', TRUE }, + { RIG_MODE_PKTUSB, 'C', FALSE }, + { RIG_MODE_AMN, 'D', TRUE }, + { RIG_MODE_C4FM, 'E', TRUE } +}; + +rmode_t newcat_rmode(char mode) +{ + int i; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + for (i = 0; i < sizeof(newcat_mode_conv) / sizeof(newcat_mode_conv[0]); i++) + { + if (newcat_mode_conv[i].modechar == mode) + { + rig_debug(RIG_DEBUG_TRACE, "%s: %s for %c\n", __func__, + rig_strrmode(newcat_mode_conv[i].mode), mode); + return (newcat_mode_conv[i].mode); + } + } + + return (RIG_MODE_NONE); +} + +char newcat_modechar(rmode_t rmode) +{ + int i; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + for (i = 0; i < sizeof(newcat_mode_conv) / sizeof(newcat_mode_conv[0]); i++) + { + if (newcat_mode_conv[i].mode == rmode) + { + rig_debug(RIG_DEBUG_TRACE, "%s: return %c for %s\n", __func__, + newcat_mode_conv[i].modechar, rig_strrmode(rmode)); + return (newcat_mode_conv[i].modechar); + } + } + + return ('0'); +} + +rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width) +{ + ncboolean narrow; + int i; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if(width != NULL) + *width = RIG_PASSBAND_NORMAL; + + for (i = 0; i < sizeof(newcat_mode_conv) / sizeof(newcat_mode_conv[0]); i++) + { + if (newcat_mode_conv[i].modechar == mode) + { + if (newcat_mode_conv[i].chk_width == TRUE && width != NULL) + { + if(newcat_get_narrow(rig, vfo, &narrow) != RIG_OK) + return (newcat_mode_conv[i].mode); + if (narrow == TRUE) + *width = rig_passband_narrow(rig, mode); + else + *width = rig_passband_normal(rig, mode); + } + return (newcat_mode_conv[i].mode); + } + } + rig_debug(RIG_DEBUG_VERBOSE, "%s fell out the bottom %c %s\n", __func__, + mode, rig_strrmode(mode)); + + return ('0'); +} diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 7cb305eec..da96b240d 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -60,13 +60,13 @@ typedef char ncboolean; #define NEWCAT_MEM_CAP { \ - .freq = 1, \ - .mode = 1, \ - .rit = 1, \ - .xit = 1, \ - .rptr_shift = 1, \ - .ctcss_tone = 1,\ - .ctcss_sql = 1,\ + .freq = 1, \ + .mode = 1, \ + .rit = 1, \ + .xit = 1, \ + .rptr_shift = 1, \ + .ctcss_tone = 1,\ + .ctcss_sql = 1,\ } extern const struct confparams newcat_cfg_params[]; @@ -78,15 +78,20 @@ extern const struct confparams newcat_cfg_params[]; * rig_caps.priv? I'm guessing not since it's private to the backend. -N0NB */ -struct newcat_priv_data { - unsigned int read_update_delay; /* depends on pacing value */ +struct newcat_priv_data +{ + unsigned int + read_update_delay; /* depends on pacing value */ // vfo_t current_vfo; /* active VFO from last cmd */ char cmd_str[NEWCAT_DATA_LEN]; /* command string buffer */ - char ret_data[NEWCAT_DATA_LEN]; /* returned data--max value, most are less */ - int current_mem; /* private memory channel number */ - int rig_id; /* rig id from CAT Command ID; */ + char + ret_data[NEWCAT_DATA_LEN]; /* returned data--max value, most are less */ + int + current_mem; /* private memory channel number */ + int + rig_id; /* rig id from CAT Command ID; */ int trn_state; /* AI state found at startup */ - int fast_set_commands; /* do not check for ACK/NAK; needed for high throughput > 100 commands/s */ + int fast_set_commands; /* do not check for ACK/NAK; needed for high throughput > 100 commands/s */ int width_frequency; /* found at startup */ }; @@ -123,8 +128,8 @@ struct newcat_priv_data { * */ -int newcat_get_cmd(RIG * rig); -int newcat_set_cmd (RIG *rig); +int newcat_get_cmd(RIG *rig); +int newcat_set_cmd(RIG *rig); int newcat_init(RIG *rig); int newcat_cleanup(RIG *rig); @@ -140,43 +145,53 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int newcat_set_vfo(RIG *rig, vfo_t vfo); int newcat_get_vfo(RIG *rig, vfo_t *vfo); +int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo); +int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo); + int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); -int newcat_get_ptt(RIG * rig, vfo_t vfo, ptt_t * ptt); -int newcat_set_ant(RIG * rig, vfo_t vfo, ant_t ant, value_t option); -int newcat_get_ant(RIG * rig, vfo_t vfo, ant_t dummy, value_t * option, ant_t * ant_curr, ant_t * ant_tx, ant_t *ant_rx); -int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val); -int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val); -int newcat_set_func(RIG * rig, vfo_t vfo, setting_t func, int status); -int newcat_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status); -int newcat_set_mem(RIG * rig, vfo_t vfo, int ch); -int newcat_get_mem(RIG * rig, vfo_t vfo, int *ch); -int newcat_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op); -const char *newcat_get_info(RIG * rig); +int newcat_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); +int newcat_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option); +int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option, + ant_t *ant_curr, ant_t *ant_tx, ant_t *ant_rx); +int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); +int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); +int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); +int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); +int newcat_set_mem(RIG *rig, vfo_t vfo, int ch); +int newcat_get_mem(RIG *rig, vfo_t vfo, int *ch); +int newcat_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); +const char *newcat_get_info(RIG *rig); + +int newcat_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); +int newcat_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); +int newcat_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit); +int newcat_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit); +int newcat_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, + rmode_t mode); +int newcat_mW2power(RIG *rig, float *power, unsigned int mwpower, freq_t freq, + rmode_t mode); +int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); +int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); +int newcat_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); +int newcat_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift); +int newcat_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone); +int newcat_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone); +int newcat_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); +int newcat_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); +int newcat_set_powerstat(RIG *rig, powerstat_t status); +int newcat_get_powerstat(RIG *rig, powerstat_t *status); +int newcat_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); +int newcat_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); +int newcat_set_trn(RIG *rig, int trn); +int newcat_get_trn(RIG *rig, int *trn); +int newcat_set_channel(RIG *rig, const channel_t *chan); +int newcat_get_channel(RIG *rig, channel_t *chan); +rmode_t newcat_rmode(char mode); +char newcat_modechar(rmode_t rmode); +rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width); -int newcat_get_rit(RIG * rig, vfo_t vfo, shortfreq_t * rit); -int newcat_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); -int newcat_get_xit(RIG * rig, vfo_t vfo, shortfreq_t * xit); -int newcat_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit); -int newcat_power2mW(RIG * rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode); -int newcat_mW2power(RIG * rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode); -int newcat_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo); -int newcat_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo); -int newcat_set_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t rptr_shift); -int newcat_get_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t * rptr_shift); -int newcat_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone); -int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone); -int newcat_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone); -int newcat_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t * tone); -int newcat_set_powerstat(RIG * rig, powerstat_t status); -int newcat_get_powerstat(RIG * rig, powerstat_t * status); -int newcat_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts); -int newcat_get_ts(RIG * rig, vfo_t vfo, shortfreq_t * ts); -int newcat_set_trn(RIG * rig, int trn); -int newcat_get_trn(RIG * rig, int *trn); -int newcat_set_channel(RIG * rig, const channel_t * chan); -int newcat_get_channel(RIG * rig, channel_t * chan); #endif /* _NEWCAT_H */