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

Function rot_get_position

src/rotator.c:823–864  ·  view source on GitHub ↗

* \brief Query the azimuth and elevation of the rotator. * * \param rot The #ROT handle. * \param azimuth The variable to store the current azimuth. * \param elevation The variable to store the current elevation * * Retrieves the current azimuth and elevation values of the rotator. The * stored values are in decimal degrees. * * \b Note: A given rotator may be capable of querying only th

Source from the content-addressed store, hash-verified

821 * \sa rot_set_position()
822 */
823int HAMLIB_API rot_get_position(ROT *rot,
824 azimuth_t *azimuth,
825 elevation_t *elevation)
826{
827 const struct rot_caps *caps;
828 const struct rot_state *rs;
829 azimuth_t az;
830 elevation_t el;
831 int retval;
832
833 rot_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
834
835 if (CHECK_ROT_ARG(rot) || !azimuth || !elevation)
836 {
837 return -RIG_EINVAL;
838 }
839
840 caps = rot->caps;
841 rs = ROTSTATE(rot);
842
843 if (caps->get_position == NULL)
844 {
845 return -RIG_ENAVAIL;
846 }
847
848 retval = caps->get_position(rot, &az, &el);
849
850 if (retval != RIG_OK) { return retval; }
851
852 rot_debug(RIG_DEBUG_VERBOSE, "%s: got az=%.2f, el=%.2f\n", __func__, az, el);
853
854 if (rs->south_zero)
855 {
856 az += az >= 180 ? -180 : 180;
857 rot_debug(RIG_DEBUG_VERBOSE, "%s: south adj to az=%.2f\n", __func__, az);
858 }
859
860 *azimuth = az - rs->az_offset;
861 *elevation = el - rs->el_offset;
862
863 return RIG_OK;
864}
865
866
867/**

Callers 3

getPositionMethod · 0.85
rotctl_parse.cFile · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected