2010-02-25 19:17:46 +00:00
|
|
|
/*
|
|
|
|
* Hamlib Rotator backend - GS-232B
|
2012-06-09 17:04:49 +00:00
|
|
|
* Copyright (c) 2001-2012 by Stephane Fillod
|
2010-02-25 19:17:46 +00:00
|
|
|
* (c) 2010 by Kobus Botha
|
|
|
|
*
|
|
|
|
*
|
2011-08-21 00:30:58 +00:00
|
|
|
* 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.
|
2010-02-25 19:17:46 +00:00
|
|
|
*
|
2011-08-21 00:30:58 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2010-02-25 19:17:46 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-08-21 00:30:58 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2010-02-25 19:17:46 +00:00
|
|
|
*
|
2011-08-21 00:30:58 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-02-25 19:17:46 +00:00
|
|
|
* License along with this library; if not, write to the Free Software
|
2011-08-21 00:30:58 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2010-02-25 19:17:46 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2020-05-05 16:32:09 +00:00
|
|
|
// cppcheck-suppress *
|
2010-02-25 19:17:46 +00:00
|
|
|
#include <stdio.h>
|
2020-05-05 16:32:09 +00:00
|
|
|
// cppcheck-suppress *
|
2019-10-07 13:15:26 +00:00
|
|
|
#include <string.h> /* String function definitions */
|
2020-05-05 16:32:09 +00:00
|
|
|
// cppcheck-suppress *
|
2010-02-25 19:17:46 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "hamlib/rotator.h"
|
|
|
|
#include "serial.h"
|
|
|
|
#include "misc.h"
|
2020-12-03 21:07:08 +00:00
|
|
|
#include "idx_builtin.h"
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2012-06-09 17:04:49 +00:00
|
|
|
#define EOM "\r"
|
2020-12-01 21:18:08 +00:00
|
|
|
#define REPLY_EOM "\n"
|
2010-02-25 19:17:46 +00:00
|
|
|
|
|
|
|
#define BUFSZ 64
|
|
|
|
|
2020-12-03 21:07:08 +00:00
|
|
|
#define GS232B_LEVELS ROT_LEVEL_SPEED
|
|
|
|
|
2010-02-25 19:17:46 +00:00
|
|
|
/**
|
|
|
|
* gs232b_transaction
|
|
|
|
*
|
|
|
|
* cmdstr - Command to be sent to the rig.
|
|
|
|
* data - Buffer for reply string. Can be NULL, indicating that no reply is
|
|
|
|
* is needed, but answer will still be read.
|
|
|
|
* data_len - in: Size of buffer. It is the caller's responsibily to provide
|
|
|
|
* a large enough buffer for all possible replies for a command.
|
|
|
|
*
|
|
|
|
* returns:
|
Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 07:02:12 +00:00
|
|
|
* RIG_OK - if no error occurred.
|
|
|
|
* RIG_EIO - if an I/O error occurred while sending/receiving data.
|
2010-02-25 19:17:46 +00:00
|
|
|
* RIG_ETIMEOUT - if timeout expires without any characters received.
|
|
|
|
* RIG_REJECTED - if a negative acknowledge was received or command not
|
|
|
|
* recognized by rig.
|
|
|
|
*/
|
2012-06-09 17:04:49 +00:00
|
|
|
static int
|
2019-10-07 13:15:26 +00:00
|
|
|
gs232b_transaction(ROT *rot, const char *cmdstr,
|
2019-11-18 23:08:34 +00:00
|
|
|
char *data, size_t data_len, int no_reply)
|
2010-02-25 19:17:46 +00:00
|
|
|
{
|
2019-11-24 04:19:56 +00:00
|
|
|
struct rot_state *rs;
|
|
|
|
int retval;
|
|
|
|
int retry_read = 0;
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
rs = &rot->state;
|
2010-02-25 19:17:46 +00:00
|
|
|
|
|
|
|
transaction_write:
|
|
|
|
|
2020-06-23 13:44:27 +00:00
|
|
|
rig_flush(&rs->rotport);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (cmdstr)
|
2019-10-07 13:15:26 +00:00
|
|
|
{
|
2019-11-24 04:19:56 +00:00
|
|
|
retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
|
|
|
|
|
|
|
|
if (retval != RIG_OK)
|
|
|
|
{
|
|
|
|
goto transaction_quit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!data)
|
|
|
|
{
|
|
|
|
write_block(&rs->rotport, EOM, strlen(EOM));
|
|
|
|
}
|
2010-02-25 19:17:46 +00:00
|
|
|
}
|
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (no_reply) { return RIG_OK; } // nothing expected so return
|
|
|
|
|
2020-04-24 19:16:33 +00:00
|
|
|
/* If no data requested just return */
|
2010-02-25 19:17:46 +00:00
|
|
|
if (!data)
|
2019-10-07 13:15:26 +00:00
|
|
|
{
|
2020-04-24 19:16:33 +00:00
|
|
|
return RIG_OK;
|
2019-11-24 04:19:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!data_len)
|
|
|
|
{
|
|
|
|
data_len = BUFSZ;
|
2019-10-07 13:15:26 +00:00
|
|
|
}
|
|
|
|
|
2019-11-18 23:08:34 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
memset(data, 0, data_len);
|
|
|
|
retval = read_string(&rs->rotport, data, data_len, REPLY_EOM,
|
|
|
|
strlen(REPLY_EOM));
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2020-12-06 12:21:39 +00:00
|
|
|
if (strncmp(data, "\r\n", 2) == 0 || strchr(data, '>'))
|
2020-12-02 13:48:21 +00:00
|
|
|
{
|
2020-12-06 12:21:39 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Invalid response for '%s': '%s' (length=%d)\n",
|
2020-12-17 21:07:04 +00:00
|
|
|
__func__, cmdstr, data, (int) strlen(data));
|
2020-12-02 13:50:11 +00:00
|
|
|
dump_hex((unsigned char *)data, strlen(data));
|
2020-12-06 12:21:39 +00:00
|
|
|
retval = -RIG_EPROTO; // force retry
|
2020-12-02 13:48:21 +00:00
|
|
|
}
|
|
|
|
|
2020-12-01 22:57:10 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (retval < 0)
|
|
|
|
{
|
|
|
|
if (retry_read++ < rot->state.rotport.retry)
|
|
|
|
{
|
|
|
|
goto transaction_write;
|
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
goto transaction_quit;
|
|
|
|
}
|
2019-11-18 23:08:34 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
#if 0
|
|
|
|
/* Check that command termination is correct */
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (strchr(REPLY_EOM, data[strlen(data) - 1]) == NULL)
|
2019-10-07 13:15:26 +00:00
|
|
|
{
|
2019-11-24 04:19:56 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR,
|
|
|
|
"%s: Command is not correctly terminated '%s'\n",
|
2019-11-30 16:16:28 +00:00
|
|
|
__func__, data);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (retry_read++ < rig->state.rotport.retry)
|
|
|
|
{
|
|
|
|
goto transaction_write;
|
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
retval = -RIG_EPROTO;
|
|
|
|
goto transaction_quit;
|
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
#endif
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2020-06-16 03:57:22 +00:00
|
|
|
#if 0
|
2020-06-17 12:22:11 +00:00
|
|
|
https://github.com/Hamlib/Hamlib/issues/272
|
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
// If asked for we will check for connection
|
|
|
|
// we don't expect a reply...just a prompt return
|
|
|
|
// Seems some GS232B's only echo the CR
|
2020-06-12 03:30:11 +00:00
|
|
|
if ((strncmp(data, "?>", 2) != 0) && data[0] != 0x0d)
|
2019-10-07 13:15:26 +00:00
|
|
|
{
|
2019-11-24 04:19:56 +00:00
|
|
|
rig_debug(RIG_DEBUG_VERBOSE,
|
|
|
|
"%s: Expected '?>' but got '%s' from cmd '%s'\n",
|
2019-11-30 16:16:28 +00:00
|
|
|
__func__, data, cmdstr);
|
2019-11-24 04:19:56 +00:00
|
|
|
return -RIG_EPROTO;
|
2010-02-25 19:17:46 +00:00
|
|
|
}
|
2020-06-17 12:22:11 +00:00
|
|
|
|
2020-06-16 03:57:22 +00:00
|
|
|
#endif
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (data[0] == '?')
|
|
|
|
{
|
|
|
|
/* Invalid command */
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: Error for '%s': '%s'\n",
|
2019-11-30 16:16:28 +00:00
|
|
|
__func__, cmdstr, data);
|
2019-11-24 04:19:56 +00:00
|
|
|
retval = -RIG_EPROTO;
|
|
|
|
goto transaction_quit;
|
|
|
|
}
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
retval = RIG_OK;
|
2010-02-25 19:17:46 +00:00
|
|
|
transaction_quit:
|
2019-11-24 04:19:56 +00:00
|
|
|
return retval;
|
2010-02-25 19:17:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
gs232b_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|
|
|
{
|
2019-11-24 04:19:56 +00:00
|
|
|
char cmdstr[64];
|
|
|
|
int retval;
|
|
|
|
unsigned u_az, u_el;
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s called: az=%.02f el=%.02f\n", __func__, az,
|
2019-11-24 04:19:56 +00:00
|
|
|
el);
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (az < 0.0)
|
|
|
|
{
|
|
|
|
az = az + 360.0;
|
|
|
|
}
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
u_az = (unsigned) rint(az);
|
|
|
|
u_el = (unsigned) rint(el);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
sprintf(cmdstr, "W%03u %03u" EOM, u_az, u_el);
|
2020-06-01 04:21:51 +00:00
|
|
|
#if 0 // do any GS232B models need a reply to the W command?
|
2019-11-24 04:19:56 +00:00
|
|
|
retval = gs232b_transaction(rot, cmdstr, buf, sizeof(buf), 0);
|
2020-06-01 04:21:51 +00:00
|
|
|
#else
|
2020-06-10 03:37:03 +00:00
|
|
|
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 0);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (retval != RIG_OK)
|
|
|
|
{
|
|
|
|
return retval;
|
|
|
|
}
|
2020-06-10 03:37:03 +00:00
|
|
|
|
2020-06-01 04:21:51 +00:00
|
|
|
#endif
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
return RIG_OK;
|
2010-02-25 19:17:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gs232b_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|
|
|
{
|
2019-11-24 04:19:56 +00:00
|
|
|
char posbuf[32];
|
2020-06-17 12:22:11 +00:00
|
|
|
int retval, int_az = 0, int_el = 0;
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
retval = gs232b_transaction(rot, "C2" EOM, posbuf, sizeof(posbuf), 0);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (retval != RIG_OK || strlen(posbuf) < 10)
|
|
|
|
{
|
|
|
|
return retval < 0 ? retval : -RIG_EPROTO;
|
|
|
|
}
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
/* parse "AZ=aaa EL=eee" */
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
/* With the format string containing a space character as one of the
|
|
|
|
* directives, any amount of space is matched, including none in the input.
|
|
|
|
*/
|
2020-06-17 12:22:11 +00:00
|
|
|
// There's a 12PR1A rotor that only returns AZ so we may only get AZ=xxx
|
|
|
|
if (sscanf(posbuf, "AZ=%d EL=%d", &int_az, &int_el) == 0)
|
2020-07-07 16:39:26 +00:00
|
|
|
{
|
|
|
|
// only give error if we didn't parse anything
|
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s', expected AZ=xxx EL=xxx\n",
|
|
|
|
__func__,
|
2019-11-24 04:19:56 +00:00
|
|
|
posbuf);
|
|
|
|
return -RIG_EPROTO;
|
|
|
|
}
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
*az = (azimuth_t) int_az;
|
|
|
|
*el = (elevation_t) int_el;
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.0f, %.0f)\n",
|
2019-11-30 16:16:28 +00:00
|
|
|
__func__, *az, *el);
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
return RIG_OK;
|
2010-02-25 19:17:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gs232b_rot_stop(ROT *rot)
|
|
|
|
{
|
2019-11-24 04:19:56 +00:00
|
|
|
int retval;
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
/* All Stop */
|
2020-12-06 12:21:39 +00:00
|
|
|
retval = gs232b_transaction(rot, "S" EOM, NULL, 0, 0);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (retval != RIG_OK)
|
|
|
|
{
|
|
|
|
return retval;
|
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
return RIG_OK;
|
2010-02-25 19:17:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-03 21:07:08 +00:00
|
|
|
static int gs232b_rot_get_level(ROT *rot, setting_t level, value_t *val)
|
|
|
|
{
|
|
|
|
struct rot_state *rs = &rot->state;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
|
|
|
|
2020-12-17 21:07:04 +00:00
|
|
|
switch (level)
|
|
|
|
{
|
|
|
|
case ROT_LEVEL_SPEED:
|
|
|
|
val->i = rs->current_speed;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -RIG_ENAVAIL;
|
2020-12-03 21:07:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val)
|
2010-02-25 19:17:46 +00:00
|
|
|
{
|
2020-11-24 19:51:10 +00:00
|
|
|
struct rot_state *rs = &rot->state;
|
2019-11-24 04:19:56 +00:00
|
|
|
char cmdstr[24];
|
|
|
|
int retval;
|
2020-12-03 21:07:08 +00:00
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
|
|
|
|
2020-12-17 21:07:04 +00:00
|
|
|
switch (level)
|
|
|
|
{
|
|
|
|
case ROT_LEVEL_SPEED:
|
|
|
|
{
|
|
|
|
int speed = val.i;
|
|
|
|
|
|
|
|
if (speed < 1)
|
|
|
|
{
|
|
|
|
speed = 1;
|
|
|
|
}
|
|
|
|
else if (speed > 4)
|
|
|
|
{
|
|
|
|
speed = 4;
|
2020-12-03 21:07:08 +00:00
|
|
|
}
|
2020-12-17 21:07:04 +00:00
|
|
|
|
|
|
|
/* between 1 (slowest) and 4 (fastest) */
|
|
|
|
sprintf(cmdstr, "X%u" EOM, speed);
|
|
|
|
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1);
|
|
|
|
|
|
|
|
if (retval != RIG_OK)
|
|
|
|
{
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
rs->current_speed = speed;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -RIG_ENAVAIL;
|
2020-12-03 21:07:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int gs232b_rot_move(ROT *rot, int direction, int speed)
|
|
|
|
{
|
|
|
|
char cmdstr[24];
|
|
|
|
int retval;
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2019-11-30 16:16:28 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __func__,
|
2019-11-24 04:19:56 +00:00
|
|
|
direction, speed);
|
2010-02-25 19:17:46 +00:00
|
|
|
|
2020-12-17 21:07:04 +00:00
|
|
|
if (speed != ROT_SPEED_NOCHANGE)
|
|
|
|
{
|
2020-12-03 21:07:08 +00:00
|
|
|
value_t gs232b_speed;
|
|
|
|
|
2020-11-24 19:51:10 +00:00
|
|
|
if (speed < 1 || speed > 100)
|
|
|
|
{
|
2020-12-17 21:07:04 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__,
|
|
|
|
speed);
|
2020-11-24 19:51:10 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2020-12-03 21:07:08 +00:00
|
|
|
gs232b_speed.i = (3 * speed) / 100 + 1;
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2020-12-03 21:07:08 +00:00
|
|
|
retval = gs232b_rot_set_level(rot, ROT_LEVEL_SPEED, gs232b_speed);
|
2020-11-24 19:51:10 +00:00
|
|
|
|
|
|
|
if (retval != RIG_OK)
|
|
|
|
{
|
|
|
|
return retval;
|
|
|
|
}
|
2019-11-24 04:19:56 +00:00
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case ROT_MOVE_UP: /* Elevation increase */
|
|
|
|
sprintf(cmdstr, "U" EOM);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ROT_MOVE_DOWN: /* Elevation decrease */
|
|
|
|
sprintf(cmdstr, "D" EOM);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ROT_MOVE_LEFT: /* Azimuth decrease */
|
|
|
|
sprintf(cmdstr, "L" EOM);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ROT_MOVE_RIGHT: /* Azimuth increase */
|
|
|
|
sprintf(cmdstr, "R" EOM);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Invalid direction value! (%d)\n",
|
2019-11-30 16:16:28 +00:00
|
|
|
__func__, direction);
|
2019-11-24 04:19:56 +00:00
|
|
|
return -RIG_EINVAL;
|
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1);
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
if (retval != RIG_OK)
|
|
|
|
{
|
|
|
|
return retval;
|
|
|
|
}
|
2019-10-07 13:15:26 +00:00
|
|
|
|
2019-11-24 04:19:56 +00:00
|
|
|
return RIG_OK;
|
2010-02-25 19:17:46 +00:00
|
|
|
}
|
|
|
|
|
2020-12-03 21:07:08 +00:00
|
|
|
|
|
|
|
static int gs232b_rot_init(ROT *rot)
|
|
|
|
{
|
|
|
|
struct rot_state *rs = &rot->state;
|
|
|
|
|
|
|
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
|
|
|
|
|
|
|
// Set default speed to half of maximum
|
|
|
|
rs->current_speed = 3;
|
|
|
|
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-25 19:17:46 +00:00
|
|
|
/* ************************************************************************* */
|
|
|
|
/*
|
|
|
|
* Generic GS232B rotator capabilities.
|
|
|
|
*/
|
|
|
|
|
2019-10-07 13:15:26 +00:00
|
|
|
const struct rot_caps gs232b_rot_caps =
|
|
|
|
{
|
2020-03-06 05:48:14 +00:00
|
|
|
ROT_MODEL(ROT_MODEL_GS232B),
|
2019-11-24 04:19:56 +00:00
|
|
|
.model_name = "GS-232B",
|
|
|
|
.mfg_name = "Yaesu",
|
2020-12-03 21:07:08 +00:00
|
|
|
.version = "20201203.0",
|
2019-11-24 04:19:56 +00:00
|
|
|
.copyright = "LGPL",
|
|
|
|
.status = RIG_STATUS_STABLE,
|
2020-12-03 21:07:08 +00:00
|
|
|
.rot_type = ROT_TYPE_AZEL,
|
2019-11-24 04:19:56 +00:00
|
|
|
.port_type = RIG_PORT_SERIAL,
|
|
|
|
.serial_rate_min = 1200,
|
|
|
|
.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,
|
2020-12-02 13:48:21 +00:00
|
|
|
.post_write_delay = 50,
|
2019-11-24 04:19:56 +00:00
|
|
|
.timeout = 400,
|
|
|
|
.retry = 3,
|
|
|
|
|
|
|
|
.min_az = -180.0,
|
|
|
|
.max_az = 450.0, /* vary according to rotator type */
|
|
|
|
.min_el = 0.0,
|
|
|
|
.max_el = 180.0, /* requires G-5400B, G-5600B, G-5500, or G-500/G-550 */
|
|
|
|
|
2020-12-03 21:07:08 +00:00
|
|
|
.has_get_level = GS232B_LEVELS,
|
|
|
|
.has_set_level = ROT_LEVEL_SET(GS232B_LEVELS),
|
|
|
|
|
|
|
|
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
|
|
|
|
|
|
|
.rot_init = gs232b_rot_init,
|
|
|
|
.get_position = gs232b_rot_get_position,
|
|
|
|
.set_position = gs232b_rot_set_position,
|
|
|
|
.stop = gs232b_rot_stop,
|
|
|
|
.move = gs232b_rot_move,
|
|
|
|
.get_level = gs232b_rot_get_level,
|
|
|
|
.set_level = gs232b_rot_set_level,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
/*
|
|
|
|
* Generic GS232B azimuth rotator capabilities.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const struct rot_caps gs232b_az_rot_caps =
|
|
|
|
{
|
|
|
|
ROT_MODEL(ROT_MODEL_GS232B_AZ),
|
|
|
|
.model_name = "GS-232B azimuth",
|
|
|
|
.mfg_name = "Yaesu",
|
|
|
|
.version = "20201203.0",
|
|
|
|
.copyright = "LGPL",
|
|
|
|
.status = RIG_STATUS_STABLE,
|
|
|
|
.rot_type = ROT_TYPE_AZIMUTH,
|
|
|
|
.port_type = RIG_PORT_SERIAL,
|
|
|
|
.serial_rate_min = 1200,
|
|
|
|
.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 = 50,
|
|
|
|
.timeout = 400,
|
|
|
|
.retry = 3,
|
|
|
|
|
|
|
|
.min_az = -180.0,
|
|
|
|
.max_az = 450.0, /* vary according to rotator type */
|
|
|
|
.min_el = 0.0,
|
|
|
|
.max_el = 0.0,
|
|
|
|
|
|
|
|
.has_get_level = GS232B_LEVELS,
|
|
|
|
.has_set_level = ROT_LEVEL_SET(GS232B_LEVELS),
|
|
|
|
|
|
|
|
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
|
|
|
|
|
|
|
.rot_init = gs232b_rot_init,
|
|
|
|
.get_position = gs232b_rot_get_position,
|
|
|
|
.set_position = gs232b_rot_set_position,
|
|
|
|
.stop = gs232b_rot_stop,
|
|
|
|
.move = gs232b_rot_move,
|
|
|
|
.get_level = gs232b_rot_get_level,
|
|
|
|
.set_level = gs232b_rot_set_level,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
/*
|
|
|
|
* Generic GS232B elevation rotator capabilities.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const struct rot_caps gs232b_el_rot_caps =
|
|
|
|
{
|
|
|
|
ROT_MODEL(ROT_MODEL_GS232B_EL),
|
|
|
|
.model_name = "GS-232B elevation",
|
|
|
|
.mfg_name = "Yaesu",
|
|
|
|
.version = "20201203.0",
|
|
|
|
.copyright = "LGPL",
|
|
|
|
.status = RIG_STATUS_STABLE,
|
|
|
|
.rot_type = ROT_TYPE_ELEVATION,
|
|
|
|
.port_type = RIG_PORT_SERIAL,
|
|
|
|
.serial_rate_min = 1200,
|
|
|
|
.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 = 50,
|
|
|
|
.timeout = 400,
|
|
|
|
.retry = 3,
|
|
|
|
|
|
|
|
.min_az = 0.0,
|
|
|
|
.max_az = 0.0,
|
|
|
|
.min_el = 0.0,
|
|
|
|
.max_el = 180.0, /* requires G-5400B, G-5600B, G-5500, or G-500/G-550 */
|
|
|
|
|
|
|
|
.has_get_level = GS232B_LEVELS,
|
|
|
|
.has_set_level = ROT_LEVEL_SET(GS232B_LEVELS),
|
|
|
|
|
|
|
|
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
|
|
|
|
|
|
|
.rot_init = gs232b_rot_init,
|
2019-11-24 04:19:56 +00:00
|
|
|
.get_position = gs232b_rot_get_position,
|
|
|
|
.set_position = gs232b_rot_set_position,
|
|
|
|
.stop = gs232b_rot_stop,
|
|
|
|
.move = gs232b_rot_move,
|
2020-12-03 21:07:08 +00:00
|
|
|
.get_level = gs232b_rot_get_level,
|
|
|
|
.set_level = gs232b_rot_set_level,
|
2010-02-25 19:17:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* end of file */
|