kopia lustrzana https://github.com/Hamlib/Hamlib
Merge pull request #658 from b-o-r-m-a-l-e-y/radant
Add Radant AZV-1 Rotator controller protocol.pull/668/head
commit
681c2ae953
|
@ -48,7 +48,7 @@ dnl Beware of duplication should a backend directory include both rig and
|
|||
dnl rotor definitions, e.g. "dummy". Optional backends will not be listed
|
||||
dnl here but will be added later, e.g. "winradio".
|
||||
RIG_BACKEND_LIST="rigs/adat rigs/alinco rigs/aor rigs/barrett rigs/dorji rigs/drake rigs/dummy rigs/elad rigs/flexradio rigs/icom rigs/icmarine rigs/jrc rigs/kachina rigs/kenwood rigs/kit rigs/lowe rigs/pcr rigs/prm80 rigs/racal rigs/rft rigs/rs rigs/skanti rigs/tapr rigs/tentec rigs/tuner rigs/uniden rigs/winradio rigs/wj rigs/yaesu"
|
||||
ROT_BACKEND_LIST="rotators/amsat rotators/ars rotators/celestron rotators/cnctrk rotators/easycomm rotators/ether6 rotators/fodtrack rotators/gs232a rotators/heathkit rotators/m2 rotators/meade rotators/rotorez rotators/sartek rotators/spid rotators/ts7400 rotators/prosistel rotators/ioptron rotators/satel"
|
||||
ROT_BACKEND_LIST="rotators/amsat rotators/ars rotators/celestron rotators/cnctrk rotators/easycomm rotators/ether6 rotators/fodtrack rotators/gs232a rotators/heathkit rotators/m2 rotators/meade rotators/rotorez rotators/sartek rotators/spid rotators/ts7400 rotators/prosistel rotators/ioptron rotators/satel rotators/radant"
|
||||
# Amplifiers are all in the amplifiers directory
|
||||
AMP_BACKEND_LIST="amplifiers/elecraft"
|
||||
|
||||
|
@ -832,6 +832,7 @@ rotators/spid/Makefile
|
|||
rotators/ts7400/Makefile
|
||||
rotators/indi/Makefile
|
||||
rotators/satel/Makefile
|
||||
rotators/radant/Makefile
|
||||
rigs/adat/Makefile
|
||||
rigs/alinco/Makefile
|
||||
rigs/aor/Makefile
|
||||
|
|
|
@ -604,6 +604,19 @@
|
|||
#define ROT_MODEL_SATEL ROT_MAKE_MODEL(ROT_SATEL, 1)
|
||||
|
||||
|
||||
/**
|
||||
* \brief A macro that returns the model number of the RADANT backend.
|
||||
*
|
||||
* \def ROT_MODEL_RADANT
|
||||
*
|
||||
* The RADANT backend can be used with rotators that support the MS232
|
||||
* interface.
|
||||
*/
|
||||
//! @cond Doxygen_Suppress
|
||||
#define ROT_RADANT 22
|
||||
#define ROT_BACKEND_RADANT "radant"
|
||||
//! @endcond
|
||||
#define ROT_MODEL_RADANT ROT_MAKE_MODEL(ROT_RADANT, 1)
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
noinst_LTLIBRARIES = libhamlib-radant.la
|
||||
libhamlib_radant_la_SOURCES = radant.c radant.h
|
||||
|
||||
EXTRA_DIST = radant.txt
|
|
@ -0,0 +1,224 @@
|
|||
/*
|
||||
* Hamlib Rotator backend - Radant
|
||||
* Copyright (c) 2001-2003 by Stephane Fillod
|
||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
* Copyright (c) 2014 by Alexander Schultze <alexschultze@gmail.com>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
#include <math.h>
|
||||
|
||||
#include "hamlib/rotator.h"
|
||||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "register.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#include "radant.h"
|
||||
|
||||
//#define EASYCOMM3_LEVELS ROT_LEVEL_SPEED
|
||||
|
||||
/* ************************************************************************* */
|
||||
/**
|
||||
* radant_transaction
|
||||
*
|
||||
* Assumes rot!=NULL and cmdstr!=NULL
|
||||
*
|
||||
* cmdstr - string to send to rotator
|
||||
* data - buffer for reply string
|
||||
* data_len - (input) Maximum size of buffer
|
||||
* (output) Number of bytes read.
|
||||
*/
|
||||
static int
|
||||
radant_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
|
||||
{
|
||||
struct rot_state *rs;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called: %s\n", __func__, cmdstr);
|
||||
|
||||
if (!rot)
|
||||
{
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rs = &rot->state;
|
||||
rig_flush(&rs->rotport);
|
||||
retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
if (data == NULL)
|
||||
{
|
||||
return RIG_OK; /* don't want a reply */
|
||||
}
|
||||
|
||||
retval = read_string(&rs->rotport, data, data_len, "\n", 1);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s read_string failed with status %d\n", __func__,
|
||||
retval);
|
||||
goto transaction_quit;
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s read_string: %s\n", __func__, data);
|
||||
retval = RIG_OK;
|
||||
}
|
||||
|
||||
transaction_quit:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
static int
|
||||
radant_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
char cmdstr[13];
|
||||
int retval;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el);
|
||||
|
||||
|
||||
sprintf(cmdstr, "Q%.1f %1.f\r", az, el);
|
||||
|
||||
retval = radant_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* TODO: Error processing */
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
radant_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
char cmdstr[4], ackbuf[16];
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
sprintf(cmdstr, "Y\r");
|
||||
|
||||
retval = radant_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __func__, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s got response: %s\n", __func__, ackbuf);
|
||||
retval = sscanf(ackbuf, "OK%f %f\r", az, el);
|
||||
|
||||
if (retval != 2)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown response (%s)\n", __func__, ackbuf);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
radant_rot_stop(ROT *rot)
|
||||
{
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
retval = radant_transaction(rot, "S\r", NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* TODO: error processing */
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Radant rotator capabilities.
|
||||
*/
|
||||
|
||||
/** Radant implement set and get position function and stop, but
|
||||
* there is no velocity and other configurations functions
|
||||
*/
|
||||
const struct rot_caps radant_rot_caps =
|
||||
{
|
||||
ROT_MODEL(ROT_MODEL_RADANT),
|
||||
.model_name = "Radant",
|
||||
.mfg_name = "Hamlib",
|
||||
.version = "20210409.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rot_type = ROT_TYPE_OTHER,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 9600,
|
||||
.serial_rate_max = 9600,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 1,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 0,
|
||||
.post_write_delay = 0,
|
||||
.timeout = 200,
|
||||
.retry = 3,
|
||||
|
||||
.min_az = 0.0,
|
||||
.max_az = 360.0,
|
||||
.min_el = 0.0,
|
||||
.max_el = 180.0,
|
||||
|
||||
.priv = NULL, /* priv */
|
||||
|
||||
.set_position = radant_rot_set_position,
|
||||
.get_position = radant_rot_get_position,
|
||||
.stop = radant_rot_stop,
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
DECLARE_INITROT_BACKEND(radant)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rot_register(&radant_rot_caps);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* end of file */
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Hamlib Rotator backend - Easycomm interface protocol
|
||||
* Copyright (c) 2001-2003 by Stephane Fillod
|
||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
||||
* Copyright (c) 2014 by Alexander Schultze <alexschultze@gmail.com>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ROT_RADANT_H
|
||||
#define _ROT_RADANT_H 1
|
||||
|
||||
#include "token.h"
|
||||
|
||||
extern const struct rot_caps radant_rot_caps;
|
||||
|
||||
/*
|
||||
* Tokens used by rotorez_rot_set_conf and get_conf and the 'C' command in rotctl
|
||||
* and rotctld.
|
||||
*/
|
||||
|
||||
#define TOK_GET_CONFIG TOKEN_BACKEND(1)
|
||||
#define TOK_SET_CONFIG TOKEN_BACKEND(2)
|
||||
#define TOK_GET_STATUS TOKEN_BACKEND(3)
|
||||
#define TOK_GET_ERRORS TOKEN_BACKEND(4)
|
||||
#define TOK_GET_VERSION TOKEN_BACKEND(5)
|
||||
#define TOK_GET_INPUT TOKEN_BACKEND(6)
|
||||
#define TOK_SET_OUTPUT TOKEN_BACKEND(7)
|
||||
#define TOK_GET_ANALOG_INPUT TOKEN_BACKEND(8)
|
||||
|
||||
|
||||
#endif /* _ROT_RADANT_H */
|
|
@ -0,0 +1,27 @@
|
|||
Standart protocol for both El and Az axes. Working with russian Radant version 1.0 - 1.4: Радант AZV-1
|
||||
|
||||
Serial port mode 9600 8N1.
|
||||
|
||||
|
||||
------------ Main commands -----------------
|
||||
<CR> means carriage return
|
||||
|
||||
- Set desired angle:
|
||||
"Qaaa.a eee.e<CR>", where
|
||||
aaa.a - azimuth angle value with floating point,
|
||||
eee.e - elevation angle with floating point.
|
||||
|
||||
- After receiving command 'Q' rotator will send message
|
||||
"ACK<CR>" if rotator received correct command, or
|
||||
"ERR<CR>", if there were any mistakes.
|
||||
|
||||
- After reaching destination angle rotator will send
|
||||
"OKaaa.a[.]eee.e<CR>"
|
||||
|
||||
- Request current axes angle command:
|
||||
"Y<CR>" without parameters
|
||||
- Rotator will reply:
|
||||
"OKaaa.a[.]eee.e<CR>"
|
||||
|
||||
Command for stop positioning:
|
||||
"S<CR>"
|
|
@ -85,6 +85,7 @@ DEFINE_INITROT_BACKEND(prosistel);
|
|||
DEFINE_INITROT_BACKEND(meade);
|
||||
DEFINE_INITROT_BACKEND(ioptron);
|
||||
DEFINE_INITROT_BACKEND(satel);
|
||||
DEFINE_INITROT_BACKEND(radant);
|
||||
#if HAVE_LIBINDI
|
||||
DEFINE_INITROT_BACKEND(indi);
|
||||
#endif
|
||||
|
@ -128,6 +129,7 @@ static struct
|
|||
{ ROT_MEADE, ROT_BACKEND_MEADE, ROT_FUNCNAMA(meade) },
|
||||
{ ROT_IOPTRON, ROT_BACKEND_IOPTRON, ROT_FUNCNAMA(ioptron) },
|
||||
{ ROT_SATEL, ROT_BACKEND_SATEL, ROT_FUNCNAMA(satel) },
|
||||
{ ROT_RADANT, ROT_BACKEND_RADANT, ROT_FUNCNAMA(radant)},
|
||||
#if HAVE_LIBINDI
|
||||
{ ROT_INDI, ROT_BACKEND_INDI, ROT_FUNCNAMA(indi) },
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue