kopia lustrzana https://github.com/Hamlib/Hamlib
add rotator Celestron/Orion Teletrack Az-G telescope mount
rodzic
89888b3041
commit
be74cf0f54
4
AUTHORS
4
AUTHORS
|
@ -211,6 +211,10 @@ M: Jacob Heder
|
|||
|
||||
|
||||
Rotators
|
||||
[celestron]
|
||||
M: Stephane Fillod, F8CFE
|
||||
C: Eric/N3KQX
|
||||
|
||||
[easycomm]
|
||||
M: Luc Langehegermann, LX2GT
|
||||
C: Francois Retief
|
||||
|
|
|
@ -18,7 +18,7 @@ DIST_SUBDIRS = macros include lib $(subdirs) src c++ bindings tests doc \
|
|||
icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \
|
||||
rpcrig winradio easycomm fodtrack rpcrot drake rotorez \
|
||||
flexradio sartek lowe rft rs tapr kit skanti prm80 wj racal tuner \
|
||||
gs232a heathkit spid ars m2 amsat scripts ts7400
|
||||
gs232a heathkit spid ars m2 amsat scripts ts7400 celestron
|
||||
|
||||
rpm: Makefile dist
|
||||
$(RPMBUILD) -ta $(PACKAGE)-$(VERSION).tar.gz
|
||||
|
|
4
NEWS
4
NEWS
|
@ -5,6 +5,10 @@ Copyright (C) 2000-2011 Stephane Fillod, and others
|
|||
|
||||
Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
|
||||
|
||||
Version 1.2.15
|
||||
* New rotator backends: Celestron (telescope mount)
|
||||
* Fixes and features: K3
|
||||
|
||||
Version 1.2.14
|
||||
2011-08-01
|
||||
* New models: SigFox Transfox, TH-D72A, IC-7410, IC-9100, IC-R9500, KX3,
|
||||
|
|
|
@ -91,6 +91,10 @@
|
|||
%ignore ROT_BACKEND_ARS;
|
||||
%ignore ROT_AMSAT;
|
||||
%ignore ROT_BACKEND_AMSAT;
|
||||
%ignore ROT_TS7400;
|
||||
%ignore ROT_BACKEND_TS7400;
|
||||
%ignore ROT_CELESTRON;
|
||||
%ignore ROT_BACKEND_CELESTRON;
|
||||
|
||||
%ignore PRIfreq;
|
||||
%ignore SCNfreq;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
pkglib_LTLIBRARIES = hamlib-celestron.la
|
||||
hamlib_celestron_la_SOURCES = celestron.c
|
||||
hamlib_celestron_la_LDFLAGS = -no-undefined -module -avoid-version
|
||||
hamlib_celestron_la_LIBADD = $(top_builddir)/src/libhamlib.la
|
||||
|
||||
noinst_HEADERS = celestron.h
|
|
@ -0,0 +1,248 @@
|
|||
/*
|
||||
* Hamlib Rotator backend - Celestron
|
||||
* Copyright (c) 2011 by Stephane Fillod
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "hamlib/rotator.h"
|
||||
#include "serial.h"
|
||||
#include "misc.h"
|
||||
#include "register.h"
|
||||
|
||||
#include "celestron.h"
|
||||
|
||||
#define ACK "#"
|
||||
|
||||
#define BUFSZ 128
|
||||
|
||||
/**
|
||||
* celestron_transaction
|
||||
*
|
||||
* cmdstr - Command to be sent to the rig.
|
||||
* data - Buffer for reply string. Can be NULL, indicating that no reply is
|
||||
* is needed, but answer will still be read.
|
||||
* data_len - in: Size of buffer. It is the caller's responsibily to provide
|
||||
* a large enough buffer for all possible replies for a command.
|
||||
*
|
||||
* returns:
|
||||
* RIG_OK - if no error occured.
|
||||
* RIG_EIO - if an I/O error occured while sending/receiving data.
|
||||
* RIG_ETIMEOUT - if timeout expires without any characters received.
|
||||
*/
|
||||
static int
|
||||
celestron_transaction (ROT *rot, const char *cmdstr,
|
||||
char *data, size_t data_len)
|
||||
{
|
||||
struct rot_state *rs;
|
||||
int retval;
|
||||
int retry_read = 0;
|
||||
char replybuf[BUFSZ];
|
||||
|
||||
rs = &rot->state;
|
||||
|
||||
transaction_write:
|
||||
|
||||
serial_flush(&rs->rotport);
|
||||
|
||||
if (cmdstr) {
|
||||
retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr));
|
||||
if (retval != RIG_OK)
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
/* Always read the reply to know whether the cmd went OK */
|
||||
if (!data)
|
||||
data = replybuf;
|
||||
if (!data_len)
|
||||
data_len = BUFSZ;
|
||||
|
||||
/* the answer */
|
||||
memset(data,0,data_len);
|
||||
retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK));
|
||||
if (retval < 0) {
|
||||
if (retry_read++ < rot->state.rotport.retry)
|
||||
goto transaction_write;
|
||||
goto transaction_quit;
|
||||
}
|
||||
|
||||
/* check for acknowledge */
|
||||
if (retval < 1 || data[retval-1] != '#') {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unexpected response, len %d: '%s'\n", __func__, retval, data);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
data[retval-1] = '\0';
|
||||
|
||||
retval = RIG_OK;
|
||||
transaction_quit:
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
celestron_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
||||
{
|
||||
char cmdstr[32];
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el);
|
||||
|
||||
/*
|
||||
Note: if the telescope has not been aligned, the RA/DEC values will not be meaningful and the AZM-ALT values will
|
||||
be relative to where the telescope was powered on. After alignment, RA/DEC values will reflect the actual sky,
|
||||
azimuth will be indexed to North equals 0 and altitude will be indexed with 0 equal to the orientation where the optical
|
||||
tube is perpendicular to the azimuth axis.
|
||||
*/
|
||||
|
||||
sprintf(cmdstr, "B%04X,%04X",
|
||||
(unsigned)((az/360.)*65535),
|
||||
(unsigned)((el/360.)*65535));
|
||||
|
||||
retval = celestron_transaction(rot, cmdstr, NULL, 0);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
celestron_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
||||
{
|
||||
char posbuf[32];
|
||||
int retval;
|
||||
unsigned w;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
/* Get Azm-Alt */
|
||||
retval = celestron_transaction(rot, "Z" , posbuf, sizeof(posbuf));
|
||||
if (retval != RIG_OK || strlen(posbuf) < 9 || posbuf[4] != ',') {
|
||||
return retval < 0 ? retval : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if (sscanf(posbuf, "%04X", &w) != 1)
|
||||
return -RIG_EPROTO;
|
||||
|
||||
*az = ((azimuth_t)w*360.)/65536.;
|
||||
|
||||
if (sscanf(posbuf+5, "%04X", &w) != 1)
|
||||
return -RIG_EPROTO;
|
||||
|
||||
*el = ((elevation_t)w*360.)/65536.;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n",
|
||||
__func__, *az, *el);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
celestron_stop(ROT *rot)
|
||||
{
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
/* Cancel Goto */
|
||||
retval = celestron_transaction(rot, "M", NULL, 0);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static const char *
|
||||
celestron_get_info(ROT *rot)
|
||||
{
|
||||
static char info[16];
|
||||
char str[8];
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
if (celestron_transaction(rot, "V", str, sizeof(str)) != RIG_OK)
|
||||
return NULL;
|
||||
|
||||
sprintf(info, "V%c.%c", str[0], str[1]);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
/*
|
||||
* Celestron Nexstar telescope(rotator) capabilities.
|
||||
*
|
||||
* Protocol documentation:
|
||||
* from Celestron:
|
||||
* http://www.celestron.com/c3/images/files/downloads/1154108406_nexstarcommprot.pdf
|
||||
* from Orion Teletrack Az-G:
|
||||
* http://content.telescope.com/rsc/img/catalog/product/instructions/29295.pdf
|
||||
*/
|
||||
|
||||
const struct rot_caps nexstar_rot_caps = {
|
||||
.rot_model = ROT_MODEL_NEXSTAR,
|
||||
.model_name = "NexStar", // Any Celestron starting with version 1.2
|
||||
.mfg_name = "Celestron",
|
||||
.version = "0.1",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_UNTESTED,
|
||||
.rot_type = ROT_TYPE_AZEL,
|
||||
.port_type = RIG_PORT_SERIAL,
|
||||
.serial_rate_min = 9600,
|
||||
.serial_rate_max = 9600,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 1,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 0,
|
||||
.post_write_delay = 0,
|
||||
.timeout = 3500, /* worst case scenario */
|
||||
.retry = 1,
|
||||
|
||||
.min_az = 0.0,
|
||||
.max_az = 360.0,
|
||||
.min_el = 0.0,
|
||||
.max_el = 180.0,
|
||||
|
||||
.get_position = celestron_get_position,
|
||||
.set_position = celestron_set_position,
|
||||
.stop = celestron_stop,
|
||||
.get_info = celestron_get_info,
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
DECLARE_INITROT_BACKEND(celestron)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__);
|
||||
|
||||
rot_register(&nexstar_rot_caps);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* end of file */
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Hamlib Rotator backend - Celestron interface protocol
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ROT_CELESTRON_H
|
||||
#define _ROT_CELESTRON_H 1
|
||||
|
||||
extern const struct rot_caps nexstar_rot_caps;
|
||||
|
||||
#endif /* _ROT_CELESTRON_H */
|
|
@ -259,7 +259,7 @@ AC_SUBST(RIGMATRIX)
|
|||
|
||||
|
||||
BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe rft rs kit skanti prm80 tapr flexradio wj racal tuner"
|
||||
ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2 amsat ts7400"
|
||||
ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2 amsat ts7400 celestron"
|
||||
BINDINGS=""
|
||||
BINDING_ALL=""
|
||||
BINDING_CHECK=""
|
||||
|
@ -540,6 +540,7 @@ flexradio/Makefile
|
|||
m2/Makefile
|
||||
amsat/Makefile
|
||||
ts7400/Makefile
|
||||
celestron/Makefile
|
||||
scripts/Makefile
|
||||
hamlib.pc
|
||||
hamlib.spec]
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#define ROT_BACKEND_EASYCOMM "easycomm"
|
||||
#define ROT_MODEL_EASYCOMM1 ROT_MAKE_MODEL(ROT_EASYCOMM, 1)
|
||||
#define ROT_MODEL_EASYCOMM2 ROT_MAKE_MODEL(ROT_EASYCOMM, 2)
|
||||
#define ROT_MODEL_TRAKBOX ROT_MAKE_MODEL(ROT_EASYCOMM, 3)
|
||||
|
||||
/*! \def ROT_MODEL_FODTRACK
|
||||
* \brief A macro that returns the model number of the Fodtrack backend.
|
||||
|
@ -264,6 +265,16 @@
|
|||
#define ROT_BACKEND_TS7400 "ts7400"
|
||||
#define ROT_MODEL_TS7400 ROT_MAKE_MODEL(ROT_TS7400, 1)
|
||||
|
||||
/*! \def ROT_MODEL_NEXSTAR
|
||||
* \brief A macro that returns the model number of the NEXSTAR backend.
|
||||
*
|
||||
* The CELESTRON backend can be used with rotators that support the Celestron
|
||||
* protocol and alike.
|
||||
*/
|
||||
#define ROT_CELESTRON 14
|
||||
#define ROT_BACKEND_CELESTRON "celestron"
|
||||
#define ROT_MODEL_NEXSTAR ROT_MAKE_MODEL(ROT_CELESTRON, 1)
|
||||
|
||||
|
||||
/*! \typedef typedef int rot_model_t
|
||||
\brief Convenience type definition for rotator model.
|
||||
|
@ -292,6 +303,7 @@ typedef int rot_model_t;
|
|||
{ ROT_ARS, ROT_BACKEND_ARS }, \
|
||||
{ ROT_AMSAT, ROT_BACKEND_AMSAT }, \
|
||||
{ ROT_TS7400, ROT_BACKEND_TS7400 }, \
|
||||
{ ROT_CELESTRON, ROT_BACKEND_CELESTRON }, \
|
||||
{ 0, NULL }, /* end */ \
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue