easycomm: implement get/set config, easycom include status and error bytes, fix get_info

Hamlib-3.0
Alexander Schultze 2015-04-05 16:27:27 +02:00
rodzic 3c924ddd28
commit 21a23fe599
3 zmienionych plików z 54 dodań i 25 usunięć

Wyświetl plik

@ -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
@ -267,7 +268,7 @@ static const char * easycomm_rot_get_info(ROT *rot)
static int easycomm_rot_get_conf(ROT *rot, token_t token, char *val) { static int easycomm_rot_get_conf(ROT *rot, token_t token, char *val) {
char cmdstr[16], ackbuf[32]; char cmdstr[16], ackbuf[32];
int err; int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token); rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token);
@ -313,7 +314,7 @@ static int easycomm_rot_get_conf(ROT *rot, token_t token, char *val) {
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 given string at correct position*/ /* Return given string at correct position*/
*val = &ackbuf[2]; /* CCxxxxxx */ val = &ackbuf[2]; /* CCxxxxxx */
return RIG_OK; return RIG_OK;
} }
@ -326,7 +327,7 @@ static int easycomm_rot_get_conf(ROT *rot, token_t token, char *val) {
static int easycomm_rot_set_conf(ROT *rot, token_t token, const char *val) { static int easycomm_rot_set_conf(ROT *rot, token_t token, const char *val) {
char cmdstr[16], ackbuf[32]; char cmdstr[16], ackbuf[32];
int err; int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token); rig_debug(RIG_DEBUG_TRACE, "%s: token = %d", __func__, token);
@ -336,7 +337,7 @@ static int easycomm_rot_set_conf(ROT *rot, token_t token, const char *val) {
switch(token) { switch(token) {
case TOK_SET_CONFIG: case TOK_SET_CONFIG:
sprintf(cmdstr, "CW%s\n;",*val); sprintf(cmdstr, "CW%s\n;",val);
break; break;
default: default:
return -RIG_EINVAL; return -RIG_EINVAL;
@ -365,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,
@ -400,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,
@ -434,7 +435,8 @@ 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_conf = easycomm_rot_get_conf,
.get_info = easycomm_rot_get_info, .get_info = easycomm_rot_get_info,
}; };
@ -444,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,
@ -479,7 +481,7 @@ const struct rot_caps easycomm3_rot_caps = {
.reset = easycomm_rot_reset, .reset = easycomm_rot_reset,
.move = easycomm_rot_move_velocity, .move = easycomm_rot_move_velocity,
.set_conf = easycomm_rot_set_conf, .set_conf = easycomm_rot_set_conf,
.get_conf = easycomm_rot_set_conf, .get_conf = easycomm_rot_get_conf,
.get_info = easycomm_rot_get_info, .get_info = easycomm_rot_get_info,
}; };

Wyświetl plik

@ -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,6 +24,8 @@
#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;
@ -31,13 +34,15 @@ extern const struct rot_caps easycomm3_rot_caps;
* Tokens used by rotorez_rot_set_conf and get_conf and the 'C' command in rotctl * Tokens used by rotorez_rot_set_conf and get_conf and the 'C' command in rotctl
* and rotctld. * and rotctld.
*/ */
#define TOK_GET_STATUS TOKEN_BACKEND(1)
#define TOK_GET_ERROR TOKEN_BACKEND(2) #define TOK_GET_CONFIG TOKEN_BACKEND(1)
#define TOK_GET_VERSION TOKEN_BACKEND(3) #define TOK_SET_CONFIG TOKEN_BACKEND(2)
#define TOK_GET_INPUT TOKEN_BACKEND(4) #define TOK_GET_STATUS TOKEN_BACKEND(3)
#define TOK_GET_ANALOG_INPUT TOKEN_BACKEND(5) #define TOK_GET_ERRORS TOKEN_BACKEND(4)
#define TOK_GET_CONFIG TOKEN_BACKEND(6) #define TOK_GET_VERSION TOKEN_BACKEND(5)
#define TOK_SET_CONFIG TOKEN_BACKEND(7) #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 */

Wyświetl plik

@ -88,18 +88,40 @@ 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
------- ------- ---------- ------- ------- ---------- -------------------
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]
GS Get status register CR Read config register [0-x] 1
GE Get error register CW Write config register [0-x] 2
CR Read config register [0-255] GS Get status register 3
CW Write config register [0-255] 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:
A proposed configuration of configuration registers:
Register Meaning Value Register Meaning Value
------- ------- ---------- ------- ------- ----------
0 MaxSpeed number 0 MaxSpeed number