* \brief set the split frequency and mode * \param rig The rig handle * \param vfo The target VFO * \param tx_freq The transmit frequency to set to * \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 deter
| 5516 | * \sa rig_set_split_freq(), rig_set_split_mode(), rig_get_split_freq_mode() |
| 5517 | */ |
| 5518 | int HAMLIB_API rig_set_split_freq_mode(RIG *rig, |
| 5519 | vfo_t vfo, |
| 5520 | freq_t tx_freq, |
| 5521 | rmode_t tx_mode, |
| 5522 | pbwidth_t tx_width) |
| 5523 | { |
| 5524 | const struct rig_caps *caps; |
| 5525 | const struct rig_state *rs; |
| 5526 | vfo_t tx_vfo; |
| 5527 | struct rig_cache *cachep; |
| 5528 | int retcode; |
| 5529 | |
| 5530 | if (CHECK_RIG_ARG(rig)) |
| 5531 | { |
| 5532 | rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__); |
| 5533 | return -RIG_EINVAL; |
| 5534 | } |
| 5535 | |
| 5536 | ELAPSED1; |
| 5537 | ENTERFUNC; |
| 5538 | |
| 5539 | caps = rig->caps; |
| 5540 | rs = STATE(rig); |
| 5541 | cachep = CACHE(rig); |
| 5542 | |
| 5543 | // Always use the previously selected TX VFO for split. The targeted VFO will have no effect. |
| 5544 | tx_vfo = rs->tx_vfo; |
| 5545 | |
| 5546 | if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE |
| 5547 | || tx_vfo == RIG_VFO_CURR) |
| 5548 | { |
| 5549 | // Turn split on if not enabled already |
| 5550 | retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig, |
| 5551 | RIG_VFO_OTHER, RIG_SPLIT_OFF)); |
| 5552 | |
| 5553 | if (retcode != RIG_OK) |
| 5554 | { |
| 5555 | rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__, |
| 5556 | retcode); |
| 5557 | ELAPSED2; |
| 5558 | RETURNFUNC(retcode); |
| 5559 | } |
| 5560 | } |
| 5561 | |
| 5562 | // TX VFO may change after enabling split |
| 5563 | tx_vfo = rs->tx_vfo; |
| 5564 | |
| 5565 | vfo = vfo_fixup(rig, RIG_VFO_TX, cachep->split); // get the TX VFO |
| 5566 | rig_debug(RIG_DEBUG_VERBOSE, |
| 5567 | "%s: vfo=%s, tx_freq=%.0f, tx_mode=%s, tx_width=%d\n", __func__, |
| 5568 | rig_strvfo(vfo), tx_freq, rig_strrmode(tx_mode), (int)tx_width); |
| 5569 | |
| 5570 | if (caps->set_split_freq_mode) |
| 5571 | { |
| 5572 | #if 0 |
| 5573 | freq_t tfreq; |
| 5574 | int retry = 3; |
| 5575 | int retcode2; |
no test coverage detected