update EasyComm3 to include setting and getting of config and status

Hamlib-3.0
Alexander Schultze 2015-04-04 18:01:03 +02:00
rodzic d22d83122b
commit 3c924ddd28
3 zmienionych plików z 134 dodań i 15 usunięć

Wyświetl plik

@ -241,24 +241,115 @@ easycomm_rot_move_velocity(ROT *rot, int direction, int speed)
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)
{
char cmdstr[16], ackbuf[32];
int retval;
const struct rot_caps *rc;
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
sprintf(cmdstr, "IN\n");
if (!rot)
return (const char *)-RIG_EINVAL;
retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf));
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];
int err;
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);
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;
}
/* Parse parse string to extract AZ,EL values */
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 err;
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;
}
/* ************************************************************************* */
@ -299,6 +390,7 @@ const struct rot_caps easycomm1_rot_caps = {
.set_position = easycomm_rot_set_position,
.stop = easycomm_rot_stop,
.get_info = easycomm_rot_get_info,
};
/* EasycommII implement most of the functions. Again the radio tags
@ -343,7 +435,7 @@ const struct rot_caps easycomm2_rot_caps = {
.reset = easycomm_rot_reset,
.move = easycomm_rot_move,
.get_info = NULL,
.get_info = easycomm_rot_get_info,
};
/* EasycommIII provides changes Moving functions and info.
@ -386,8 +478,9 @@ const struct rot_caps easycomm3_rot_caps = {
.park = easycomm_rot_park,
.reset = easycomm_rot_reset,
.move = easycomm_rot_move_velocity,
.get_info = NULL,
.set_conf = easycomm_rot_set_conf,
.get_conf = easycomm_rot_set_conf,
.get_info = easycomm_rot_get_info,
};
/* ************************************************************************* */

Wyświetl plik

@ -27,4 +27,17 @@ extern const struct rot_caps easycomm1_rot_caps;
extern const struct rot_caps easycomm2_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_STATUS TOKEN_BACKEND(1)
#define TOK_GET_ERROR TOKEN_BACKEND(2)
#define TOK_GET_VERSION TOKEN_BACKEND(3)
#define TOK_GET_INPUT TOKEN_BACKEND(4)
#define TOK_GET_ANALOG_INPUT TOKEN_BACKEND(5)
#define TOK_GET_CONFIG TOKEN_BACKEND(6)
#define TOK_SET_CONFIG TOKEN_BACKEND(7)
#endif /* _ROT_EASYCOMM_H */

Wyświetl plik

@ -1,6 +1,5 @@
The following are the specifications for the EasyComm interfaces which
are available with the WiSP programs. Both EasyComm 1 and EasyComm2 are
available in WiSP32. Only EasyComm1 is available with WiSP31. The EasyComm
are available with the WiSP programs. The EasyComm
interfaces are for use by those who wish to design their own radio and rotor
controllers.
@ -91,9 +90,23 @@ The EasyComm 3 standard is an extension of the version 2 with the additional fea
Command Meaning Perameters
------- ------- ----------
IN Get Status string
VL Velocity Left number [mdeg/s]
VR Velocity Right number [mdeg/s]
VU Velocity Up number [mdeg/s]
VD Velocity Down number [mdeg/s]
GS Get status register
GE Get error register
CR Read config register [0-255]
CW Write config register [0-255]
A proposed configuration 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