kopia lustrzana https://github.com/Hamlib/Hamlib
Merge pull request #7 from alexschultze/master
Rework of easycomm, fix get_info, implement get and set config features seperatelyHamlib-3.0
commit
feda2e4834
|
@ -2,6 +2,7 @@
|
||||||
* Hamlib Rotator backend - Easycom
|
* Hamlib Rotator backend - Easycom
|
||||||
* Copyright (c) 2001-2003 by Stephane Fillod
|
* Copyright (c) 2001-2003 by Stephane Fillod
|
||||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
|
@ -241,24 +242,115 @@ easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
easycomm_rot_get_info(ROT *rot)
|
/*
|
||||||
|
* Get Info
|
||||||
|
* returns the model name string
|
||||||
|
*/
|
||||||
|
static const char * easycomm_rot_get_info(ROT *rot)
|
||||||
{
|
{
|
||||||
|
const struct rot_caps *rc;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
if (!rot)
|
||||||
|
return (const char *)-RIG_EINVAL;
|
||||||
|
|
||||||
|
rc = rot->caps;
|
||||||
|
|
||||||
|
return rc->model_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Receive status / configuration / output
|
||||||
|
*
|
||||||
|
* For configuration registers, *val must contain string of register e.g. '0'-'f'
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int easycomm_rot_get_conf(ROT *rot, token_t token, char *val) {
|
||||||
char cmdstr[16], ackbuf[32];
|
char cmdstr[16], ackbuf[32];
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token);
|
||||||
|
|
||||||
|
if (!rot)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
switch(token) {
|
||||||
|
case TOK_GET_STATUS:
|
||||||
|
sprintf(cmdstr, "GS\n;");
|
||||||
|
break;
|
||||||
|
case TOK_GET_ERRORS:
|
||||||
|
sprintf(cmdstr, "GE\n;");
|
||||||
|
break;
|
||||||
|
case TOK_GET_INPUT:
|
||||||
|
sprintf(cmdstr, "IP\n;");
|
||||||
|
break;
|
||||||
|
case TOK_GET_ANALOG_INPUT:
|
||||||
|
sprintf(cmdstr, "AN\n;");
|
||||||
|
break;
|
||||||
|
case TOK_GET_VERSION:
|
||||||
|
sprintf(cmdstr, "VE\n;");
|
||||||
|
break;
|
||||||
|
case TOK_GET_CONFIG:
|
||||||
|
sprintf(cmdstr, "CR %c\n;",*val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
|
||||||
|
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n", __func__, cmdstr, *val);
|
||||||
|
|
||||||
|
|
||||||
sprintf(cmdstr, "IN\n");
|
|
||||||
|
|
||||||
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
||||||
|
|
||||||
if (retval != RIG_OK) {
|
if (retval != RIG_OK) {
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __FUNCTION__, retval);
|
rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __FUNCTION__, retval);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse parse string to extract AZ,EL values */
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s got response: %s\n", __FUNCTION__, ackbuf);
|
rig_debug(RIG_DEBUG_TRACE, "%s got response: %s\n", __FUNCTION__, ackbuf);
|
||||||
return ackbuf;
|
/* Return given string at correct position*/
|
||||||
|
val = &ackbuf[2]; /* CCxxxxxx */
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set configuration
|
||||||
|
*
|
||||||
|
* For configuration registers, *val must contain char of register e.g. '0'-'f' followed by setting
|
||||||
|
* e.g. x,yyyyy
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int easycomm_rot_set_conf(ROT *rot, token_t token, const char *val) {
|
||||||
|
char cmdstr[16], ackbuf[32];
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token);
|
||||||
|
|
||||||
|
if (!rot)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
switch(token) {
|
||||||
|
case TOK_SET_CONFIG:
|
||||||
|
sprintf(cmdstr, "CW%s\n;",val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n", __func__, cmdstr, *val);
|
||||||
|
|
||||||
|
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
|
||||||
|
|
||||||
|
if (retval != RIG_OK) {
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __FUNCTION__, retval);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
@ -274,7 +366,7 @@ const struct rot_caps easycomm1_rot_caps = {
|
||||||
.rot_model = ROT_MODEL_EASYCOMM1,
|
.rot_model = ROT_MODEL_EASYCOMM1,
|
||||||
.model_name = "EasycommI",
|
.model_name = "EasycommI",
|
||||||
.mfg_name = "Hamlib",
|
.mfg_name = "Hamlib",
|
||||||
.version = "0.3",
|
.version = "0.4",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_BETA,
|
.status = RIG_STATUS_BETA,
|
||||||
.rot_type = ROT_TYPE_OTHER,
|
.rot_type = ROT_TYPE_OTHER,
|
||||||
|
@ -299,6 +391,7 @@ const struct rot_caps easycomm1_rot_caps = {
|
||||||
|
|
||||||
.set_position = easycomm_rot_set_position,
|
.set_position = easycomm_rot_set_position,
|
||||||
.stop = easycomm_rot_stop,
|
.stop = easycomm_rot_stop,
|
||||||
|
.get_info = easycomm_rot_get_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* EasycommII implement most of the functions. Again the radio tags
|
/* EasycommII implement most of the functions. Again the radio tags
|
||||||
|
@ -308,7 +401,7 @@ const struct rot_caps easycomm2_rot_caps = {
|
||||||
.rot_model = ROT_MODEL_EASYCOMM2,
|
.rot_model = ROT_MODEL_EASYCOMM2,
|
||||||
.model_name = "EasycommII",
|
.model_name = "EasycommII",
|
||||||
.mfg_name = "Hamlib",
|
.mfg_name = "Hamlib",
|
||||||
.version = "0.3",
|
.version = "0.4",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_BETA,
|
.status = RIG_STATUS_BETA,
|
||||||
.rot_type = ROT_TYPE_OTHER,
|
.rot_type = ROT_TYPE_OTHER,
|
||||||
|
@ -342,8 +435,9 @@ const struct rot_caps easycomm2_rot_caps = {
|
||||||
.park = easycomm_rot_park,
|
.park = easycomm_rot_park,
|
||||||
.reset = easycomm_rot_reset,
|
.reset = easycomm_rot_reset,
|
||||||
.move = easycomm_rot_move,
|
.move = easycomm_rot_move,
|
||||||
|
.set_conf = easycomm_rot_set_conf,
|
||||||
.get_info = NULL,
|
.get_conf = easycomm_rot_get_conf,
|
||||||
|
.get_info = easycomm_rot_get_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* EasycommIII provides changes Moving functions and info.
|
/* EasycommIII provides changes Moving functions and info.
|
||||||
|
@ -352,7 +446,7 @@ const struct rot_caps easycomm3_rot_caps = {
|
||||||
.rot_model = ROT_MODEL_EASYCOMM3,
|
.rot_model = ROT_MODEL_EASYCOMM3,
|
||||||
.model_name = "EasycommIII",
|
.model_name = "EasycommIII",
|
||||||
.mfg_name = "Hamlib",
|
.mfg_name = "Hamlib",
|
||||||
.version = "0.3",
|
.version = "0.4",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_ALPHA,
|
.status = RIG_STATUS_ALPHA,
|
||||||
.rot_type = ROT_TYPE_OTHER,
|
.rot_type = ROT_TYPE_OTHER,
|
||||||
|
@ -386,8 +480,9 @@ const struct rot_caps easycomm3_rot_caps = {
|
||||||
.park = easycomm_rot_park,
|
.park = easycomm_rot_park,
|
||||||
.reset = easycomm_rot_reset,
|
.reset = easycomm_rot_reset,
|
||||||
.move = easycomm_rot_move_velocity,
|
.move = easycomm_rot_move_velocity,
|
||||||
|
.set_conf = easycomm_rot_set_conf,
|
||||||
.get_info = NULL,
|
.get_conf = easycomm_rot_get_conf,
|
||||||
|
.get_info = easycomm_rot_get_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* Hamlib Rotator backend - Easycomm interface protocol
|
* Hamlib Rotator backend - Easycomm interface protocol
|
||||||
* Copyright (c) 2001-2003 by Stephane Fillod
|
* Copyright (c) 2001-2003 by Stephane Fillod
|
||||||
* Contributed by Francois Retief <fgretief@sun.ac.za>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
|
@ -23,8 +24,25 @@
|
||||||
#ifndef _ROT_EASYCOMM_H
|
#ifndef _ROT_EASYCOMM_H
|
||||||
#define _ROT_EASYCOMM_H 1
|
#define _ROT_EASYCOMM_H 1
|
||||||
|
|
||||||
|
#include "token.h"
|
||||||
|
|
||||||
extern const struct rot_caps easycomm1_rot_caps;
|
extern const struct rot_caps easycomm1_rot_caps;
|
||||||
extern const struct rot_caps easycomm2_rot_caps;
|
extern const struct rot_caps easycomm2_rot_caps;
|
||||||
extern const struct rot_caps easycomm3_rot_caps;
|
extern const struct rot_caps easycomm3_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_EASYCOMM_H */
|
#endif /* _ROT_EASYCOMM_H */
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
The following are the specifications for the EasyComm interfaces which
|
The following are the specifications for the EasyComm interfaces which
|
||||||
are available with the WiSP programs. Both EasyComm 1 and EasyComm2 are
|
are available with the WiSP programs. The EasyComm
|
||||||
available in WiSP32. Only EasyComm1 is available with WiSP31. The EasyComm
|
|
||||||
interfaces are for use by those who wish to design their own radio and rotor
|
interfaces are for use by those who wish to design their own radio and rotor
|
||||||
controllers.
|
controllers.
|
||||||
|
|
||||||
|
@ -89,11 +88,47 @@ EASYCOMM III Standard
|
||||||
The EasyComm 3 standard is an extension of the version 2 with the additional features:
|
The EasyComm 3 standard is an extension of the version 2 with the additional features:
|
||||||
|
|
||||||
|
|
||||||
Command Meaning Perameters
|
Command Meaning Perameters Hamlib Config Token
|
||||||
------- ------- ----------
|
------- ------- ---------- -------------------
|
||||||
|
|
||||||
IN Get Status string
|
|
||||||
VL Velocity Left number [mdeg/s]
|
VL Velocity Left number [mdeg/s]
|
||||||
VR Velocity Right number [mdeg/s]
|
VR Velocity Right number [mdeg/s]
|
||||||
VU Velocity Up number [mdeg/s]
|
VU Velocity Up number [mdeg/s]
|
||||||
VD Velocity Down number [mdeg/s]
|
VD Velocity Down number [mdeg/s]
|
||||||
|
CR Read config register [0-x] 1
|
||||||
|
CW Write config register [0-x] 2
|
||||||
|
GS Get status register 3
|
||||||
|
GE Get error register 4
|
||||||
|
|
||||||
|
VE Request Version 5
|
||||||
|
IP Read an input number 6
|
||||||
|
OP Set output number 7
|
||||||
|
AN Read analogue input number 8
|
||||||
|
|
||||||
|
|
||||||
|
>Several status and error bits can combined. Proposed mapping:
|
||||||
|
|
||||||
|
Status Meaning
|
||||||
|
------- -------
|
||||||
|
1 Idle
|
||||||
|
2 Moving
|
||||||
|
4 Pointing
|
||||||
|
8 Error
|
||||||
|
|
||||||
|
Error Meaning
|
||||||
|
------- -------
|
||||||
|
1 Sensor Error
|
||||||
|
2 Jam
|
||||||
|
4 Homing Error
|
||||||
|
|
||||||
|
>Proposed mapping of configuration registers:
|
||||||
|
|
||||||
|
Register Meaning Value
|
||||||
|
------- ------- ----------
|
||||||
|
0 MaxSpeed number
|
||||||
|
a Overshoot 0/1/-
|
||||||
|
b Jamming 0/1/-
|
||||||
|
c Endpoints 0/1/-
|
||||||
|
d Unstick 0/1/-
|
||||||
|
|
||||||
|
|
||||||
|
73, Alexander Schultze
|
||||||
|
|
Ładowanie…
Reference in New Issue