* \brief set the split modes * \param rig The rig handle * \param vfo The target VFO * \param tx_mode The transmit split mode to set to * \param tx_width The transmit split width to set to or the special * value RIG_PASSBAND_NOCHANGE which leaves the passband unchanged * from the current value or default for the mode determined by the * rig. * * Sets the split(TX) mode. * * \retu
| 5114 | * \sa rig_get_split_mode() |
| 5115 | */ |
| 5116 | int HAMLIB_API rig_set_split_mode(RIG *rig, |
| 5117 | vfo_t vfo, |
| 5118 | rmode_t tx_mode, |
| 5119 | pbwidth_t tx_width) |
| 5120 | { |
| 5121 | const struct rig_caps *caps; |
| 5122 | const struct rig_state *rs; |
| 5123 | struct rig_cache *cachep; |
| 5124 | int retcode, rc2; |
| 5125 | vfo_t curr_vfo, tx_vfo, rx_vfo; |
| 5126 | freq_t cache_freq; |
| 5127 | rmode_t cache_mode; |
| 5128 | pbwidth_t cache_width; |
| 5129 | int cache_ms_freq, cache_ms_mode, cache_ms_width; |
| 5130 | |
| 5131 | if (CHECK_RIG_ARG(rig)) |
| 5132 | { |
| 5133 | rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__); |
| 5134 | return -RIG_EINVAL; |
| 5135 | } |
| 5136 | |
| 5137 | ELAPSED1; |
| 5138 | ENTERFUNC; |
| 5139 | |
| 5140 | caps = rig->caps; |
| 5141 | rs = STATE(rig); |
| 5142 | cachep = CACHE(rig); |
| 5143 | |
| 5144 | // Always use the previously selected TX VFO for split. The targeted VFO will have no effect. |
| 5145 | tx_vfo = rs->tx_vfo; |
| 5146 | |
| 5147 | if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE |
| 5148 | || tx_vfo == RIG_VFO_CURR) |
| 5149 | { |
| 5150 | // Turn split on if not enabled already |
| 5151 | retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig, |
| 5152 | RIG_VFO_OTHER, RIG_SPLIT_OFF)); |
| 5153 | |
| 5154 | if (retcode != RIG_OK) |
| 5155 | { |
| 5156 | rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__, |
| 5157 | retcode); |
| 5158 | ELAPSED2; |
| 5159 | RETURNFUNC(retcode); |
| 5160 | } |
| 5161 | } |
| 5162 | |
| 5163 | // TX VFO may change after enabling split |
| 5164 | tx_vfo = rs->tx_vfo; |
| 5165 | |
| 5166 | // do not mess with mode while PTT is on |
| 5167 | if (cachep->ptt) |
| 5168 | { |
| 5169 | rig_debug(RIG_DEBUG_VERBOSE, "%s PTT on so set_split_mode ignored\n", __func__); |
| 5170 | ELAPSED2; |
| 5171 | RETURNFUNC(RIG_OK); |
| 5172 | } |
| 5173 |
no test coverage detected