kopia lustrzana https://github.com/Hamlib/Hamlib
Add support for ROT_LEVEL_SPEED level in rotator backends that support setting the rotator speed via the move command. Add azimuth-only and elevation-only versions of generic GS-232A and GS-232B backends.
rodzic
457211a7e3
commit
81a0c521e7
|
@ -261,6 +261,10 @@
|
|||
#define ROT_MODEL_GS232 ROT_MAKE_MODEL(ROT_GS232A, 6) /* Not A or B */
|
||||
#define ROT_MODEL_LVB ROT_MAKE_MODEL(ROT_GS232A, 7)
|
||||
#define ROT_MODEL_ST2 ROT_MAKE_MODEL(ROT_GS232A, 8)
|
||||
#define ROT_MODEL_GS232A_AZ ROT_MAKE_MODEL(ROT_GS232A, 9)
|
||||
#define ROT_MODEL_GS232A_EL ROT_MAKE_MODEL(ROT_GS232A, 10)
|
||||
#define ROT_MODEL_GS232B_AZ ROT_MAKE_MODEL(ROT_GS232A, 11)
|
||||
#define ROT_MODEL_GS232B_EL ROT_MAKE_MODEL(ROT_GS232A, 12)
|
||||
|
||||
/**
|
||||
* \def ROT_MODEL_PCROTOR
|
||||
|
|
|
@ -35,9 +35,12 @@
|
|||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "register.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#include "easycomm.h"
|
||||
|
||||
#define EASYCOMM3_LEVELS ROT_LEVEL_SPEED
|
||||
|
||||
/* ************************************************************************* */
|
||||
/**
|
||||
* easycomm_transaction
|
||||
|
@ -247,8 +250,7 @@ easycomm_rot_move(ROT *rot, int direction, int speed)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
||||
static int easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
char cmdstr[24];
|
||||
|
@ -258,7 +260,7 @@ easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
if (speed == ROT_SPEED_NOCHANGE) {
|
||||
easycomm_speed = ((rs->current_speed - 1) * 100);
|
||||
easycomm_speed = rs->current_speed;
|
||||
} else {
|
||||
if (speed < 1 || speed > 100)
|
||||
{
|
||||
|
@ -267,8 +269,8 @@ easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
easycomm_speed = ((speed - 1) * 100);
|
||||
rs->current_speed = easycomm_speed;
|
||||
}
|
||||
|
||||
/* Speed for EasyComm 3 */
|
||||
|
@ -306,6 +308,49 @@ easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int easycomm_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));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int easycomm_rot_set_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));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 0) {
|
||||
speed = 0;
|
||||
} else if (speed > 9999) {
|
||||
speed = 9999;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Info
|
||||
* returns the model name string
|
||||
|
@ -441,6 +486,19 @@ static int easycomm_rot_set_conf(ROT *rot, token_t token, const char *val)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int easycomm_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 = 5000;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Easycomm rotator capabilities.
|
||||
|
@ -537,7 +595,7 @@ const struct rot_caps easycomm3_rot_caps =
|
|||
ROT_MODEL(ROT_MODEL_EASYCOMM3),
|
||||
.model_name = "EasycommIII",
|
||||
.mfg_name = "Hamlib",
|
||||
.version = "20201118.0",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_ALPHA,
|
||||
.rot_type = ROT_TYPE_OTHER,
|
||||
|
@ -560,7 +618,12 @@ const struct rot_caps easycomm3_rot_caps =
|
|||
|
||||
.priv = NULL, /* priv */
|
||||
|
||||
.rot_init = NULL,
|
||||
.has_get_level = EASYCOMM3_LEVELS,
|
||||
.has_set_level = ROT_LEVEL_SET(EASYCOMM3_LEVELS),
|
||||
|
||||
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 0 }, .max = { .i = 9999 }, .step = { .i = 1 } } },
|
||||
|
||||
.rot_init = easycomm_rot_init,
|
||||
.rot_cleanup = NULL,
|
||||
.rot_open = NULL,
|
||||
.rot_close = NULL,
|
||||
|
@ -571,6 +634,8 @@ const struct rot_caps easycomm3_rot_caps =
|
|||
.park = easycomm_rot_park,
|
||||
.reset = easycomm_rot_reset,
|
||||
.move = easycomm_rot_move_velocity,
|
||||
.get_level = easycomm_rot_get_level,
|
||||
.set_level = easycomm_rot_set_level,
|
||||
.set_conf = easycomm_rot_set_conf,
|
||||
.get_conf = easycomm_rot_get_conf,
|
||||
.get_info = easycomm_rot_get_info,
|
||||
|
|
|
@ -35,12 +35,15 @@
|
|||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "register.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#include "ether6.h"
|
||||
|
||||
#define CMD_MAX 32
|
||||
#define BUF_MAX 64
|
||||
|
||||
#define ETHER_LEVELS ROT_LEVEL_SPEED
|
||||
|
||||
/*
|
||||
* Helper function with protocol return code parsing
|
||||
*/
|
||||
|
@ -306,6 +309,51 @@ static int ether_rot_move(ROT *rot, int direction, int speed)
|
|||
}
|
||||
|
||||
|
||||
static int ether_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));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int ether_rot_set_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));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 1) {
|
||||
speed = 1;
|
||||
} else if (speed > 100) {
|
||||
speed = 100;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const char *ether_rot_get_info(ROT *rot)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
@ -314,6 +362,18 @@ static const char *ether_rot_get_info(ROT *rot)
|
|||
}
|
||||
|
||||
|
||||
static int ether_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 = 00;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Dummy rotator capabilities.
|
||||
|
@ -324,7 +384,7 @@ const struct rot_caps ether6_rot_caps =
|
|||
ROT_MODEL(ROT_MODEL_ETHER6),
|
||||
.model_name = "Ether6 (via ethernet)",
|
||||
.mfg_name = "DG9OAA",
|
||||
.version = "20200106.0",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rot_type = ROT_FLAG_AZIMUTH,
|
||||
|
@ -339,8 +399,13 @@ const struct rot_caps ether6_rot_caps =
|
|||
|
||||
.priv = NULL, /* priv */
|
||||
|
||||
/* .rot_init = ether_rot_init, */
|
||||
/* .rot_cleanup = ether_rot_cleanup, */
|
||||
.has_get_level = ETHER_LEVELS,
|
||||
.has_set_level = ROT_LEVEL_SET(ETHER_LEVELS),
|
||||
|
||||
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 0 }, .max = { .i = 9999 }, .step = { .i = 1 } } },
|
||||
|
||||
.rot_init = ether_rot_init,
|
||||
.rot_cleanup = NULL,
|
||||
|
||||
.rot_open = ether_rot_open,
|
||||
.rot_close = ether_rot_close,
|
||||
|
@ -351,6 +416,8 @@ const struct rot_caps ether6_rot_caps =
|
|||
.stop = ether_rot_stop,
|
||||
.reset = ether_rot_reset,
|
||||
.move = ether_rot_move,
|
||||
.get_level = ether_rot_get_level,
|
||||
.set_level = ether_rot_set_level,
|
||||
|
||||
.get_info = ether_rot_get_info,
|
||||
};
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "register.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#include "gs232a.h"
|
||||
|
||||
|
@ -46,6 +47,8 @@
|
|||
|
||||
#define BUFSZ 64
|
||||
|
||||
#define GS232A_LEVELS ROT_LEVEL_SPEED
|
||||
|
||||
/**
|
||||
* gs232a_transaction
|
||||
*
|
||||
|
@ -236,36 +239,85 @@ gs232a_rot_stop(ROT *rot)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
gs232a_rot_move(ROT *rot, int direction, int speed)
|
||||
static int gs232a_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));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int gs232a_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
char cmdstr[24];
|
||||
int retval;
|
||||
unsigned x_speed;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 1) {
|
||||
speed = 1;
|
||||
} else if (speed > 4) {
|
||||
speed = 4;
|
||||
}
|
||||
|
||||
/* between 1 (slowest) and 4 (fastest) */
|
||||
sprintf(cmdstr, "X%u" EOM, speed);
|
||||
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1);
|
||||
|
||||
if (retval != RIG_OK) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int gs232a_rot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
char cmdstr[24];
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __func__,
|
||||
direction, speed);
|
||||
|
||||
if (speed != ROT_SPEED_NOCHANGE) {
|
||||
value_t gs232a_speed;
|
||||
|
||||
if (speed < 1 || speed > 100)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
x_speed = (3 * speed) / 100 + 1;
|
||||
gs232a_speed.i = (3 * speed) / 100 + 1;
|
||||
|
||||
/* between 1 (slowest) and 4 (fastest) */
|
||||
sprintf(cmdstr, "X%u" EOM, x_speed);
|
||||
retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1);
|
||||
retval = gs232a_rot_set_level(rot, ROT_LEVEL_SPEED, gs232a_speed);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
|
@ -302,6 +354,20 @@ gs232a_rot_move(ROT *rot, int direction, int speed)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int gs232a_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;
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Generic GS23 rotator capabilities.
|
||||
|
@ -312,7 +378,7 @@ const struct rot_caps gs23_rot_caps =
|
|||
ROT_MODEL(ROT_MODEL_GS23),
|
||||
.model_name = "GS-23",
|
||||
.mfg_name = "Yaesu/Kenpro",
|
||||
.version = "20201202.0",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rot_type = ROT_TYPE_AZEL,
|
||||
|
@ -333,9 +399,17 @@ const struct rot_caps gs23_rot_caps =
|
|||
.min_el = 0.0,
|
||||
.max_el = 180.0,
|
||||
|
||||
.has_get_level = GS232A_LEVELS,
|
||||
.has_set_level = ROT_LEVEL_SET(GS232A_LEVELS),
|
||||
|
||||
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
||||
|
||||
.rot_init = gs232a_rot_init,
|
||||
.get_position = gs232a_rot_get_position,
|
||||
.set_position = gs232a_rot_set_position,
|
||||
.stop = gs232a_rot_stop,
|
||||
.stop = gs232a_rot_stop,
|
||||
.get_level = gs232a_rot_get_level,
|
||||
.set_level = gs232a_rot_set_level,
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
@ -348,7 +422,7 @@ const struct rot_caps gs232_rot_caps =
|
|||
ROT_MODEL(ROT_MODEL_GS232),
|
||||
.model_name = "GS-232",
|
||||
.mfg_name = "Yaesu/Kenpro",
|
||||
.version = "20201202.0",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rot_type = ROT_TYPE_AZEL,
|
||||
|
@ -369,9 +443,17 @@ const struct rot_caps gs232_rot_caps =
|
|||
.min_el = 0.0,
|
||||
.max_el = 180.0,
|
||||
|
||||
.has_get_level = GS232A_LEVELS,
|
||||
.has_set_level = ROT_LEVEL_SET(GS232A_LEVELS),
|
||||
|
||||
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
||||
|
||||
.rot_init = gs232a_rot_init,
|
||||
.get_position = gs232a_rot_get_position,
|
||||
.set_position = gs232a_rot_set_position,
|
||||
.stop = gs232a_rot_stop,
|
||||
.stop = gs232a_rot_stop,
|
||||
.get_level = gs232a_rot_get_level,
|
||||
.set_level = gs232a_rot_set_level,
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
@ -384,10 +466,10 @@ const struct rot_caps gs232a_rot_caps =
|
|||
ROT_MODEL(ROT_MODEL_GS232A),
|
||||
.model_name = "GS-232A",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20201205.0",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rot_type = ROT_TYPE_OTHER,
|
||||
.rot_type = ROT_TYPE_AZEL,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 150,
|
||||
.serial_rate_max = 9600,
|
||||
|
@ -405,26 +487,125 @@ const struct rot_caps gs232a_rot_caps =
|
|||
.min_el = 0.0,
|
||||
.max_el = 180.0, /* requires G-5400B, G-5600B, G-5500, or G-500/G-550 */
|
||||
|
||||
.has_get_level = GS232A_LEVELS,
|
||||
.has_set_level = ROT_LEVEL_SET(GS232A_LEVELS),
|
||||
|
||||
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
||||
|
||||
.rot_init = gs232a_rot_init,
|
||||
.get_position = gs232a_rot_get_position,
|
||||
.set_position = gs232a_rot_set_position,
|
||||
.stop = gs232a_rot_stop,
|
||||
.stop = gs232a_rot_stop,
|
||||
.move = gs232a_rot_move,
|
||||
.get_level = gs232a_rot_get_level,
|
||||
.set_level = gs232a_rot_set_level,
|
||||
};
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Generic GS232A azimuth rotator capabilities.
|
||||
*/
|
||||
|
||||
const struct rot_caps gs232a_az_rot_caps =
|
||||
{
|
||||
ROT_MODEL(ROT_MODEL_GS232A_AZ),
|
||||
.model_name = "GS-232A azimuth",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rot_type = ROT_TYPE_AZIMUTH,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 150,
|
||||
.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,
|
||||
|
||||
.rot_init = gs232a_rot_init,
|
||||
.has_get_level = GS232A_LEVELS,
|
||||
.has_set_level = ROT_LEVEL_SET(GS232A_LEVELS),
|
||||
|
||||
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
||||
|
||||
.get_position = gs232a_rot_get_position,
|
||||
.set_position = gs232a_rot_set_position,
|
||||
.stop = gs232a_rot_stop,
|
||||
.move = gs232a_rot_move,
|
||||
.get_level = gs232a_rot_get_level,
|
||||
.set_level = gs232a_rot_set_level,
|
||||
};
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Generic GS232A elevation rotator capabilities.
|
||||
*/
|
||||
|
||||
const struct rot_caps gs232a_el_rot_caps =
|
||||
{
|
||||
ROT_MODEL(ROT_MODEL_GS232A_EL),
|
||||
.model_name = "GS-232A elevation",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rot_type = ROT_TYPE_ELEVATION,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 150,
|
||||
.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 = GS232A_LEVELS,
|
||||
.has_set_level = ROT_LEVEL_SET(GS232A_LEVELS),
|
||||
|
||||
.level_gran = { [ROT_LVL_SPEED] = { .min = { .i = 1 }, .max = { .i = 4 }, .step = { .i = 1 } } },
|
||||
|
||||
.rot_init = gs232a_rot_init,
|
||||
.get_position = gs232a_rot_get_position,
|
||||
.set_position = gs232a_rot_set_position,
|
||||
.stop = gs232a_rot_stop,
|
||||
.move = gs232a_rot_move,
|
||||
.get_level = gs232a_rot_get_level,
|
||||
.set_level = gs232a_rot_set_level,
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
DECLARE_INITROT_BACKEND(gs232a)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rot_register(&gs232a_rot_caps);
|
||||
rot_register(&gs232a_az_rot_caps);
|
||||
rot_register(&gs232a_el_rot_caps);
|
||||
rot_register(&gs232_generic_rot_caps);
|
||||
rot_register(&gs232b_rot_caps);
|
||||
rot_register(&gs232b_az_rot_caps);
|
||||
rot_register(&gs232b_el_rot_caps);
|
||||
rot_register(&f1tetracker_rot_caps);
|
||||
rot_register(&gs23_rot_caps);
|
||||
rot_register(&gs232_rot_caps);
|
||||
|
|
|
@ -23,8 +23,12 @@
|
|||
#define _ROT_GS232A_H 1
|
||||
|
||||
extern const struct rot_caps gs232a_rot_caps;
|
||||
extern const struct rot_caps gs232a_az_rot_caps;
|
||||
extern const struct rot_caps gs232a_el_rot_caps;
|
||||
extern const struct rot_caps gs232_generic_rot_caps;
|
||||
extern const struct rot_caps gs232b_rot_caps;
|
||||
extern const struct rot_caps gs232b_az_rot_caps;
|
||||
extern const struct rot_caps gs232b_el_rot_caps;
|
||||
extern const struct rot_caps f1tetracker_rot_caps;
|
||||
extern const struct rot_caps gs23_rot_caps;
|
||||
extern const struct rot_caps gs232_rot_caps;
|
||||
|
|
|
@ -27,26 +27,22 @@
|
|||
// cppcheck-suppress *
|
||||
#include <stdio.h>
|
||||
// cppcheck-suppress *
|
||||
#include <stdlib.h>
|
||||
// cppcheck-suppress *
|
||||
#include <string.h> /* String function definitions */
|
||||
// cppcheck-suppress *
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
// cppcheck-suppress *
|
||||
#include <math.h>
|
||||
|
||||
#include "hamlib/rotator.h"
|
||||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "register.h"
|
||||
|
||||
#include "gs232a.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#define EOM "\r"
|
||||
#define REPLY_EOM "\n"
|
||||
|
||||
#define BUFSZ 64
|
||||
|
||||
#define GS232B_LEVELS ROT_LEVEL_SPEED
|
||||
|
||||
/**
|
||||
* gs232b_transaction
|
||||
*
|
||||
|
@ -274,36 +270,85 @@ gs232b_rot_stop(ROT *rot)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
gs232b_rot_move(ROT *rot, int direction, int speed)
|
||||
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));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED:
|
||||
val->i = rs->current_speed;
|
||||
break;
|
||||
default:
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val)
|
||||
{
|
||||
struct rot_state *rs = &rot->state;
|
||||
char cmdstr[24];
|
||||
int retval;
|
||||
unsigned x_speed;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level));
|
||||
|
||||
switch (level) {
|
||||
case ROT_LEVEL_SPEED: {
|
||||
int speed = val.i;
|
||||
if (speed < 1) {
|
||||
speed = 1;
|
||||
} else if (speed > 4) {
|
||||
speed = 4;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
static int gs232b_rot_move(ROT *rot, int direction, int speed)
|
||||
{
|
||||
char cmdstr[24];
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __func__,
|
||||
direction, speed);
|
||||
|
||||
if (speed != ROT_SPEED_NOCHANGE) {
|
||||
value_t gs232b_speed;
|
||||
|
||||
if (speed < 1 || speed > 100)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
x_speed = (3 * speed) / 100 + 1;
|
||||
gs232b_speed.i = (3 * speed) / 100 + 1;
|
||||
|
||||
/* between 1 (slowest) and 4 (fastest) */
|
||||
sprintf(cmdstr, "X%u" EOM, x_speed);
|
||||
retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1);
|
||||
retval = gs232b_rot_set_level(rot, ROT_LEVEL_SPEED, gs232b_speed);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
rs->current_speed = speed;
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
|
@ -340,6 +385,20 @@ gs232b_rot_move(ROT *rot, int direction, int speed)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Generic GS232B rotator capabilities.
|
||||
|
@ -350,10 +409,10 @@ const struct rot_caps gs232b_rot_caps =
|
|||
ROT_MODEL(ROT_MODEL_GS232B),
|
||||
.model_name = "GS-232B",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20201202.0",
|
||||
.version = "20201203.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rot_type = ROT_TYPE_OTHER,
|
||||
.rot_type = ROT_TYPE_AZEL,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 1200,
|
||||
.serial_rate_max = 9600,
|
||||
|
@ -371,10 +430,110 @@ const struct rot_caps gs232b_rot_caps =
|
|||
.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,
|
||||
.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,
|
||||
.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,
|
||||
};
|
||||
|
||||
/* end of file */
|
||||
|
|
Ładowanie…
Reference in New Issue