From 21a23fe5990ab97a01b3851593a193f40ee9cdc4 Mon Sep 17 00:00:00 2001 From: Alexander Schultze Date: Sun, 5 Apr 2015 16:27:27 +0200 Subject: [PATCH] easycomm: implement get/set config, easycom include status and error bytes, fix get_info --- easycomm/easycomm.c | 20 +++++++++++--------- easycomm/easycomm.h | 19 ++++++++++++------- easycomm/easycomm.txt | 40 +++++++++++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 25 deletions(-) diff --git a/easycomm/easycomm.c b/easycomm/easycomm.c index 3c147e516..35dc0a84e 100644 --- a/easycomm/easycomm.c +++ b/easycomm/easycomm.c @@ -2,6 +2,7 @@ * Hamlib Rotator backend - Easycom * Copyright (c) 2001-2003 by Stephane Fillod * Contributed by Francois Retief + * Copyright (c) 2014 by Alexander Schultze * * * 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) { char cmdstr[16], ackbuf[32]; - int err; + int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); 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); /* Return given string at correct position*/ - *val = &ackbuf[2]; /* CCxxxxxx */ + val = &ackbuf[2]; /* CCxxxxxx */ 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) { char cmdstr[16], ackbuf[32]; - int err; + int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); 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) { case TOK_SET_CONFIG: - sprintf(cmdstr, "CW%s\n;",*val); + sprintf(cmdstr, "CW%s\n;",val); break; default: return -RIG_EINVAL; @@ -365,7 +366,7 @@ const struct rot_caps easycomm1_rot_caps = { .rot_model = ROT_MODEL_EASYCOMM1, .model_name = "EasycommI", .mfg_name = "Hamlib", - .version = "0.3", + .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, @@ -400,7 +401,7 @@ const struct rot_caps easycomm2_rot_caps = { .rot_model = ROT_MODEL_EASYCOMM2, .model_name = "EasycommII", .mfg_name = "Hamlib", - .version = "0.3", + .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, @@ -434,7 +435,8 @@ const struct rot_caps easycomm2_rot_caps = { .park = easycomm_rot_park, .reset = easycomm_rot_reset, .move = easycomm_rot_move, - + .set_conf = easycomm_rot_set_conf, + .get_conf = easycomm_rot_get_conf, .get_info = easycomm_rot_get_info, }; @@ -444,7 +446,7 @@ const struct rot_caps easycomm3_rot_caps = { .rot_model = ROT_MODEL_EASYCOMM3, .model_name = "EasycommIII", .mfg_name = "Hamlib", - .version = "0.3", + .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rot_type = ROT_TYPE_OTHER, @@ -479,7 +481,7 @@ const struct rot_caps easycomm3_rot_caps = { .reset = easycomm_rot_reset, .move = easycomm_rot_move_velocity, .set_conf = easycomm_rot_set_conf, - .get_conf = easycomm_rot_set_conf, + .get_conf = easycomm_rot_get_conf, .get_info = easycomm_rot_get_info, }; diff --git a/easycomm/easycomm.h b/easycomm/easycomm.h index 74ec26159..f4e80e019 100644 --- a/easycomm/easycomm.h +++ b/easycomm/easycomm.h @@ -2,6 +2,7 @@ * Hamlib Rotator backend - Easycomm interface protocol * Copyright (c) 2001-2003 by Stephane Fillod * Contributed by Francois Retief + * Copyright (c) 2014 by Alexander Schultze * * * This library is free software; you can redistribute it and/or @@ -23,6 +24,8 @@ #ifndef _ROT_EASYCOMM_H #define _ROT_EASYCOMM_H 1 +#include "token.h" + extern const struct rot_caps easycomm1_rot_caps; extern const struct rot_caps easycomm2_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 * 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) + +#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 */ diff --git a/easycomm/easycomm.txt b/easycomm/easycomm.txt index 4e1424441..05ad36773 100644 --- a/easycomm/easycomm.txt +++ b/easycomm/easycomm.txt @@ -88,25 +88,47 @@ EASYCOMM III Standard 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] 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] +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: -A proposed configuration of configuration registers: Register Meaning Value ------- ------- ---------- -0 MaxSpeed number +0 MaxSpeed number a Overshoot 0/1/- b Jamming 0/1/- c Endpoints 0/1/- d Unstick 0/1/- -73, Alexander Schultze \ No newline at end of file +73, Alexander Schultze