MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / rig_set_split_freq

Function rig_set_split_freq

src/rig.c:4749–4922  ·  view source on GitHub ↗

* \brief set the split frequencies * \param rig The rig handle * \param vfo The target VFO * \param tx_freq The transmit split frequency to set to * * Sets the split(TX) frequency. * * \return RIG_OK if the operation has been successful, otherwise * a negative value if an error occurred (in which case, cause is * set appropriately). * * \sa rig_get_split_freq(), rig_set_split_vfo

Source from the content-addressed store, hash-verified

4747 * \sa rig_get_split_freq(), rig_set_split_vfo()
4748 */
4749int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
4750{
4751 const struct rig_caps *caps;
4752 const struct rig_state *rs;
4753 struct rig_cache *cachep;
4754 int retcode, rc2;
4755 vfo_t curr_vfo, tx_vfo;
4756 freq_t tfreq = 0;
4757
4758 if (CHECK_RIG_ARG(rig))
4759 {
4760 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
4761 return -RIG_EINVAL;
4762 }
4763
4764 ENTERFUNC2;
4765 ELAPSED1;
4766
4767 rs = STATE(rig);
4768 caps = rig->caps;
4769 cachep = CACHE(rig);
4770
4771 rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s, tx_freq=%.0f\n",
4772 __func__,
4773 rig_strvfo(vfo), rig_strvfo(rs->current_vfo), tx_freq);
4774
4775 // Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
4776 tx_vfo = rs->tx_vfo;
4777
4778 if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
4779 || tx_vfo == RIG_VFO_CURR)
4780 {
4781 // Turn split on if not enabled already
4782 retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig,
4783 RIG_VFO_OTHER, RIG_SPLIT_OFF));
4784
4785 if (retcode != RIG_OK)
4786 {
4787 rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__,
4788 retcode);
4789 ELAPSED2;
4790 RETURNFUNC2(retcode);
4791 }
4792 }
4793
4794 // TX VFO may change after enabling split
4795 tx_vfo = rs->tx_vfo;
4796
4797 rig_get_freq(rig, tx_vfo, &tfreq);
4798
4799 if (tfreq == tx_freq)
4800 {
4801 rig_debug(RIG_DEBUG_TRACE, "%s: freq set not needed\n", __func__);
4802 ELAPSED2;
4803 RETURNFUNC2(RIG_OK);
4804 }
4805
4806 // Use set_split_freq directly if implemented and frequency is targetable

Callers 5

ft736_set_freqFunction · 0.85
setSplitFreqMethod · 0.85
rig_set_split_freq_modeFunction · 0.85
generic_restore_channelFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 8

rig_debugFunction · 0.85
rig_strvfoFunction · 0.85
rig_set_split_vfoFunction · 0.85
vfo_fixupFunction · 0.85
rig_get_freqFunction · 0.85
rig_set_cache_freqFunction · 0.85
rig_set_freqFunction · 0.85
rig_has_vfo_opFunction · 0.85

Tested by

no test coverage detected