Updated:
		Implemented basic functions for rotorez backend

	Added:
		Text file describing extended DCU protocol used by
		rotorez backend


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1346 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Nate Bargmann, N0NB 2003-01-12 14:29:15 +00:00
rodzic b2eb1793ec
commit f8748e3817
4 zmienionych plików z 383 dodań i 14 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - list of known rotators
* Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton
*
* $Id: rotlist.h,v 1.7 2003-01-11 00:48:43 n0nb Exp $
* $Id: rotlist.h,v 1.8 2003-01-12 14:29:14 n0nb Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -140,12 +140,12 @@ typedef int rot_model_t;
* and the branch name, which is a character string.
*/
#define ROT_BACKEND_LIST { \
{ ROT_DUMMY, ROT_BACKEND_DUMMY }, \
{ ROT_RPC, ROT_BACKEND_RPC }, \
{ ROT_EASYCOMM, ROT_BACKEND_EASYCOMM }, \
{ ROT_DUMMY, ROT_BACKEND_DUMMY }, \
{ ROT_RPC, ROT_BACKEND_RPC }, \
{ ROT_EASYCOMM, ROT_BACKEND_EASYCOMM }, \
{ ROT_FODTRACK, ROT_BACKEND_FODTRACK }, \
{ ROT_ROTOREZ, ROT_BACKEND_ROTOREZ }, \
{ 0, NULL }, /* end */ \
{ 0, NULL }, /* end */ \
}
/*

Wyświetl plik

@ -9,7 +9,7 @@
* supports the Hy-Gain DCU-1.
*
*
* $Id: rotorez.c,v 1.1 2003-01-11 00:47:48 n0nb Exp $
* $Id: rotorez.c,v 1.2 2003-01-12 14:29:14 n0nb Exp $
*
*
* This library is free software; you can redistribute it and/or
@ -55,15 +55,29 @@ struct rotorez_rot_priv_data {
azimuth_t az;
};
/*
* Private helper function prototypes
*/
static int rotorez_send_priv_cmd(ROT *rot, const char *cmd);
/* *************************************
*
* Seperate model capabilities
*
* *************************************
*/
/*
* Rotor-EZ enhanced rotor capabilities
*/
const struct rot_caps rotorez_rot_caps = {
.rot_model = ROT_MODEL_ROTOREZ,
.model_name = "Rotor-EZ",
.mfg_name = "Idiom Press",
.version = "0.1",
.version = "0.1.0",
.copyright = "LGPL",
.status = RIG_STATUS_NEW,
.rot_type = ROT_TYPE_OTHER,
@ -75,8 +89,8 @@ const struct rot_caps rotorez_rot_caps = {
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 0,
.timeout = 200,
.post_write_delay = 500,
.timeout = 5000,
.retry = 3,
.min_az = 0,
@ -86,15 +100,268 @@ const struct rot_caps rotorez_rot_caps = {
.priv = NULL, /* priv */
// .set_position = fodtrack_set_position,
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position,
.get_position = rotorez_rot_get_position,
.stop = rotorez_rot_stop,
};
int initrots_rotorez(void *be_handle) {
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n");
/*
* RotorCard enhanced rotor capabilities
*/
rot_register(&rotorez_rot_caps);
const struct rot_caps rotorcard_rot_caps = {
.rot_model = ROT_MODEL_ROTORCARD,
.model_name = "RotorCard",
.mfg_name = "Idiom Press",
.version = "0.1.0",
.copyright = "LGPL",
.status = RIG_STATUS_NEW,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 500,
.timeout = 5000,
.retry = 3,
.min_az = 0,
.max_az = 360,
.min_el = 0,
.max_el = 0,
.priv = NULL, /* priv */
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position,
.get_position = rotorez_rot_get_position,
.stop = rotorez_rot_stop,
};
/*
* Hy-Gain DCU-1/DCU-1X rotor capabilities
*/
const struct rot_caps dcu_rot_caps = {
.rot_model = ROT_MODEL_DCU,
.model_name = "DCU-1/DCU-1X",
.mfg_name = "Hy-Gain",
.version = "0.1.0",
.copyright = "LGPL",
.status = RIG_STATUS_NEW,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 1,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_NONE,
.write_delay = 0,
.post_write_delay = 500,
.timeout = 5000,
.retry = 3,
.min_az = 0,
.max_az = 360,
.min_el = 0,
.max_el = 0,
.priv = NULL, /* priv */
.rot_init = rotorez_rot_init,
.rot_cleanup = rotorez_rot_cleanup,
.set_position = rotorez_rot_set_position,
};
/* ************************************
*
* API functions
*
* ************************************
*/
/*
* Initialize data structures
*/
static int rotorez_rot_init(ROT *rot) {
struct rotorez_rot_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n", __func__);
if (!rot)
return -RIG_EINVAL;
priv = (struct rotorez_rot_priv_data*)
malloc(sizeof(struct rotorez_rot_priv_data));
if (!priv)
return -RIG_ENOMEM;
rot->state.priv = (void*)priv;
rot->state.rotport.type.rig = RIG_PORT_SERIAL;
priv->az = 0;
return RIG_OK;
}
/*
* Clean up allocated memory structures
*/
static int rotorez_rot_cleanup(ROT *rot) {
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n", __func__);
if (!rot)
return -RIG_EINVAL;
if (rot->state.priv)
free(rot->state.priv);
rot->state.priv = NULL;
return RIG_OK;
}
/*
* Set position
* DCU protocol supports azimuth only--elevation is ignored
* Range is an integer, 0 to 360 degrees
*/
static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation) {
unsigned char cmdstr[8];
unsigned char execstr[5] = "AM1;";
int err;
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n", __func__);
if (!rot)
return -RIG_EINVAL;
if (azimuth < 0 || azimuth > 360)
return -RIG_EINVAL;
sprintf(cmdstr, "AP1%03.0f;", azimuth); /* Target bearing */
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
return err;
err = rotorez_send_priv_cmd(rot, execstr); /* Execute command */
if (err != RIG_OK)
return err;
return RIG_OK;
}
/*
* Get position
* Returns current azimuth position in whole degrees.
* Range is an integer, 0 to 359 degrees
*/
static int rotorez_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation) {
struct rot_state *rs;
unsigned char cmdstr[5] = "AI1;";
unsigned char az[4];
int err;
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n", __func__);
if (!rot)
return -RIG_EINVAL;
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
return err;
rs = &rot->state;
err = read_block(&rs->rotport, az, AZ_READ_LEN);
if (err != AZ_READ_LEN)
return -RIG_ETRUNC;
*azimuth = (azimuth_t)atof(az);
if (*azimuth < 0 || *azimuth > 359)
return -RIG_EINVAL;
rig_debug(RIG_DEBUG_TRACE, "rotorez: azimuth = %.1f degrees\n", *azimuth);
return RIG_OK;
}
/*
* Stop rotation
*/
static int rotorez_rot_stop(ROT *rot) {
unsigned char cmdstr[2] = ";";
int err;
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n", __func__);
if (!rot)
return -RIG_EINVAL;
err = rotorez_send_priv_cmd(rot, cmdstr);
if (err != RIG_OK)
return err;
return RIG_OK;
}
/*
* Send command string to rotor
*/
static int rotorez_send_priv_cmd(ROT *rot, const char *cmdstr) {
struct rot_state *rs;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n", __func__);
if (!rot)
return -RIG_EINVAL;
rs = &rot->state;
err = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
if (err != RIG_OK)
return err;
return RIG_OK;
}
/*
* Initialize backend
*/
int initrots_rotorez(void *be_handle) {
rig_debug(RIG_DEBUG_VERBOSE, "rotorez: %s called\n", __func__);
rot_register(&rotorez_rot_caps);
rot_register(&rotorcard_rot_caps);
rot_register(&dcu_rot_caps);
return RIG_OK;
}

Wyświetl plik

@ -9,7 +9,7 @@
* supports the Hy-Gain DCU-1.
*
*
* $Id: rotorez.h,v 1.1 2003-01-11 00:47:48 n0nb Exp $
* $Id: rotorez.h,v 1.2 2003-01-12 14:29:14 n0nb Exp $
*
*
* This library is free software; you can redistribute it and/or
@ -31,9 +31,26 @@
#ifndef _ROT_ROTOREZ_H
#define _ROT_ROTOREZ_H 1
#define AZ_READ_LEN 3
extern const struct rot_caps rotorez_rot_caps;
extern const struct rot_caps rotorcard_rot_caps;
extern const struct rot_caps dcu_rot_caps;
extern BACKEND_EXPORT(int) initrots_rotorez(void *be_handle);
/*
* API local implementation
*
*/
static int rotorez_rot_init(ROT *rot);
static int rotorez_rot_cleanup(ROT *rot);
static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation);
static int rotorez_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation);
static int rotorez_rot_stop(ROT *rot);
#endif /* _ROT_ROTOREZ_H */

Wyświetl plik

@ -0,0 +1,85 @@
The following email describes the command set used by the Rotor-EZ
interface for Hy-Gain rotors and the RotorCard interface for Yaesu
rotors manufactured and sold by Idiom Press, http://www.idiompres.com
The Hy-Gain DCU-1/DCU-1X Digital Control Unit supports a subset of
these commands--AP1XXX; and AM1; The DCU-1/DCU-1X is manufactured
and sold by Hy-Gain, http://www.hy-gain.com
$Id: rotorez.txt,v 1.1 2003-01-12 14:29:15 n0nb Exp $
From: "sales@idiompress.com" <info@idiompress.com>
To: "Nate Bargmann" <n0nb@arrl.net>
Subject: Re: Rotor Card and Rotor-EZ command reference
Date: Fri, 10 Jan 2003 09:38:52 -0800
Here you go:
Important note: The program you are using must insert leading zeros into
bearing commands, such as "009" degrees, instead of "9" degrees. Most
programs are already configured this way, but some are not in their default
mode, and in such cases you must change the default setting or the RS-232
portion of Rotor-EZ will not work properly.
Rotor-EZ can also be commanded from any terminal having RS232 output, using
the following configuration: 4800 baud, 8,N,1 Note that upper case/lower
case must be used as listed for the commands below to work:
"AP1xxx<CR>" sets target bearing to "xxx" degrees where xxx are three digits
between 000 and 360, and executes. A typical command to rotate to 080
degrees would be AP1080<CR> Note that the <CR> is often labeled <Enter> on
many keyboards.
"AP1xxx;" sets the target bearing but does not execute.
"AM1;" executes rotation to the bearing set by the "AP1xxx;" command
"AI1;" inquires current bearing; and responds with (000-359) degrees
";" terminates rotation
"E" enable endpoint option - effective immediately
"e" disable endpoint option - effective immediately
"O" enable overshoot option - effective immediately
"o" disable overshoot option - effective immediately
"S" enable unstick option - effective immediately
"s" disable unstick option - effective immediately
"V" reports version number
"J" enable jam protection - effective immediately
"j" disable jam protection - effective immediately - NOT recommended!
Note that during any rotation initiated by an RS232 command, the rotation
can be halted and further rotation cancelled by a momentary press of the
Brake paddle. Also, an RS232 operation can be overridden by using the
pointing control during rotation; when the control is moved rotation will
cease and the control will wait for a new command after the five second
brake delay is completed.
73
----- Original Message -----
From: Nate Bargmann <n0nb@arrl.net>
To: <sales@idiompress.com>
Sent: Friday, January 10, 2003 8:23 AM
Subject: Rotor Card and Rotor-EZ command reference
> Hi!
>
> I am working with a software project called Hamlib
> http://hamlib.sourceforge.net and I would like to add support for the
> Rotor Card and Rotor-EZ into our library. In the course of several Web
> searches I have downloaded the Hy-Gain DCU-1 manual from their site and
> I've also visited the Digital Audio Rotor-EZ troubleshooting site.
> Between the two I have found a couple of descrepancies in the command
> set. If possible, I would like a copy of the complete command set and
> their syntax for these two boards for our project.
>
> Thanks!
>
> 73, de Nate >>
>