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

Function rig_set_rit

src/rig.c:6098–6153  ·  view source on GitHub ↗

* \brief set the RIT * \param rig The rig handle * \param vfo The target VFO * \param rit The RIT offset to adjust to * * Sets the current RIT offset. A value of 0 for \a rit disables RIT. * * \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_rit() */

Source from the content-addressed store, hash-verified

6096 * \sa rig_get_rit()
6097 */
6098int HAMLIB_API rig_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
6099{
6100 const struct rig_caps *caps;
6101 int retcode, rc2;
6102 vfo_t curr_vfo;
6103
6104 if (CHECK_RIG_ARG(rig))
6105 {
6106 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
6107 return -RIG_EINVAL;
6108 }
6109
6110 ENTERFUNC;
6111
6112 caps = rig->caps;
6113
6114 if (caps->set_rit == NULL)
6115 {
6116 RETURNFUNC(-RIG_ENAVAIL);
6117 }
6118
6119 if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT)
6120 || vfo == RIG_VFO_CURR
6121 || vfo == STATE(rig)->current_vfo)
6122 {
6123 HAMLIB_TRACE;
6124 retcode = caps->set_rit(rig, vfo, rit);
6125 RETURNFUNC(retcode);
6126 }
6127
6128 if (!caps->set_vfo)
6129 {
6130 RETURNFUNC(-RIG_ENAVAIL);
6131 }
6132
6133 curr_vfo = STATE(rig)->current_vfo;
6134 HAMLIB_TRACE;
6135 retcode = caps->set_vfo(rig, vfo);
6136
6137 if (retcode != RIG_OK)
6138 {
6139 RETURNFUNC(retcode);
6140 }
6141
6142 retcode = caps->set_rit(rig, vfo, rit);
6143 /* try and revert even if we had an error above */
6144 rc2 = caps->set_vfo(rig, curr_vfo);
6145
6146 if (RIG_OK == retcode)
6147 {
6148 /* Return the first error code */
6149 retcode = rc2;
6150 }
6151
6152 RETURNFUNC(retcode);
6153}
6154
6155

Callers 3

setRitMethod · 0.85
generic_restore_channelFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected