[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 681c2ae953662b927a2b4
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-04-12 12:36:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 681c2ae953662b927a2b4238fcd7696dfd1ff388 (commit) via 3ef3a255ff287f454d1bc50bf37d880d7c83b5f4 (commit) via 9a0e9c370a21884dade0ad362702eb91f5ec24ea (commit) via 0165d81e479965c17f0cd1fcbf1662bc2e9d41f3 (commit) from 9d38e9a726fbcf6678158fcc6dc023ea4bd5ff9f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 681c2ae953662b927a2b4238fcd7696dfd1ff388 Merge: 3ef3a255 0165d81e Author: Michael Black <mdb...@ya...> Date: Mon Apr 12 07:34:31 2021 -0500 Merge pull request #658 from b-o-r-m-a-l-e-y/radant Add Radant AZV-1 Rotator controller protocol. commit 3ef3a255ff287f454d1bc50bf37d880d7c83b5f4 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Apr 11 17:34:53 2021 -0500 Remove more verbosity from flrig.c diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index cbb0b508..1e630571 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -1572,7 +1572,7 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) if (vfo == RIG_VFO_A) { *mode = priv->curr_modeA; } else { *mode = priv->curr_modeB; } - rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s call not made as PTT=1\n", __func__); RETURNFUNC(RIG_OK); // just return OK and ignore this } @@ -1893,7 +1893,7 @@ static int flrig_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) if (priv->ptt) { - rig_debug(RIG_DEBUG_WARN, "%s call not made as PTT=1\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s call not made as PTT=1\n", __func__); RETURNFUNC(RIG_OK); // just return OK and ignore this } @@ -1971,7 +1971,7 @@ static int flrig_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, if (priv->ptt) { - rig_debug(RIG_DEBUG_WARN, "%s set_mode call not made as PTT=1\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s set_mode call not made as PTT=1\n", __func__); RETURNFUNC(RIG_OK); // just return OK and ignore this } commit 9a0e9c370a21884dade0ad362702eb91f5ec24ea Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Apr 11 16:56:04 2021 -0500 Reduce flrig verbosity a bit diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index bed6e679..cbb0b508 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -1380,7 +1380,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) if (priv->ptt) { - rig_debug(RIG_DEBUG_WARN, "%s set_mode call not made as PTT=1\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s set_mode call not made as PTT=1\n", __func__); RETURNFUNC(RIG_OK); // just return OK and ignore this } commit 0165d81e479965c17f0cd1fcbf1662bc2e9d41f3 Author: Evgeniy Titorenko <evg...@sp...> Date: Fri Apr 9 19:19:08 2021 +0300 Add Radant AZV-1 Rotator controller protocol. diff --git a/configure.ac b/configure.ac index 4ba505b3..7086bb01 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/include/hamlib/rotlist.h b/include/hamlib/rotlist.h index cdfe840c..939cad56 100644 --- a/include/hamlib/rotlist.h +++ b/include/hamlib/rotlist.h @@ -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) /** diff --git a/rotators/radant/Makefile.am b/rotators/radant/Makefile.am new file mode 100644 index 00000000..42da545f --- /dev/null +++ b/rotators/radant/Makefile.am @@ -0,0 +1,5 @@ + +noinst_LTLIBRARIES = libhamlib-radant.la +libhamlib_radant_la_SOURCES = radant.c radant.h + +EXTRA_DIST = radant.txt diff --git a/rotators/radant/radant.c b/rotators/radant/radant.c new file mode 100644 index 00000000..351aadc7 --- /dev/null +++ b/rotators/radant/radant.c @@ -0,0 +1,224 @@ +/* + * Hamlib Rotator backend - Radant + * Copyright (c) 2001-2003 by Stephane Fillod + * Contributed by Francois Retief <fgr...@su...> + * Copyright (c) 2014 by Alexander Schultze <ale...@gm...> + * + * + * 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 */ diff --git a/rotators/radant/radant.h b/rotators/radant/radant.h new file mode 100644 index 00000000..72226b54 --- /dev/null +++ b/rotators/radant/radant.h @@ -0,0 +1,46 @@ +/* + * Hamlib Rotator backend - Easycomm interface protocol + * Copyright (c) 2001-2003 by Stephane Fillod + * Contributed by Francois Retief <fgr...@su...> + * Copyright (c) 2014 by Alexander Schultze <ale...@gm...> + * + * + * 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 */ diff --git a/rotators/radant/radant.txt b/rotators/radant/radant.txt new file mode 100644 index 00000000..c6d10a56 --- /dev/null +++ b/rotators/radant/radant.txt @@ -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>" diff --git a/src/rot_reg.c b/src/rot_reg.c index 8a341872..3a97ed71 100644 --- a/src/rot_reg.c +++ b/src/rot_reg.c @@ -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 ----------------------------------------------------------------------- Summary of changes: configure.ac | 3 +- include/hamlib/rotlist.h | 13 ++ rigs/dummy/flrig.c | 8 +- rotators/radant/Makefile.am | 5 + rotators/radant/radant.c | 224 ++++++++++++++++++++++ rotators/{easycomm/easycomm.h => radant/radant.h} | 10 +- rotators/radant/radant.txt | 27 +++ src/rot_reg.c | 2 + 8 files changed, 281 insertions(+), 11 deletions(-) create mode 100644 rotators/radant/Makefile.am create mode 100644 rotators/radant/radant.c copy rotators/{easycomm/easycomm.h => radant/radant.h} (86%) create mode 100644 rotators/radant/radant.txt hooks/post-receive -- Hamlib -- Ham radio control libraries |