diff --git a/CMakeLists.txt b/CMakeLists.txt index 5067c0f39..b6ca39e9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -379,11 +379,6 @@ if (WITH_EQMOD) add_subdirectory(indi-eqmod) endif(WITH_EQMOD) -## AstroLink4 -if (WITH_ASTROLINK4) -add_subdirectory(indi-astrolink4) -endif(WITH_ASTROLINK4) - ## SkyWalker if (WITH_SKYWALKER) add_subdirectory(indi-aok) @@ -424,11 +419,6 @@ if (WITH_ROLLOFFINO) add_subdirectory(indi-rolloffino) endif(WITH_ROLLOFFINO) -## SpectraCyber -if (WITH_SPECTRACYBER) -add_subdirectory(indi-spectracyber) -endif(WITH_SPECTRACYBER) - ## Shelyak if (WITH_SHELYAK) add_subdirectory(indi-shelyak) @@ -654,11 +644,6 @@ if (WITH_MGEN) add_subdirectory(indi-mgen) endif (WITH_MGEN) -# Astromechanics Focuser -if (WITH_ASTROMECHFOC) -add_subdirectory(indi-astromechfoc) -endif(WITH_ASTROMECHFOC) - ## LIME-SDR if (WITH_LIMESDR) find_package(LIMESUITE) @@ -685,10 +670,6 @@ if (WITH_NIGHTSCAPE) add_subdirectory(indi-nightscape) endif(WITH_NIGHTSCAPE) -if (WITH_DREAMFOCUSER) -add_subdirectory(indi-dreamfocuser) -endif() - # Avalon StarGO if (WITH_AVALON) add_subdirectory(indi-avalon) diff --git a/debian/indi-astrolink4/changelog b/debian/indi-astrolink4/changelog deleted file mode 100644 index f74caaba2..000000000 --- a/debian/indi-astrolink4/changelog +++ /dev/null @@ -1,5 +0,0 @@ -indi-astrolink4 (0.1) bionic; urgency=medium - - * Initial release. - - -- Jasem Mutlaq Wed, 1 Apr 2020 09:00:00 +0300 diff --git a/debian/indi-astrolink4/compat b/debian/indi-astrolink4/compat deleted file mode 100644 index f599e28b8..000000000 --- a/debian/indi-astrolink4/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/debian/indi-astrolink4/control b/debian/indi-astrolink4/control deleted file mode 100644 index 95aa84f47..000000000 --- a/debian/indi-astrolink4/control +++ /dev/null @@ -1,24 +0,0 @@ -Source: indi-astrolink4 -Section: science -Priority: extra -Maintainer: Jasem Mutlaq -Build-Depends: debhelper (>= 6), cdbs, cmake, libindi-dev, zlib1g-dev, libnova-dev, libgsl-dev -Standards-Version: 3.9.2 - -Package: indi-astrolink4 -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, zlib1g -Description: INDI AstroLink Driver. - . - This driver is compatible with any INDI client such as KStars or Xephem. - This INDI driver interacts with AstroLink 4 mini device. It contains two focuser controllers, regulated outputs for heaters, peltiers or fans, switchable power outputs, different sensors inputs, hand controller connector and many other options. - -Package: indi-astrolink4-dbg -Priority: extra -Section: debug -Architecture: any -Depends: indi-astrolink4 (= ${binary:Version}), ${misc:Depends} -Description: INDI AstroLink Driver. - . - This driver is compatible with any INDI client such as KStars or Xephem. - This package contains the debug symbols for the this driver, useful to investigate problems in INDI. diff --git a/debian/indi-astrolink4/copyright b/debian/indi-astrolink4/copyright deleted file mode 100644 index 09792e205..000000000 --- a/debian/indi-astrolink4/copyright +++ /dev/null @@ -1,13 +0,0 @@ -This package was debianized by Jasem Mutlaq on -Thu, 25 Nov 2010 22:00:28 +0300. - -Copyright: - - Łukasz Socha (drjolo AT gmail DOT com) - -License: - - - -The Debian packaging is (C) 2010, Jasem Mutlaq and -is licensed under the LGPL License. diff --git a/debian/indi-astrolink4/indi-astrolink4.install b/debian/indi-astrolink4/indi-astrolink4.install deleted file mode 100644 index eea35f955..000000000 --- a/debian/indi-astrolink4/indi-astrolink4.install +++ /dev/null @@ -1,3 +0,0 @@ -usr/bin/ -usr/share/indi/ - diff --git a/debian/indi-astrolink4/rules b/debian/indi-astrolink4/rules deleted file mode 100755 index c95d60185..000000000 --- a/debian/indi-astrolink4/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/cmake.mk - -DEB_SRCDIR=indi-astrolink4 -DEB_DH_SHLIBDEPS_ARGS=-u--ignore-missing-info diff --git a/debian/indi-astrolink4/source/format b/debian/indi-astrolink4/source/format deleted file mode 100644 index 163aaf8d8..000000000 --- a/debian/indi-astrolink4/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/debian/indi-astromechfoc/changelog b/debian/indi-astromechfoc/changelog deleted file mode 100644 index 81d1b6b64..000000000 --- a/debian/indi-astromechfoc/changelog +++ /dev/null @@ -1,12 +0,0 @@ -indi-astromechfoc (0.2) bionic; urgency=low - - * Fixed position limits. - - -- Jasem Mutlaq Thu, 1 Oct 2020 05:00:00 +0300 - -indi-astromechfoc (0.1) bionic; urgency=low - - * Initial Release - - -- Jasem Mutlaq Wed, 1 May 2019 16:00:00 +0300 - diff --git a/debian/indi-astromechfoc/compat b/debian/indi-astromechfoc/compat deleted file mode 100644 index f599e28b8..000000000 --- a/debian/indi-astromechfoc/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/debian/indi-astromechfoc/control b/debian/indi-astromechfoc/control deleted file mode 100644 index f8c1dda00..000000000 --- a/debian/indi-astromechfoc/control +++ /dev/null @@ -1,23 +0,0 @@ -Source: indi-astromechfoc -Section: science -Priority: extra -Maintainer: Jasem Mutlaq -Build-Depends: debhelper (>= 9), cdbs, cmake, libindi-dev, zlib1g-dev, libnova-dev -Standards-Version: 3.9.2 - -Package: indi-astromechfoc -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: INDI Astromechanics Canon Lens Controller Driver - . - This driver is compatible with any INDI client such as KStars or Xephem. The driver interacts with a Bee Focuser using TCP/IP. - -Package: indi-astromechfoc-dbg -Priority: extra -Section: debug -Architecture: any -Depends: indi-astromechfoc (= ${binary:Version}), ${misc:Depends} -Description: INDI Astromechanics Canon Lens Controller Driver. - . - This driver is compatible with any INDI client such as KStars or Xephem. - This package contains the debug symbols for the this driver, useful to investigate problems in INDI. diff --git a/debian/indi-astromechfoc/copyright b/debian/indi-astromechfoc/copyright deleted file mode 100644 index b60c3c918..000000000 --- a/debian/indi-astromechfoc/copyright +++ /dev/null @@ -1,8 +0,0 @@ -Copyright: - - Copyright(c) 2019 Christian Liska. - -License: - - LGPL-2+ - diff --git a/debian/indi-astromechfoc/indi-astromechfoc.install b/debian/indi-astromechfoc/indi-astromechfoc.install deleted file mode 100644 index 4ecb40be8..000000000 --- a/debian/indi-astromechfoc/indi-astromechfoc.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/ -usr/share/indi/ diff --git a/debian/indi-astromechfoc/rules b/debian/indi-astromechfoc/rules deleted file mode 100755 index c35f6d247..000000000 --- a/debian/indi-astromechfoc/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/cmake.mk - -DEB_SRCDIR=indi-astromechfoc -DEB_DH_SHLIBDEPS_ARGS=-u--ignore-missing-info diff --git a/debian/indi-astromechfoc/source/format b/debian/indi-astromechfoc/source/format deleted file mode 100644 index 163aaf8d8..000000000 --- a/debian/indi-astromechfoc/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/debian/indi-astromechfoc/watch b/debian/indi-astromechfoc/watch deleted file mode 100644 index b53cb4c7b..000000000 --- a/debian/indi-astromechfoc/watch +++ /dev/null @@ -1,3 +0,0 @@ -version=3 - -http://sf.net/indi/indi-astromechfoc_(.*)\.tar\.gz diff --git a/debian/indi-dreamfocuser/changelog b/debian/indi-dreamfocuser/changelog deleted file mode 100644 index cc4071375..000000000 --- a/debian/indi-dreamfocuser/changelog +++ /dev/null @@ -1,6 +0,0 @@ -indi-dreamfocuser (2.1) bionic; urgency=low - - * Initial Release - - -- Piotr Dlugosz Wed, 1 May 2019 15:02:14 +0100 - diff --git a/debian/indi-dreamfocuser/compat b/debian/indi-dreamfocuser/compat deleted file mode 100644 index f599e28b8..000000000 --- a/debian/indi-dreamfocuser/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/debian/indi-dreamfocuser/control b/debian/indi-dreamfocuser/control deleted file mode 100644 index ba3157f5c..000000000 --- a/debian/indi-dreamfocuser/control +++ /dev/null @@ -1,23 +0,0 @@ -Source: indi-dreamfocuser -Section: science -Priority: extra -Maintainer: Piotr Dlugosz -Build-Depends: debhelper (>= 9), cdbs, cmake, libindi-dev -Standards-Version: 3.9.2 - -Package: indi-dreamfocuser -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: INDI DreamFocuser Driver - . - This driver is compatible with any INDI client such as KStars or Xephem. The driver controls DreamFocuser focuser device. - -Package: indi-dreamfocuser-dbg -Priority: extra -Section: debug -Architecture: any -Depends: indi-dreamfocuser (= ${binary:Version}), ${misc:Depends} -Description: INDI DreamFocuser Driver - . - This driver is compatible with any INDI client such as KStars or Xephem. - This package contains the debug symbols for the this driver, useful to investigate problems in INDI. diff --git a/debian/indi-dreamfocuser/copyright b/debian/indi-dreamfocuser/copyright deleted file mode 100644 index 40e3e15a0..000000000 --- a/debian/indi-dreamfocuser/copyright +++ /dev/null @@ -1,9 +0,0 @@ -Copyright: - - Piotr Dlugosz (pidlug@gmail.com) (c) 2019 - -License: - - LGPL-2+ - -See /usr/share/common-licenses/LGPL diff --git a/debian/indi-dreamfocuser/indi-dreamfocuser.install b/debian/indi-dreamfocuser/indi-dreamfocuser.install deleted file mode 100644 index 4ecb40be8..000000000 --- a/debian/indi-dreamfocuser/indi-dreamfocuser.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/ -usr/share/indi/ diff --git a/debian/indi-dreamfocuser/rules b/debian/indi-dreamfocuser/rules deleted file mode 100755 index 234b7b022..000000000 --- a/debian/indi-dreamfocuser/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/cmake.mk - -DEB_SRCDIR=indi-dreamfocuser -DEB_DH_SHLIBDEPS_ARGS=-u--ignore-missing-info diff --git a/debian/indi-dreamfocuser/source/format b/debian/indi-dreamfocuser/source/format deleted file mode 100644 index 163aaf8d8..000000000 --- a/debian/indi-dreamfocuser/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/debian/indi-spectracyber/changelog b/debian/indi-spectracyber/changelog deleted file mode 100644 index dd72a14f8..000000000 --- a/debian/indi-spectracyber/changelog +++ /dev/null @@ -1,6 +0,0 @@ -indi-spectracyber (1.3) bionic; urgency=medium - - * Initial release. - - -- Radek Kaczorek Mon, 11 Nov 2019 20:11:09 +0100 - diff --git a/debian/indi-spectracyber/compat b/debian/indi-spectracyber/compat deleted file mode 100644 index f599e28b8..000000000 --- a/debian/indi-spectracyber/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/debian/indi-spectracyber/control b/debian/indi-spectracyber/control deleted file mode 100644 index 780e56f0c..000000000 --- a/debian/indi-spectracyber/control +++ /dev/null @@ -1,23 +0,0 @@ -Source: indi-spectracyber -Section: science -Priority: extra -Maintainer: Jasem Mutlaq -Build-Depends: debhelper (>= 6), cmake, cdbs, libindi-dev, libcfitsio3-dev|libcfitsio-dev, zlib1g-dev -Standards-Version: 3.9.1 - -Package: indi-spectracyber -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: This package provides the INDI driver for Radio Astronomy Supplies - SpectraCyber hydrogen line spectrometer - . - This driver is compatible with any INDI client such as KStars or Xephem. - -Package: indi-spectracyber-dbg -Architecture: any -Depends: indi-spectracyber (= ${binary:Version}), ${misc:Depends} -Description: This package provides the INDI driver for Radio Astronomy Supplies - SpectraCyber hydrogen line spectrometer - . - This driver is compatible with any INDI client such as KStars or Xephem. - This package contains the debug symbols for the this driver, useful to investigate problems in INDI. diff --git a/debian/indi-spectracyber/copyright b/debian/indi-spectracyber/copyright deleted file mode 100644 index f56d99bdb..000000000 --- a/debian/indi-spectracyber/copyright +++ /dev/null @@ -1,26 +0,0 @@ -This package was debianized by Jasem Mutlaq on -Wed,08 Oct 2008 02:44:13 0300. - -Copyright: - - Copyright (C) 2014 Jasem Mutlaq (mutlaqja@ikarustech.com) - -License: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -The Debian packaging is (C) 2008, Jasem Mutlaq and -is licensed under the LGPL License. - diff --git a/debian/indi-spectracyber/indi-spectracyber.install b/debian/indi-spectracyber/indi-spectracyber.install deleted file mode 100644 index eea35f955..000000000 --- a/debian/indi-spectracyber/indi-spectracyber.install +++ /dev/null @@ -1,3 +0,0 @@ -usr/bin/ -usr/share/indi/ - diff --git a/debian/indi-spectracyber/rules b/debian/indi-spectracyber/rules deleted file mode 100755 index 22c55a02f..000000000 --- a/debian/indi-spectracyber/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/cmake.mk - -DEB_SRCDIR=indi-spectracyber -DEB_DH_SHLIBDEPS_ARGS=-u--ignore-missing-info diff --git a/debian/indi-spectracyber/source/format b/debian/indi-spectracyber/source/format deleted file mode 100644 index 163aaf8d8..000000000 --- a/debian/indi-spectracyber/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/indi-astrolink4/.gitignore b/indi-astrolink4/.gitignore deleted file mode 100644 index ee872567b..000000000 --- a/indi-astrolink4/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -*.a -build diff --git a/indi-astrolink4/AUTHORS b/indi-astrolink4/AUTHORS deleted file mode 100644 index 88cf53e32..000000000 --- a/indi-astrolink4/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Łukasz Socha (drjolo AT gmail DOT com) diff --git a/indi-astrolink4/CMakeLists.txt b/indi-astrolink4/CMakeLists.txt deleted file mode 100644 index 814a1da1f..000000000 --- a/indi-astrolink4/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -PROJECT(indi-astrolink4 CXX C) - -set (ASTROLINK4_VERSION_MAJOR 0) -set (ASTROLINK4_VERSION_MINOR 7) - -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") -include(GNUInstallDirs) - -SET(CMAKE_CXX_STANDARD 11) - -find_package(INDI REQUIRED) - -include_directories( ${CMAKE_CURRENT_BINARY_DIR}) -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}) -include_directories( ${INDI_INCLUDE_DIR}) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_astrolink4.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_astrolink4.xml ) - -################ AstroLink4 ################ - -set(indi_astrolink4_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/indi_astrolink4.cpp - ) - -add_executable(indi_astrolink4 ${indi_astrolink4_SRCS}) -target_link_libraries(indi_astrolink4 ${INDI_LIBRARIES}) - -install(TARGETS indi_astrolink4 RUNTIME DESTINATION bin ) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_astrolink4.xml DESTINATION ${INDI_DATA_DIR}) - diff --git a/indi-astrolink4/COPYING.LIB b/indi-astrolink4/COPYING.LIB deleted file mode 100644 index 94a9ed024..000000000 --- a/indi-astrolink4/COPYING.LIB +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/indi-astrolink4/INSTALL b/indi-astrolink4/INSTALL deleted file mode 100644 index f6b90325a..000000000 --- a/indi-astrolink4/INSTALL +++ /dev/null @@ -1,13 +0,0 @@ -Before compiling AstroLink4 driver install libindi-dev -# sudo apt-get install libindi-dev - -Compile AstroLink4 driver -# git clone https://github.com/astrojolo/indi-astrolink4 -# cd indi-astrolink4 -# mkdir build -# cd build -# cmake .. -# make -# make install - -DONE diff --git a/indi-astrolink4/README.md b/indi-astrolink4/README.md deleted file mode 100644 index 04e676722..000000000 --- a/indi-astrolink4/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# indi-astrolink4 -astrolink4 INDI driver supports [AstroLink 4 mini device](https://astrojolo.com/astrolink-4-0-mini/). AstroLink 4.0 mini device was designed to make astroimaging easier. Contains two focuser controllers, regulated outputs for heaters, peltiers or fans, switchable power outputs, different sensors inputs, hand controller connector and many other options. Following funcitons are supported in INDI driver: -- 1x stepper focuser motor output -- 1x DC focuser motor output -- 3x switchable 12V power outputs -- 2x regulated PWM outputs -- temperature / humidity / dew point readings -- voltage, current, consumed energy monitoring - -# Installing INDI server and libraries -To start you need to download and install INDI environment. See [INDI page](http://indilib.org/download.html) for details. - -Then AstroLink INDI driver needs to be fetched and installed: - -``` -git clone https://github.com/astrojolo/astrolink4.git -cd astrolink4 -mkdir build -cd build -cmake .. -make -sudo make install -``` - -Then indiserver needs to be started with AstroLink drivers: - -``` -indiserver -v indi_astrolink4 -``` - -Now AstroLink can be used with any software that supports INDI drivers, like KStars with Ekos. - -![INDI AstroLink](https://astrojolo.com/wp-content/uploads/2019/10/astrolink-indi-focuser.jpg) diff --git a/indi-astrolink4/config.h.cmake b/indi-astrolink4/config.h.cmake deleted file mode 100644 index fe31cdbce..000000000 --- a/indi-astrolink4/config.h.cmake +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -/* Define INDI Data Dir */ -#cmakedefine INDI_DATA_DIR "@INDI_DATA_DIR@" -/* Define Driver version */ -#define ASTROLINK4_VERSION_MAJOR @ASTROLINK4_VERSION_MAJOR@ -#define ASTROLINK4_VERSION_MINOR @ASTROLINK4_VERSION_MINOR@ - -#endif // CONFIG_H diff --git a/indi-astrolink4/indi-astrolink4.spec b/indi-astrolink4/indi-astrolink4.spec deleted file mode 100644 index 7410e6fb1..000000000 --- a/indi-astrolink4/indi-astrolink4.spec +++ /dev/null @@ -1,78 +0,0 @@ -%define __cmake_in_source_build %{_vpath_builddir} -Name: indi-astrolink4 -Version:2.0.7.git -Release: %(date -u +%%Y%%m%%d%%H%%M%%S)%{?dist} -Summary: Instrument Neutral Distributed Interface 3rd party drivers - -License: LGPLv2 -# See COPYRIGHT file for a description of the licenses and files covered - -URL: https://indilib.org -Source0: https://github.com/indilib/indi-3rdparty/archive/master.tar.gz - -BuildRequires: cmake -BuildRequires: libfli-devel -BuildRequires: libnova-devel -BuildRequires: qt5-qtbase-devel -BuildRequires: systemd -BuildRequires: gphoto2-devel -BuildRequires: LibRaw-devel -BuildRequires: indi-libs -BuildRequires: indi-devel -BuildRequires: libtiff-devel -BuildRequires: cfitsio-devel -BuildRequires: zlib-devel -BuildRequires: gsl-devel -BuildRequires: libcurl-devel -BuildRequires: libjpeg-turbo-devel -BuildRequires: fftw-devel -BuildRequires: libftdi-devel -BuildRequires: gpsd-devel -BuildRequires: libdc1394-devel -BuildRequires: boost-devel -BuildRequires: boost-regex -BuildRequires: libasi - -BuildRequires: gmock - -BuildRequires: pkgconfig(fftw3) -BuildRequires: pkgconfig(cfitsio) -BuildRequires: pkgconfig(libcurl) -BuildRequires: pkgconfig(gsl) -BuildRequires: pkgconfig(libjpeg) -BuildRequires: pkgconfig(libusb-1.0) -BuildRequires: pkgconfig(zlib) - - -%description -INDI is a distributed control protocol designed to operate -astronomical instrumentation. INDI is small, flexible, easy to parse, -and scalable. It supports common DCS functions such as remote control, -data acquisition, monitoring, and a lot more. This is a 3rd party driver. - - -%prep -v -%autosetup -v -p1 -n indi-3rdparty-master - -%build -# This package tries to mix and match PIE and PIC which is wrong and will -# trigger link errors when LTO is enabled. -# Disable LTO -%define _lto_cflags %{nil} - -cd indi-astrolink4 -%cmake -DINDI_DATA_DIR=/usr/share/indi . -make VERBOSE=1 %{?_smp_mflags} -j4 - -%install -cd indi-astrolink4 -make DESTDIR=%{buildroot} install - -%files -%{_bindir}/* -%{_datadir}/indi - -%changelog -* Sun Jul 19 2020 Jim Howard 1.8.7.git-1 -- update to build from git for copr, credit to Sergio Pascual and Christian Dersch for prior work on spec files - diff --git a/indi-astrolink4/indi_astrolink4.cpp b/indi-astrolink4/indi_astrolink4.cpp deleted file mode 100644 index a1fa91979..000000000 --- a/indi-astrolink4/indi_astrolink4.cpp +++ /dev/null @@ -1,1063 +0,0 @@ -/******************************************************************************* - Copyright(c) 2019 astrojolo.com - . - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - . - This library 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; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*******************************************************************************/ -#include "indi_astrolink4.h" -#include "config.h" - -#include "indicom.h" - -#define ASTROLINK4_LEN 100 -#define ASTROLINK4_TIMEOUT 3 - -////////////////////////////////////////////////////////////////////// -/// Delegates -////////////////////////////////////////////////////////////////////// -static std::unique_ptr indiAstrolink4(new IndiAstrolink4()); - -////////////////////////////////////////////////////////////////////// -///Constructor -////////////////////////////////////////////////////////////////////// -IndiAstrolink4::IndiAstrolink4() : FI(this), WI(this) -{ - setVersion(ASTROLINK4_VERSION_MAJOR, ASTROLINK4_VERSION_MINOR); -} - -const char * IndiAstrolink4::getDefaultName() -{ - return "AstroLink 4"; -} - -////////////////////////////////////////////////////////////////////// -/// Communication -////////////////////////////////////////////////////////////////////// -bool IndiAstrolink4::Handshake() -{ - PortFD = serialConnection->getPortFD(); - - char res[ASTROLINK4_LEN] = {0}; - if(sendCommand("#", res)) - { - if(strncmp(res, "#:AstroLink4mini", 15) != 0) - { - LOG_ERROR("Device not recognized."); - return false; - } - else - { - SetTimer(getCurrentPollingPeriod()); - return true; - } - } - return false; -} - -void IndiAstrolink4::TimerHit() -{ - if(!isConnected()) - return; - - sensorRead(); - SetTimer(getCurrentPollingPeriod()); -} - -////////////////////////////////////////////////////////////////////// -/// Overrides -////////////////////////////////////////////////////////////////////// -bool IndiAstrolink4::initProperties() -{ - INDI::DefaultDevice::initProperties(); - - setDriverInterface(AUX_INTERFACE | FOCUSER_INTERFACE | WEATHER_INTERFACE); - - FI::SetCapability(FOCUSER_CAN_ABS_MOVE | - FOCUSER_CAN_REL_MOVE | - FOCUSER_CAN_REVERSE | - FOCUSER_CAN_SYNC | - FOCUSER_CAN_ABORT | - FOCUSER_HAS_BACKLASH); - - FI::initProperties(FOCUS_TAB); - WI::initProperties(ENVIRONMENT_TAB, ENVIRONMENT_TAB); - - addDebugControl(); - addSimulationControl(); - addConfigurationControl(); - - // focuser settings - IUFillNumber(&FocuserSettingsN[FS_SPEED], "FS_SPEED", "Speed [pps]", "%.0f", 0, 4000, 50, 250); - IUFillNumber(&FocuserSettingsN[FS_STEP_SIZE], "FS_STEP_SIZE", "Step size [um]", "%.2f", 0, 100, 0.1, 5.0); - IUFillNumber(&FocuserSettingsN[FS_COMPENSATION], "FS_COMPENSATION", "Compensation [steps/C]", "%.2f", -1000, 1000, 1, 0); - IUFillNumber(&FocuserSettingsN[FS_COMP_THRESHOLD], "FS_COMP_THRESHOLD", "Compensation threshold [steps]", "%.0f", 1, 1000, - 10, 10); - IUFillNumberVector(&FocuserSettingsNP, FocuserSettingsN, 4, getDeviceName(), "FOCUSER_SETTINGS", "Focuser settings", - SETTINGS_TAB, IP_RW, 60, IPS_IDLE); - - IUFillSwitch(&FocuserModeS[FS_MODE_UNI], "FS_MODE_UNI", "Unipolar", ISS_ON); - IUFillSwitch(&FocuserModeS[FS_MODE_BI], "FS_MODE_BI", "Bipolar", ISS_OFF); - IUFillSwitch(&FocuserModeS[FS_MODE_MICRO], "FS_MODE_MICRO", "Microstep", ISS_OFF); - IUFillSwitchVector(&FocuserModeSP, FocuserModeS, 3, getDeviceName(), "FOCUSER_MODE", "Focuser mode", SETTINGS_TAB, IP_RW, - ISR_1OFMANY, 60, IPS_IDLE); - - IUFillSwitch(&FocuserCompModeS[FS_COMP_AUTO], "FS_COMP_AUTO", "AUTO", ISS_OFF); - IUFillSwitch(&FocuserCompModeS[FS_COMP_MANUAL], "FS_COMP_MANUAL", "MANUAL", ISS_ON); - IUFillSwitchVector(&FocuserCompModeSP, FocuserCompModeS, 2, getDeviceName(), "COMP_MODE", "Compensation mode", SETTINGS_TAB, - IP_RW, ISR_1OFMANY, 60, IPS_IDLE); - - IUFillSwitch(&FocuserManualS[FS_MANUAL_ON], "FS_MANUAL_ON", "ON", ISS_ON); - IUFillSwitch(&FocuserManualS[FS_MANUAL_OFF], "FS_MANUAL_OFF", "OFF", ISS_OFF); - IUFillSwitchVector(&FocuserManualSP, FocuserManualS, 2, getDeviceName(), "MANUAL_CONTROLLER", "Hand controller", - SETTINGS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); - - // other settings - IUFillNumber(&OtherSettingsN[SET_AREF_COEFF], "SET_AREF_COEFF", "V ref coefficient", "%.3f", 0.9, 1.2, 0.001, 1.09); - IUFillNumber(&OtherSettingsN[SET_OVER_TIME], "SET_OVER_TIME", "Protection sensitivity [ms]", "%.0f", 10, 500, 10, 100); - IUFillNumber(&OtherSettingsN[SET_OVER_VOLT], "SET_OVER_VOLT", "Protection voltage [V]", "%.1f", 10, 14, 0.1, 14); - IUFillNumber(&OtherSettingsN[SET_OVER_AMP], "SET_OVER_AMP", "Protection current [A]", "%.1f", 1, 10, 0.1, 10); - IUFillNumberVector(&OtherSettingsNP, OtherSettingsN, 4, getDeviceName(), "OTHER_SETTINGS", "Device settings", SETTINGS_TAB, - IP_RW, 60, IPS_IDLE); - - IUFillSwitch(&BuzzerS[0], "BUZZER", "Buzzer", ISS_OFF); - IUFillSwitchVector(&BuzzerSP, BuzzerS, 1, getDeviceName(), "BUZZER", "ONOFF", SETTINGS_TAB, IP_RW, ISR_NOFMANY, 60, - IPS_IDLE); - - // focuser compensation - IUFillNumber(&CompensationValueN[0], "COMP_VALUE", "Compensation steps", "%.0f", -10000, 10000, 1, 0); - IUFillNumberVector(&CompensationValueNP, CompensationValueN, 1, getDeviceName(), "COMP_STEPS", "Compensation steps", - FOCUS_TAB, IP_RO, 60, IPS_IDLE); - - IUFillSwitch(&CompensateNowS[0], "COMP_NOW", "Compensate now", ISS_OFF); - IUFillSwitchVector(&CompensateNowSP, CompensateNowS, 1, getDeviceName(), "COMP_NOW", "Compensate now", FOCUS_TAB, IP_RW, - ISR_ATMOST1, 60, IPS_IDLE); - - IUFillNumber(&FocusPosMMN[0], "FOC_POS_MM", "Position [mm]", "%.3f", 0.0, 200.0, 0.001, 0.0); - IUFillNumberVector(&FocusPosMMNP, FocusPosMMN, 1, getDeviceName(), "FOC_POS_MM", "Position [mm]", FOCUS_TAB, IP_RO, 60, - IPS_IDLE); - - // power lines - IUFillText(&PowerControlsLabelsT[0], "POWER_LABEL_1", "Port 1", "Port 1"); - IUFillText(&PowerControlsLabelsT[1], "POWER_LABEL_2", "Port 2", "Port 2"); - IUFillText(&PowerControlsLabelsT[2], "POWER_LABEL_3", "Port 3", "Port 3"); - IUFillTextVector(&PowerControlsLabelsTP, PowerControlsLabelsT, 3, getDeviceName(), "POWER_CONTROL_LABEL", "Power Labels", - POWER_TAB, IP_WO, 60, IPS_IDLE); - - char portLabel1[MAXINDILABEL], portLabel2[MAXINDILABEL], portLabel3[MAXINDILABEL]; - - memset(portLabel1, 0, MAXINDILABEL); - int portRC1 = IUGetConfigText(getDeviceName(), PowerControlsLabelsTP.name, PowerControlsLabelsT[0].name, portLabel1, - MAXINDILABEL); - - IUFillSwitch(&Power1S[0], "PWR1BTN_ON", "ON", ISS_OFF); - IUFillSwitch(&Power1S[1], "PWR1BTN_OFF", "OFF", ISS_ON); - IUFillSwitchVector(&Power1SP, Power1S, 2, getDeviceName(), "DC1", portRC1 == -1 ? "Port 1" : portLabel1, POWER_TAB, IP_RW, - ISR_1OFMANY, 0, IPS_IDLE); - - memset(portLabel2, 0, MAXINDILABEL); - int portRC2 = IUGetConfigText(getDeviceName(), PowerControlsLabelsTP.name, PowerControlsLabelsT[1].name, portLabel2, - MAXINDILABEL); - - IUFillSwitch(&Power2S[0], "PWR2BTN_ON", "ON", ISS_OFF); - IUFillSwitch(&Power2S[1], "PWR2BTN_OFF", "OFF", ISS_ON); - IUFillSwitchVector(&Power2SP, Power2S, 2, getDeviceName(), "DC2", portRC2 == -1 ? "Port 2" : portLabel2, POWER_TAB, IP_RW, - ISR_1OFMANY, 0, IPS_IDLE); - - memset(portLabel3, 0, MAXINDILABEL); - int portRC3 = IUGetConfigText(getDeviceName(), PowerControlsLabelsTP.name, PowerControlsLabelsT[2].name, portLabel3, - MAXINDILABEL); - - IUFillSwitch(&Power3S[0], "PWR3BTN_ON", "ON", ISS_OFF); - IUFillSwitch(&Power3S[1], "PWR3BTN_OFF", "OFF", ISS_ON); - IUFillSwitchVector(&Power3SP, Power3S, 2, getDeviceName(), "DC3", portRC3 == -1 ? "Port 3" : portLabel3, POWER_TAB, IP_RW, - ISR_1OFMANY, 0, IPS_IDLE); - - IUFillSwitch(&PowerDefaultOnS[0], "POW_DEF_ON1", "DC1", ISS_OFF); - IUFillSwitch(&PowerDefaultOnS[1], "POW_DEF_ON2", "DC2", ISS_OFF); - IUFillSwitch(&PowerDefaultOnS[2], "POW_DEF_ON3", "DC3", ISS_OFF); - IUFillSwitchVector(&PowerDefaultOnSP, PowerDefaultOnS, 3, getDeviceName(), "POW_DEF_ON", "Power default ON", SETTINGS_TAB, - IP_RW, ISR_NOFMANY, 60, IPS_IDLE); - - // pwm - IUFillNumber(&PWMN[0], "PWM1_VAL", "A", "%3.0f", 0, 100, 10, 0); - IUFillNumber(&PWMN[1], "PWM2_VAL", "B", "%3.0f", 0, 100, 10, 0); - IUFillNumberVector(&PWMNP, PWMN, 2, getDeviceName(), "PWM", "PWM", POWER_TAB, IP_RW, 60, IPS_IDLE); - - // Auto pwm - IUFillSwitch(&AutoPWMDefaultOnS[0], "PWMA_A_DEF_ON", "A", ISS_OFF); - IUFillSwitch(&AutoPWMDefaultOnS[1], "PWMA_B_DEF_ON", "B", ISS_OFF); - IUFillSwitchVector(&AutoPWMDefaultOnSP, AutoPWMDefaultOnS, 2, getDeviceName(), "AUTO_PWM_DEF_ON", "Auto PWM default ON", - SETTINGS_TAB, - IP_RW, ISR_NOFMANY, 60, IPS_IDLE); - - ISState pwmAutoA = ISS_OFF; - IUGetConfigSwitch(getDeviceName(), AutoPWMDefaultOnSP.name, AutoPWMDefaultOnS[0].name, &pwmAutoA); - - ISState pwmAutoB = ISS_OFF; - IUGetConfigSwitch(getDeviceName(), AutoPWMDefaultOnSP.name, AutoPWMDefaultOnS[1].name, &pwmAutoB); - - IUFillSwitch(&AutoPWMS[0], "PWMA_A", "A", pwmAutoA); - IUFillSwitch(&AutoPWMS[1], "PWMA_B", "B", pwmAutoB); - IUFillSwitchVector(&AutoPWMSP, AutoPWMS, 2, getDeviceName(), "AUTO_PWM", "Auto PWM", POWER_TAB, IP_RW, ISR_NOFMANY, 60, - IPS_OK); - - IUFillNumber(&PowerDataN[POW_VIN], "VIN", "Input voltage", "%.1f", 0, 15, 10, 0); - IUFillNumber(&PowerDataN[POW_VREG], "VREG", "Regulated voltage", "%.1f", 0, 15, 10, 0); - IUFillNumber(&PowerDataN[POW_ITOT], "ITOT", "Total current", "%.1f", 0, 15, 10, 0); - IUFillNumber(&PowerDataN[POW_AH], "AH", "Energy consumed [Ah]", "%.1f", 0, 1000, 10, 0); - IUFillNumber(&PowerDataN[POW_WH], "WH", "Energy consumed [Wh]", "%.1f", 0, 10000, 10, 0); - IUFillNumberVector(&PowerDataNP, PowerDataN, 5, getDeviceName(), "POWER_DATA", "Power data", POWER_TAB, IP_RO, 60, - IPS_IDLE); - - // Environment Group - addParameter("WEATHER_TEMPERATURE", "Temperature (C)", -15, 35, 15); - addParameter("WEATHER_HUMIDITY", "Humidity %", 0, 100, 15); - addParameter("WEATHER_DEWPOINT", "Dew Point (C)", 0, 100, 15); - - // Sensor 2 - IUFillNumber(&Sensor2N[0], "TEMP_2", "Temperature (C)", "%.1f", -50, 100, 1, 0); - IUFillNumberVector(&Sensor2NP, Sensor2N, 1, getDeviceName(), "SENSOR_2", "Sensor 2", ENVIRONMENT_TAB, IP_RO, 60, IPS_IDLE); - - // DC focuser - IUFillNumber(&DCFocTimeN[DC_PERIOD], "DC_PERIOD", "Time [ms]", "%.0f", 10, 5000, 10, 500); - IUFillNumber(&DCFocTimeN[DC_PWM], "DC_PWM", "PWM [%]", "%.0f", 10, 100, 10, 50); - IUFillNumberVector(&DCFocTimeNP, DCFocTimeN, 2, getDeviceName(), "DC_FOC_TIME", "DC Focuser", DCFOCUSER_TAB, IP_RW, 60, - IPS_OK); - - IUFillSwitch(&DCFocDirS[0], "DIR_IN", "IN", ISS_OFF); - IUFillSwitch(&DCFocDirS[1], "DIR_OUT", "OUT", ISS_ON); - IUFillSwitchVector(&DCFocDirSP, DCFocDirS, 2, getDeviceName(), "DC_FOC_DIR", "DC Focuser direction", DCFOCUSER_TAB, IP_RW, - ISR_1OFMANY, 60, IPS_OK); - - IUFillSwitch(&DCFocAbortS[0], "DC_FOC_ABORT", "STOP", ISS_OFF); - IUFillSwitchVector(&DCFocAbortSP, DCFocAbortS, 1, getDeviceName(), "DC_FOC_ABORT", "DC Focuser stop", DCFOCUSER_TAB, IP_RW, - ISR_ATMOST1, 60, IPS_IDLE); - - serialConnection = new Connection::Serial(this); - serialConnection->registerHandshake([&]() - { - return Handshake(); - }); - registerConnection(serialConnection); - - serialConnection->setDefaultPort("/dev/ttyUSB0"); - serialConnection->setDefaultBaudRate(serialConnection->B_115200); - - return true; -} - -bool IndiAstrolink4::updateProperties() -{ - // Call parent update properties first - INDI::DefaultDevice::updateProperties(); - - if (isConnected()) - { - defineProperty(&FocusPosMMNP); - FI::updateProperties(); - WI::updateProperties(); - defineProperty(&Power1SP); - defineProperty(&Power2SP); - defineProperty(&Power3SP); - defineProperty(&AutoPWMSP); - defineProperty(&Sensor2NP); - defineProperty(&PWMNP); - defineProperty(&PowerDataNP); - defineProperty(&FocuserSettingsNP); - defineProperty(&FocuserModeSP); - defineProperty(&FocuserCompModeSP); - defineProperty(&FocuserManualSP); - defineProperty(&CompensationValueNP); - defineProperty(&CompensateNowSP); - defineProperty(&PowerDefaultOnSP); - defineProperty(&AutoPWMDefaultOnSP); - defineProperty(&OtherSettingsNP); - defineProperty(&DCFocDirSP); - defineProperty(&DCFocTimeNP); - defineProperty(&DCFocAbortSP); - defineProperty(&PowerControlsLabelsTP); - defineProperty(&BuzzerSP); - } - else - { - deleteProperty(Power1SP.name); - deleteProperty(Power2SP.name); - deleteProperty(Power3SP.name); - deleteProperty(AutoPWMSP.name); - deleteProperty(Sensor2NP.name); - deleteProperty(PWMNP.name); - deleteProperty(PowerDataNP.name); - deleteProperty(FocuserSettingsNP.name); - deleteProperty(FocuserModeSP.name); - deleteProperty(CompensateNowSP.name); - deleteProperty(CompensationValueNP.name); - deleteProperty(PowerDefaultOnSP.name); - deleteProperty(AutoPWMDefaultOnSP.name); - deleteProperty(OtherSettingsNP.name); - deleteProperty(DCFocTimeNP.name); - deleteProperty(DCFocDirSP.name); - deleteProperty(DCFocAbortSP.name); - deleteProperty(BuzzerSP.name); - deleteProperty(FocuserCompModeSP.name); - deleteProperty(FocuserManualSP.name); - deleteProperty(FocusPosMMNP.name); - deleteProperty(PowerControlsLabelsTP.name); - FI::updateProperties(); - WI::updateProperties(); - } - - return true; -} - -bool IndiAstrolink4::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) -{ - if (dev && !strcmp(dev, getDeviceName())) - { - char cmd[ASTROLINK4_LEN] = {0}; - char res[ASTROLINK4_LEN] = {0}; - - // handle PWM - if (!strcmp(name, PWMNP.name)) - { - bool allOk = true; - if(PWMN[0].value != values[0]) - { - if(AutoPWMS[0].s == ISS_OFF) - { - sprintf(cmd, "B:0:%d", static_cast(values[0])); - allOk = allOk && sendCommand(cmd, res); - } - else - { - LOG_WARN("Cannot set PWM output, it is in AUTO mode."); - } - } - if(PWMN[1].value != values[1]) - { - if(AutoPWMS[1].s == ISS_OFF) - { - sprintf(cmd, "B:1:%d", static_cast(values[1])); - allOk = allOk && sendCommand(cmd, res); - } - else - { - LOG_WARN("Cannot set PWM output, it is in AUTO mode."); - } - } - PWMNP.s = (allOk) ? IPS_BUSY : IPS_ALERT; - if(allOk) - IUUpdateNumber(&PWMNP, values, names, n); - IDSetNumber(&PWMNP, nullptr); - IDSetSwitch(&AutoPWMSP, nullptr); - return true; - } - - // Focuser settings - if(!strcmp(name, FocuserSettingsNP .name)) - { - bool allOk = true; - std::map updates; - updates[U_SPEED] = doubleToStr(values[FS_SPEED]); - updates[U_ACC] = doubleToStr(values[FS_SPEED] * 2.0); - updates[U_STEPSIZE] = doubleToStr(values[FS_STEP_SIZE] * 100.0); - allOk = allOk && updateSettings("u", "U", updates); - updates.clear(); - updates[E_COMP_CYCLE] = "30"; // cycle [s] - updates[E_COMP_STEPS] = doubleToStr(values[FS_COMPENSATION] * 100.0); - updates[E_COMP_SENSR] = "0"; // sensor - updates[E_COMP_TRGR] = doubleToStr(values[FS_COMP_THRESHOLD]); - allOk = allOk && updateSettings("e", "E", updates); - if(allOk) - { - FocuserSettingsNP.s = IPS_BUSY; - IUUpdateNumber(&FocuserSettingsNP, values, names, n); - IDSetNumber(&FocuserSettingsNP, nullptr); - LOG_INFO(values[FS_COMPENSATION] > 0 ? "Temperature compensation is enabled." : "Temperature compensation is disabled."); - return true; - } - FocuserSettingsNP.s = IPS_ALERT; - return true; - } - - // Other settings - if(!strcmp(name, OtherSettingsNP .name)) - { - std::map updates; - updates[N_AREF_COEFF] = doubleToStr(values[SET_AREF_COEFF] * 1000.0); - updates[N_OVER_VOLT] = doubleToStr(values[SET_OVER_VOLT] * 10.0); - updates[N_OVER_AMP] = doubleToStr(values[SET_OVER_AMP] * 10.0); - updates[N_OVER_TIME] = doubleToStr(values[SET_OVER_TIME]); - if(updateSettings("n", "N", updates)) - { - OtherSettingsNP.s = IPS_BUSY; - IUUpdateNumber(&OtherSettingsNP, values, names, n); - IDSetNumber(&OtherSettingsNP, nullptr); - return true; - } - OtherSettingsNP.s = IPS_ALERT; - return true; - } - - // DC Focuser - if(!strcmp(name, DCFocTimeNP.name)) - { - IUUpdateNumber(&DCFocTimeNP, values, names, n); - IDSetNumber(&DCFocTimeNP, nullptr); - saveConfig(true); - sprintf(cmd, "G:%d:%.0f:%.0f", (DCFocDirS[0].s == ISS_ON) ? 1 : 0, DCFocTimeN[DC_PWM].value, DCFocTimeN[DC_PERIOD].value); - if(sendCommand(cmd, res)) - { - DCFocAbortS[0].s = ISS_OFF; - DCFocAbortSP.s = IPS_OK; - IDSetSwitch(&DCFocAbortSP, nullptr); - - DCFocTimeNP.s = IPS_BUSY; - return true; - } - DCFocTimeNP.s = IPS_ALERT; - return true; - } - - if (strstr(name, "FOCUS_")) - return FI::processNumber(dev, name, values, names, n); - if (strstr(name, "WEATHER_")) - return WI::processNumber(dev, name, values, names, n); - } - - return INDI::DefaultDevice::ISNewNumber(dev, name, values, names, n); -} - - -bool IndiAstrolink4::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) -{ - if (dev && !strcmp(dev, getDeviceName())) - { - char cmd[ASTROLINK4_LEN] = {0}; - char res[ASTROLINK4_LEN] = {0}; - - // handle power line 1 - if (!strcmp(name, Power1SP.name)) - { - sprintf(cmd, "C:0:%s", (strcmp(Power1S[0].name, names[0])) ? "0" : "1"); - bool allOk = sendCommand(cmd, res); - Power1SP.s = allOk ? IPS_BUSY : IPS_ALERT; - if(allOk) - IUUpdateSwitch(&Power1SP, states, names, n); - - IDSetSwitch(&Power1SP, nullptr); - return true; - } - - // handle power line 2 - if (!strcmp(name, Power2SP.name)) - { - sprintf(cmd, "C:1:%s", (strcmp(Power2S[0].name, names[0])) ? "0" : "1"); - bool allOk = sendCommand(cmd, res); - Power2SP.s = allOk ? IPS_BUSY : IPS_ALERT; - if(allOk) - IUUpdateSwitch(&Power2SP, states, names, n); - - IDSetSwitch(&Power2SP, nullptr); - return true; - } - - // handle power line 3 - if (!strcmp(name, Power3SP.name)) - { - sprintf(cmd, "C:2:%s", (strcmp(Power3S[0].name, names[0])) ? "0" : "1"); - bool allOk = sendCommand(cmd, res); - Power3SP.s = allOk ? IPS_BUSY : IPS_ALERT; - if(allOk) - IUUpdateSwitch(&Power3SP, states, names, n); - - IDSetSwitch(&Power3SP, nullptr); - return true; - } - - // compensate now - if(!strcmp(name, CompensateNowSP.name)) - { - sprintf(cmd, "S:%d", static_cast(CompensationValueN[0].value)); - bool allOk = sendCommand(cmd, res); - CompensateNowSP.s = allOk ? IPS_BUSY : IPS_ALERT; - if(allOk) - IUUpdateSwitch(&CompensateNowSP, states, names, n); - - IDSetSwitch(&CompensateNowSP, nullptr); - return true; - } - - // Auto PWM - if (!strcmp(name, AutoPWMSP.name)) - { - IUUpdateSwitch(&AutoPWMSP, states, names, n); - AutoPWMSP.s = (setAutoPWM()) ? IPS_OK : IPS_ALERT; - IDSetSwitch(&AutoPWMSP, nullptr); - return true; - } - - // DC Focuser - if (!strcmp(name, DCFocDirSP.name)) - { - DCFocDirSP.s = IPS_OK; - IUUpdateSwitch(&DCFocDirSP, states, names, n); - IDSetSwitch(&DCFocDirSP, nullptr); - return true; - } - - if (!strcmp(name, DCFocAbortSP.name)) - { - sprintf(cmd, "%s", "K"); - if(sendCommand(cmd, res)) - { - DCFocAbortSP.s = IPS_BUSY; - IUUpdateSwitch(&DCFocAbortSP, states, names, n); - IDSetSwitch(&DCFocAbortSP, nullptr); - } - DCFocAbortSP.s = IPS_ALERT; - return true; - } - - // Power default on - if(!strcmp(name, PowerDefaultOnSP.name)) - { - std::map updates; - updates[U_OUT1_DEF] = (states[0] == ISS_ON) ? "1" : "0"; - updates[U_OUT2_DEF] = (states[1] == ISS_ON) ? "1" : "0"; - updates[U_OUT3_DEF] = (states[2] == ISS_ON) ? "1" : "0"; - if(updateSettings("u", "U", updates)) - { - PowerDefaultOnSP.s = IPS_BUSY; - IUUpdateSwitch(&PowerDefaultOnSP, states, names, n); - IDSetSwitch(&PowerDefaultOnSP, nullptr); - return true; - } - PowerDefaultOnSP.s = IPS_ALERT; - return true; - } - - // Auto PWM default on - if (!strcmp(name, AutoPWMDefaultOnSP.name)) - { - IUUpdateSwitch(&AutoPWMDefaultOnSP, states, names, n); - AutoPWMDefaultOnSP.s = IPS_OK; - saveConfig(); - IDSetSwitch(&AutoPWMDefaultOnSP, nullptr); - return true; - } - - // Buzzer - if(!strcmp(name, BuzzerSP.name)) - { - if(updateSettings("j", "J", 1, (states[0] == ISS_ON) ? "1" : "0")) - { - BuzzerSP.s = IPS_BUSY; - IUUpdateSwitch(&BuzzerSP, states, names, n); - IDSetSwitch(&BuzzerSP, nullptr); - return true; - } - BuzzerSP.s = IPS_ALERT; - return true; - } - - // Manual mode - if(!strcmp(name, FocuserManualSP.name)) - { - sprintf(cmd, "F:%s", (strcmp(FocuserManualS[0].name, names[0])) ? "0" : "1"); - if(sendCommand(cmd, res)) - { - FocuserManualSP.s = IPS_BUSY; - IUUpdateSwitch(&FocuserManualSP, states, names, n); - IDSetSwitch(&FocuserManualSP, nullptr); - return true; - } - FocuserManualSP.s = IPS_ALERT; - return true; - } - - // Focuser Mode - if(!strcmp(name, FocuserModeSP.name)) - { - std::string value = "0"; - if(!strcmp(FocuserModeS[FS_MODE_UNI].name, names[0])) value = "0"; - if(!strcmp(FocuserModeS[FS_MODE_BI].name, names[0])) value = "1"; - if(!strcmp(FocuserModeS[FS_MODE_MICRO].name, names[0])) value = "2"; - if(updateSettings("u", "U", U_STEPPER_MODE, value.c_str())) - { - FocuserModeSP.s = IPS_BUSY; - IUUpdateSwitch(&FocuserModeSP, states, names, n); - IDSetSwitch(&FocuserModeSP, nullptr); - return true; - } - FocuserModeSP.s = IPS_ALERT; - return true; - } - - // Focuser compensation mode - if(!strcmp(name, FocuserCompModeSP.name)) - { - std::string value = "0"; - if(!strcmp(FocuserCompModeS[FS_COMP_AUTO].name, names[0])) value = "1"; - if(updateSettings("e", "E", E_COMP_AUTO, value.c_str())) - { - FocuserCompModeSP.s = IPS_BUSY; - IUUpdateSwitch(&FocuserCompModeSP, states, names, n); - IDSetSwitch(&FocuserCompModeSP, nullptr); - return true; - } - FocuserCompModeSP.s = IPS_ALERT; - return true; - } - - if (strstr(name, "FOCUS")) - return FI::processSwitch(dev, name, states, names, n); - - } - - return INDI::DefaultDevice::ISNewSwitch (dev, name, states, names, n); -} - -bool IndiAstrolink4::ISNewText(const char * dev, const char * name, char * texts[], char * names[], int n) -{ - if (dev && !strcmp(dev, getDeviceName())) - { - // Power Labels - if (!strcmp(name, PowerControlsLabelsTP.name)) - { - IUUpdateText(&PowerControlsLabelsTP, texts, names, n); - PowerControlsLabelsTP.s = IPS_OK; - LOG_INFO("Power port labels saved. Driver must be restarted for the labels to take effect."); - saveConfig(); - IDSetText(&PowerControlsLabelsTP, nullptr); - return true; - } - } - return INDI::DefaultDevice::ISNewText(dev, name, texts, names, n); -} - - -bool IndiAstrolink4::saveConfigItems(FILE *fp) -{ - INDI::DefaultDevice::saveConfigItems(fp); - FI::saveConfigItems(fp); - - IUSaveConfigNumber(fp, &DCFocTimeNP); - IUSaveConfigSwitch(fp, &DCFocDirSP); - IUSaveConfigText(fp, &PowerControlsLabelsTP); - IUSaveConfigSwitch(fp, &AutoPWMDefaultOnSP); - return true; -} - -////////////////////////////////////////////////////////////////////// -/// PWM outputs -////////////////////////////////////////////////////////////////////// -bool IndiAstrolink4::setAutoPWM() -{ - char cmd[ASTROLINK4_LEN] = {0}, res[ASTROLINK4_LEN] = {0}; - bool allOk = true; - - uint8_t valA = (AutoPWMS[0].s == ISS_ON) ? 255 : static_cast(PWMN[0].value); - uint8_t valB = (AutoPWMS[1].s == ISS_ON) ? 255 : static_cast(PWMN[1].value); - - snprintf(cmd, ASTROLINK4_LEN, "B:0:%d", valA); - allOk = allOk && sendCommand(cmd, res); - snprintf(cmd, ASTROLINK4_LEN, "B:1:%d", valB); - allOk = allOk && sendCommand(cmd, res); - - return allOk; -} - -////////////////////////////////////////////////////////////////////// -/// Focuser interface -////////////////////////////////////////////////////////////////////// -IPState IndiAstrolink4::MoveAbsFocuser(uint32_t targetTicks) -{ - int32_t backlash = 0; - if(backlashEnabled) - { - if((targetTicks > FocusAbsPosN[0].value) == (backlashSteps > 0)) - { - if(((int32_t)targetTicks + backlash) < 0 || (targetTicks + backlash) > FocusMaxPosN[0].value) - { - backlash = 0; - } - else - { - backlash = backlashSteps; - requireBacklashReturn = true; - } - } - } - char cmd[ASTROLINK4_LEN] = {0}, res[ASTROLINK4_LEN] = {0}; - snprintf(cmd, ASTROLINK4_LEN, "R:0:%u", targetTicks + backlash); - return (sendCommand(cmd, res)) ? IPS_BUSY : IPS_ALERT; -} - -IPState IndiAstrolink4::MoveRelFocuser(FocusDirection dir, uint32_t ticks) -{ - return MoveAbsFocuser(dir == FOCUS_INWARD ? FocusAbsPosN[0].value - ticks : FocusAbsPosN[0].value + ticks); -} - -bool IndiAstrolink4::AbortFocuser() -{ - char res[ASTROLINK4_LEN] = {0}; - return (sendCommand("H", res)); -} - -bool IndiAstrolink4::ReverseFocuser(bool enabled) -{ - return updateSettings("u", "U", U_REVERSED, (enabled) ? "1" : "0"); -} - -bool IndiAstrolink4::SyncFocuser(uint32_t ticks) -{ - char cmd[ASTROLINK4_LEN] = {0}, res[ASTROLINK4_LEN] = {0}; - snprintf(cmd, ASTROLINK4_LEN, "P:0:%u", ticks); - return sendCommand(cmd, res); -} - -bool IndiAstrolink4::SetFocuserMaxPosition(uint32_t ticks) -{ - if(updateSettings("u", "U", U_MAX_POS, std::to_string(ticks).c_str())) - { - FocuserSettingsNP.s = IPS_BUSY; - return true; - } - else - { - return false; - } -} - -bool IndiAstrolink4::SetFocuserBacklash(int32_t steps) -{ - backlashSteps = steps; - return true; -} - -bool IndiAstrolink4::SetFocuserBacklashEnabled(bool enabled) -{ - backlashEnabled = enabled; - return true; -} - -////////////////////////////////////////////////////////////////////// -/// Serial commands -////////////////////////////////////////////////////////////////////// -bool IndiAstrolink4::sendCommand(const char * cmd, char * res) -{ - int nbytes_read = 0, nbytes_written = 0, tty_rc = 0; - char command[ASTROLINK4_LEN]; - - if(isSimulation()) - { - if(strcmp(cmd, "#") == 0) sprintf(res, "%s\n", "#:AstroLink4mini"); - if(strcmp(cmd, "q") == 0) sprintf(res, "%s\n", - "q:1234:0:1.47:1:2.12:45.1:-12.81:1:-25.22:45:0:0:0:1:12.1:5.0:1.12:13.41:0:34:0:0"); - if(strcmp(cmd, "p") == 0) sprintf(res, "%s\n", "p:1234"); - if(strcmp(cmd, "i") == 0) sprintf(res, "%s\n", "i:0"); - if(strcmp(cmd, "n") == 0) sprintf(res, "%s\n", "n:1077:14.0:10.0:100"); - if(strcmp(cmd, "e") == 0) sprintf(res, "%s\n", "e:30:1200:1:0:20"); - if(strcmp(cmd, "u") == 0) sprintf(res, "%s\n", "u:25000:220:0:100:440:0:0:1:257:0:0:0:0:0:1:0:0"); - if(strncmp(cmd, "R", 1) == 0) sprintf(res, "%s\n", "R:"); - if(strncmp(cmd, "C", 1) == 0) sprintf(res, "%s\n", "C:"); - if(strncmp(cmd, "B", 1) == 0) sprintf(res, "%s\n", "B:"); - if(strncmp(cmd, "H", 1) == 0) sprintf(res, "%s\n", "H:"); - if(strncmp(cmd, "P", 1) == 0) sprintf(res, "%s\n", "P:"); - if(strncmp(cmd, "U", 1) == 0) sprintf(res, "%s\n", "U:"); - if(strncmp(cmd, "S", 1) == 0) sprintf(res, "%s\n", "S:"); - if(strncmp(cmd, "G", 1) == 0) sprintf(res, "%s\n", "G:"); - if(strncmp(cmd, "K", 1) == 0) sprintf(res, "%s\n", "K:"); - if(strncmp(cmd, "N", 1) == 0) sprintf(res, "%s\n", "N:"); - if(strncmp(cmd, "E", 1) == 0) sprintf(res, "%s\n", "E:"); - } - else - { - tcflush(PortFD, TCIOFLUSH); - sprintf(command, "%s\n", cmd); - LOGF_DEBUG("CMD %s", command); - if ( (tty_rc = tty_write_string(PortFD, command, &nbytes_written)) != TTY_OK) - return false; - - if (!res) - { - tcflush(PortFD, TCIOFLUSH); - return true; - } - - if ( (tty_rc = tty_nread_section(PortFD, res, ASTROLINK4_LEN, stopChar, ASTROLINK4_TIMEOUT, &nbytes_read)) != TTY_OK - || nbytes_read == 1) - return false; - - tcflush(PortFD, TCIOFLUSH); - res[nbytes_read - 1] = '\0'; - LOGF_DEBUG("RES %s", res); - - if (tty_rc != TTY_OK) - { - char errorMessage[MAXRBUF]; - tty_error_msg(tty_rc, errorMessage, MAXRBUF); - LOGF_ERROR("Serial error: %s", errorMessage); - return false; - } - } - return (cmd[0] == res[0]); -} - -////////////////////////////////////////////////////////////////////// -/// Sensors -////////////////////////////////////////////////////////////////////// -bool IndiAstrolink4::sensorRead() -{ - char res[ASTROLINK4_LEN] = {0}; - if (sendCommand("q", res)) - { - std::vector result = split(res, ":"); - - float focuserPosition = std::stod(result[Q_STEPPER_POS]); - FocusAbsPosN[0].value = focuserPosition; - FocusPosMMN[0].value = focuserPosition * FocuserSettingsN[FS_STEP_SIZE].value / 1000.0; - float stepsToGo = std::stod(result[Q_STEPS_TO_GO]); - if(stepsToGo == 0) - { - if(requireBacklashReturn) - { - requireBacklashReturn = false; - MoveAbsFocuser(focuserPosition - backlashSteps); - } - FocusAbsPosNP.s = FocusRelPosNP.s = FocusPosMMNP.s = IPS_OK; - IDSetNumber(&FocusRelPosNP, nullptr); - } - else - { - FocusAbsPosNP.s = FocusRelPosNP.s = FocusPosMMNP.s = IPS_BUSY; - } - IDSetNumber(&FocusPosMMNP, nullptr); - IDSetNumber(&FocusAbsPosNP, nullptr); - PowerDataN[POW_ITOT].value = std::stod(result[Q_CURRENT]); - - if(result.size() > 5) - { - if(std::stod(result[Q_SENS1_TYPE]) > 0) - { - setParameterValue("WEATHER_TEMPERATURE", std::stod(result[Q_SENS1_TEMP])); - setParameterValue("WEATHER_HUMIDITY", std::stod(result[Q_SENS1_HUM])); - setParameterValue("WEATHER_DEWPOINT", std::stod(result[Q_SENS1_DEW])); - ParametersNP.setState(IPS_OK); - ParametersNP.apply(); - } - else - { - ParametersNP.setState(IPS_IDLE); - } - - if(std::stod(result[Q_SENS2_TYPE]) > 0) - { - Sensor2N[0].value = std::stod(result[Q_SENS2_TEMP]); - Sensor2NP.s = IPS_OK; - IDSetNumber(&Sensor2NP, nullptr); - } - else - { - Sensor2NP.s = IPS_IDLE; - } - - PWMN[0].value = std::stod(result[Q_PWM1]); - PWMN[1].value = std::stod(result[Q_PWM2]); - PWMNP.s = IPS_OK; - IDSetNumber(&PWMNP, nullptr); - - bool dcMotorMoving = (std::stod(result[Q_DC_MOVE]) > 0); - if(dcMotorMoving) - { - DCFocTimeNP.s = IPS_BUSY; - IDSetNumber(&DCFocTimeNP, nullptr); - } - else if (DCFocTimeNP.s == IPS_BUSY) - { - DCFocTimeNP.s = IPS_OK; - DCFocAbortSP.s = IPS_IDLE; - IDSetNumber(&DCFocTimeNP, nullptr); - IDSetSwitch(&DCFocAbortSP, nullptr); - } - - if(Power1SP.s != IPS_OK || Power2SP.s != IPS_OK || Power3SP.s != IPS_OK) - { - Power1S[0].s = (std::stod(result[Q_OUT1]) > 0) ? ISS_ON : ISS_OFF; - Power1S[1].s = (std::stod(result[Q_OUT1]) == 0) ? ISS_ON : ISS_OFF; - Power1SP.s = IPS_OK; - IDSetSwitch(&Power1SP, nullptr); - Power2S[0].s = (std::stod(result[Q_OUT2]) > 0) ? ISS_ON : ISS_OFF; - Power2S[1].s = (std::stod(result[Q_OUT2]) == 0) ? ISS_ON : ISS_OFF; - Power2SP.s = IPS_OK; - IDSetSwitch(&Power2SP, nullptr); - Power3S[0].s = (std::stod(result[Q_OUT3]) > 0) ? ISS_ON : ISS_OFF; - Power3S[1].s = (std::stod(result[Q_OUT3]) == 0) ? ISS_ON : ISS_OFF; - Power3SP.s = IPS_OK; - IDSetSwitch(&Power3SP, nullptr); - } - - CompensationValueN[0].value = std::stod(result[Q_COMP_DIFF]); - CompensateNowSP.s = CompensationValueNP.s = (CompensationValueN[0].value > 0) ? IPS_OK : IPS_IDLE; - CompensateNowS[0].s = (CompensationValueN[0].value > 0) ? ISS_OFF : ISS_ON; - IDSetNumber(&CompensationValueNP, nullptr); - IDSetSwitch(&CompensateNowSP, nullptr); - - PowerDataN[POW_VIN].value = std::stod(result[Q_VIN]); - PowerDataN[POW_VREG].value = std::stod(result[Q_VREG]); - PowerDataN[POW_AH].value = std::stod(result[Q_AH]); - PowerDataN[POW_WH].value = std::stod(result[Q_WH]); - - if(strcmp(result[Q_OP_FLAG].c_str(), "0")) - { - int opFlag = std::stoi(result[Q_OP_FLAG]); - LOGF_WARN("Protection triggered, outputs were disabled. Reason: %s was too high, value: %.1f", - (opFlag == 1) ? "voltage" : "current", std::stod(result[Q_OP_VALUE])); - } - } - - PowerDataNP.s = IPS_OK; - IDSetNumber(&PowerDataNP, nullptr); - - } - - // update settings data if was changed - if(FocuserSettingsNP.s != IPS_OK || FocuserModeSP.s != IPS_OK || PowerDefaultOnSP.s != IPS_OK || BuzzerSP.s != IPS_OK - || FocuserCompModeSP.s != IPS_OK) - { - if (sendCommand("u", res)) - { - std::vector result = split(res, ":"); - - FocuserModeS[FS_MODE_UNI].s = FocuserModeS[FS_MODE_BI].s = FocuserModeS[FS_MODE_MICRO].s = ISS_OFF; - if(!strcmp("0", result[U_STEPPER_MODE].c_str())) FocuserModeS[FS_MODE_UNI].s = ISS_ON; - if(!strcmp("1", result[U_STEPPER_MODE].c_str())) FocuserModeS[FS_MODE_BI].s = ISS_ON; - if(!strcmp("2", result[U_STEPPER_MODE].c_str())) FocuserModeS[FS_MODE_MICRO].s = ISS_ON; - FocuserModeSP.s = IPS_OK; - IDSetSwitch(&FocuserModeSP, nullptr); - - PowerDefaultOnS[0].s = (std::stod(result[U_OUT1_DEF]) > 0) ? ISS_ON : ISS_OFF; - PowerDefaultOnS[1].s = (std::stod(result[U_OUT2_DEF]) > 0) ? ISS_ON : ISS_OFF; - PowerDefaultOnS[2].s = (std::stod(result[U_OUT3_DEF]) > 0) ? ISS_ON : ISS_OFF; - PowerDefaultOnSP.s = IPS_OK; - IDSetSwitch(&PowerDefaultOnSP, nullptr); - - FocuserSettingsN[FS_SPEED].value = std::stod(result[U_SPEED]); - FocuserSettingsN[FS_STEP_SIZE].value = std::stod(result[U_STEPSIZE]) / 100.0; - FocusMaxPosN[0].value = std::stod(result[U_MAX_POS]); - FocuserSettingsNP.s = IPS_OK; - IDSetNumber(&FocuserSettingsNP, nullptr); - IDSetNumber(&FocusMaxPosNP, nullptr); - } - - if(sendCommand("j", res)) - { - std::vector result = split(res, ":"); - BuzzerS[0].s = (std::stod(result[1]) > 0) ? ISS_ON : ISS_OFF; - BuzzerSP.s = IPS_OK; - IDSetSwitch(&BuzzerSP, nullptr); - } - - if (sendCommand("e", res)) - { - std::vector result = split(res, ":"); - FocuserSettingsN[FS_COMPENSATION].value = std::stod(result[E_COMP_STEPS]) / 100.0; - FocuserSettingsN[FS_COMP_THRESHOLD].value = std::stod(result[E_COMP_TRGR]); - FocuserSettingsNP.s = IPS_OK; - IDSetNumber(&FocuserSettingsNP, nullptr); - - FocuserCompModeS[FS_COMP_MANUAL].s = (std::stod(result[E_COMP_AUTO]) == 0) ? ISS_ON : ISS_OFF; - FocuserCompModeS[FS_COMP_AUTO].s = (std::stod(result[E_COMP_AUTO]) > 0) ? ISS_ON : ISS_OFF; - FocuserCompModeSP.s = IPS_OK; - IDSetSwitch(&FocuserCompModeSP, nullptr); - } - } - - if(FocuserManualSP.s != IPS_OK) - { - if (sendCommand("f", res)) - { - std::vector result = split(res, ":"); - FocuserManualS[FS_MANUAL_OFF].s = (std::stod(result[1]) == 0) ? ISS_ON : ISS_OFF; - FocuserManualS[FS_MANUAL_ON].s = (std::stod(result[1]) > 0) ? ISS_ON : ISS_OFF; - FocuserManualSP.s = IPS_OK; - IDSetSwitch(&FocuserManualSP, nullptr); - } - } - - if(OtherSettingsNP.s != IPS_OK) - { - if (sendCommand("n", res)) - { - std::vector result = split(res, ":"); - OtherSettingsN[SET_AREF_COEFF].value = std::stod(result[N_AREF_COEFF]) / 1000.0; - OtherSettingsN[SET_OVER_TIME].value = std::stod(result[N_OVER_TIME]); - OtherSettingsN[SET_OVER_VOLT].value = std::stod(result[N_OVER_VOLT]) / 10.0; - OtherSettingsN[SET_OVER_AMP].value = std::stod(result[N_OVER_AMP]) / 10.0; - OtherSettingsNP.s = IPS_OK; - IDSetNumber(&OtherSettingsNP, nullptr); - } - } - - return true; -} - -////////////////////////////////////////////////////////////////////// -/// Helper functions -////////////////////////////////////////////////////////////////////// -std::vector IndiAstrolink4::split(const std::string &input, const std::string ®ex) -{ - // passing -1 as the submatch index parameter performs splitting - std::regex re(regex); - std::sregex_token_iterator - first{input.begin(), input.end(), re, -1}, - last; - return {first, last}; -} - -std::string IndiAstrolink4::doubleToStr(double val) -{ - char buf[10]; - sprintf(buf, "%.0f", val); - return std::string(buf); -} - -bool IndiAstrolink4::updateSettings(const char * getCom, const char * setCom, int index, const char * value) -{ - std::map values; - values[index] = value; - return updateSettings(getCom, setCom, values); -} - -bool IndiAstrolink4::updateSettings(const char * getCom, const char * setCom, std::map values) -{ - char cmd[ASTROLINK4_LEN] = {0}, res[ASTROLINK4_LEN] = {0}; - snprintf(cmd, ASTROLINK4_LEN, "%s", getCom); - if(sendCommand(cmd, res)) - { - std::string concatSettings = ""; - std::vector result = split(res, ":"); - if(result.size() >= values.size()) - { - result[0] = setCom; - for(std::map::iterator it = values.begin(); it != values.end(); ++it) - result[it->first] = it->second; - - for (const auto &piece : result) concatSettings += piece + ":"; - snprintf(cmd, ASTROLINK4_LEN, "%s", concatSettings.c_str()); - if(sendCommand(cmd, res)) return true; - } - } - return false; -} diff --git a/indi-astrolink4/indi_astrolink4.h b/indi-astrolink4/indi_astrolink4.h deleted file mode 100644 index 7d5f862df..000000000 --- a/indi-astrolink4/indi_astrolink4.h +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - Copyright(c) 2019 astrojolo.com - . - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - . - This library 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; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*******************************************************************************/ - -#ifndef ASTROLINK4_H -#define ASTROLINK4_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define Q_STEPPER_POS 1 -#define Q_STEPS_TO_GO 2 -#define Q_CURRENT 3 -#define Q_SENS1_TYPE 4 -#define Q_SENS1_TEMP 5 -#define Q_SENS1_HUM 6 -#define Q_SENS1_DEW 7 -#define Q_SENS2_TYPE 8 -#define Q_SENS2_TEMP 9 -#define Q_PWM1 10 -#define Q_PWM2 11 -#define Q_OUT1 12 -#define Q_OUT2 13 -#define Q_OUT3 14 -#define Q_VIN 15 -#define Q_VREG 16 -#define Q_AH 17 -#define Q_WH 18 -#define Q_DC_MOVE 19 -#define Q_COMP_DIFF 20 -#define Q_OP_FLAG 21 -#define Q_OP_VALUE 22 - -#define U_MAX_POS 1 -#define U_SPEED 2 -#define U_PWMSTOP 3 -#define U_PWMRUN 4 -#define U_ACC 5 -#define U_REVERSED 6 -#define U_STEPPER_MODE 7 -#define U_COMPSENS 8 -#define U_STEPSIZE 9 -#define U_PWMPRESC 10 -#define U_STEPPRESC 11 -#define U_BUZ_ENABLED 12 -#define U_HUM_SENS 13 -#define U_DC_REVERSED 14 -#define U_OUT1_DEF 15 -#define U_OUT2_DEF 16 -#define U_OUT3_DEF 17 - -#define E_COMP_CYCLE 1 -#define E_COMP_STEPS 2 -#define E_COMP_SENSR 3 -#define E_COMP_AUTO 4 -#define E_COMP_TRGR 5 - -#define N_AREF_COEFF 1 -#define N_OVER_VOLT 2 -#define N_OVER_AMP 3 -#define N_OVER_TIME 4 - -namespace Connection -{ -class Serial; -} - -class IndiAstrolink4 : public INDI::DefaultDevice, public INDI::FocuserInterface, public INDI::WeatherInterface -{ - -public: - IndiAstrolink4(); - virtual bool initProperties() override; - virtual bool updateProperties() override; - - virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) override; - virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) override; - virtual bool ISNewText(const char * dev, const char * name, char * texts[], char * names[], int n) override; - -protected: - virtual const char *getDefaultName() override; - virtual void TimerHit() override; - virtual bool saveConfigItems(FILE *fp) override; - virtual bool sendCommand(const char * cmd, char * res); - - // Focuser Overrides - virtual IPState MoveAbsFocuser(uint32_t targetTicks) override; - virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override; - virtual bool AbortFocuser() override; - virtual bool ReverseFocuser(bool enabled) override; - virtual bool SyncFocuser(uint32_t ticks) override; - - virtual bool SetFocuserBacklash(int32_t steps) override; - virtual bool SetFocuserBacklashEnabled(bool enabled) override; - virtual bool SetFocuserMaxPosition(uint32_t ticks) override; - - // Weather Overrides - virtual IPState updateWeather() override - { - return IPS_OK; - } - - -private: - virtual bool Handshake(); - int PortFD = -1; - Connection::Serial *serialConnection { nullptr }; - bool updateSettings(const char * getCom, const char * setCom, int index, const char * value); - bool updateSettings(const char * getCom, const char * setCom, std::map values); - std::vector split(const std::string &input, const std::string ®ex); - std::string doubleToStr(double val); - bool sensorRead(); - bool setAutoPWM(); - int32_t calculateBacklash(uint32_t targetTicks); - char stopChar { 0xA }; // new line - bool backlashEnabled = false; - int32_t backlashSteps = 0; - bool requireBacklashReturn = false; - - IText PowerControlsLabelsT[3]; - ITextVectorProperty PowerControlsLabelsTP; - - ISwitch Power1S[2]; - ISwitchVectorProperty Power1SP; - ISwitch Power2S[2]; - ISwitchVectorProperty Power2SP; - ISwitch Power3S[2]; - ISwitchVectorProperty Power3SP; - - INumber Sensor2N[1]; - INumberVectorProperty Sensor2NP; - - INumber PWMN[2]; - INumberVectorProperty PWMNP; - - ISwitch AutoPWMS[2]; - ISwitchVectorProperty AutoPWMSP; - - INumber PowerDataN[5]; - INumberVectorProperty PowerDataNP; - enum - { - POW_VIN, POW_VREG, POW_ITOT, POW_AH, POW_WH - }; - - INumber FocusPosMMN[1]; - INumberVectorProperty FocusPosMMNP; - - INumber CompensationValueN[1]; - INumberVectorProperty CompensationValueNP; - ISwitch CompensateNowS[1]; - ISwitchVectorProperty CompensateNowSP; - - INumber FocuserSettingsN[4]; - INumberVectorProperty FocuserSettingsNP; - enum - { - FS_SPEED, FS_STEP_SIZE, FS_COMPENSATION, FS_COMP_THRESHOLD - }; - ISwitch FocuserModeS[3]; - ISwitchVectorProperty FocuserModeSP; - enum - { - FS_MODE_UNI, FS_MODE_BI, FS_MODE_MICRO - }; - - ISwitch FocuserCompModeS[2]; - ISwitchVectorProperty FocuserCompModeSP; - enum - { - FS_COMP_AUTO, FS_COMP_MANUAL - }; - - ISwitch FocuserManualS[2]; - ISwitchVectorProperty FocuserManualSP; - enum - { - FS_MANUAL_ON, FS_MANUAL_OFF - }; - - ISwitch PowerDefaultOnS[3]; - ISwitchVectorProperty PowerDefaultOnSP; - - ISwitch AutoPWMDefaultOnS[2]; - ISwitchVectorProperty AutoPWMDefaultOnSP; - - INumber OtherSettingsN[4]; - INumberVectorProperty OtherSettingsNP; - enum - { - SET_AREF_COEFF, SET_OVER_TIME, SET_OVER_VOLT, SET_OVER_AMP - }; - - INumber DCFocTimeN[2]; - INumberVectorProperty DCFocTimeNP; - enum - { - DC_PERIOD, DC_PWM - }; - - ISwitch DCFocDirS[2]; - ISwitchVectorProperty DCFocDirSP; - - ISwitch DCFocAbortS[1]; - ISwitchVectorProperty DCFocAbortSP; - - ISwitch BuzzerS[1]; - ISwitchVectorProperty BuzzerSP; - - static constexpr const char *POWER_TAB {"Power"}; - static constexpr const char *ENVIRONMENT_TAB {"Environment"}; - static constexpr const char *SETTINGS_TAB {"Settings"}; - static constexpr const char *DCFOCUSER_TAB {"DC Focuser"}; -}; - -#endif diff --git a/indi-astrolink4/indi_astrolink4.xml.cmake b/indi-astrolink4/indi_astrolink4.xml.cmake deleted file mode 100644 index 651ee8621..000000000 --- a/indi-astrolink4/indi_astrolink4.xml.cmake +++ /dev/null @@ -1,9 +0,0 @@ - - - - - indi_astrolink4 - @ASTROLINK4_VERSION_MAJOR@.@ASTROLINK4_VERSION_MINOR@ - - - diff --git a/indi-astromechfoc/CMakeLists.txt b/indi-astromechfoc/CMakeLists.txt deleted file mode 100644 index a39cff249..000000000 --- a/indi-astromechfoc/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -PROJECT(indi_astromechfoc C CXX) - -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") -include(GNUInstallDirs) - -set(INDI_ASTROMECHFOC_VERSION_MAJOR 0) -set(INDI_ASTROMECHFOC_VERSION_MINOR 2) - -find_package(INDI REQUIRED) -find_package(ZLIB REQUIRED) -find_package(Threads REQUIRED) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_astromechfoc.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_astromechfoc.xml ) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${INDI_INCLUDE_DIR}) - -include(CMakeCommon) - -########### Astromechanics Focuser ########### -set(indiastromechfoc_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/astromech_focuser.cpp - ) - -IF (UNITY_BUILD) - ENABLE_UNITY_BUILD(indiastromechfoc indiastromechfoc_SRCS 10 cpp) -ENDIF () - -add_executable(indi_astromechfoc ${indiastromechfoc_SRCS}) - -target_link_libraries(indi_astromechfoc ${INDI_DRIVER_LIBRARIES} pthread) - -install(TARGETS indi_astromechfoc RUNTIME DESTINATION bin ) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_astromechfoc.xml DESTINATION ${INDI_DATA_DIR}) - - diff --git a/indi-astromechfoc/INSTALL b/indi-astromechfoc/INSTALL deleted file mode 100644 index d1ac9579b..000000000 --- a/indi-astromechfoc/INSTALL +++ /dev/null @@ -1,15 +0,0 @@ -Prerequisities required to build Astromechanics driver -==================================================== -cmake -INDI library with the header files - -To install prerequisities in Debian: ------------------------------------- -sudo apt-get install libindi-dev cmake - -To compile and install: ------------------------ -cd -cmake . -make -sudo make install diff --git a/indi-astromechfoc/LICENSE b/indi-astromechfoc/LICENSE deleted file mode 100644 index 94a9ed024..000000000 --- a/indi-astromechfoc/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/indi-astromechfoc/README b/indi-astromechfoc/README deleted file mode 100644 index dac2f95a2..000000000 --- a/indi-astromechfoc/README +++ /dev/null @@ -1,21 +0,0 @@ -Astromechanics INDI Driver -======================== - -This is the INDI driver for Astromechanics Lens Controller https://astromechanics.org - - -How to Use -========== - -See the INSTALL file for installation instructions. -If you start INDI manually, include the driver into indiserver command: -$ indiserver indi_astromechfoc - -Alternatively when using other software like KStars to start INDI server, just select the driver when starting. - -Then connect to INDI server with any software acting as indi client. -Find the Astromechanics tab and switch to Options tab. Check the port setting, by default it is /dev/ttyUSB0 but it may be different if other similar devices connected to the system. -If the port is correct, click connect in the "Main control" tab. After successful connection more properties should be visible and focuser status should be updated instantly. - -Set Apperture of your lens in Astromechanics/MainControl. Only the index could be set and not the right apperture. 0 indicates apperture completly opened (for example f/2.8), 22 indicates apperture closed (for example f/32). - diff --git a/indi-astromechfoc/astromech_focuser.cpp b/indi-astromechfoc/astromech_focuser.cpp deleted file mode 100644 index c23f6ef3d..000000000 --- a/indi-astromechfoc/astromech_focuser.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - Copyright(c) 2019 Christian Liska. All rights reserved. - - Implementation based on Lacerta MFOC driver - (written 2018 by Franck Le Rhun and Christian Liska). - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - . - This library 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; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*******************************************************************************/ - -#include "astromech_focuser.h" -#include "config.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -static std::unique_ptr Astromechanics_foc(new astromechanics_foc()); - -// Delay for receiving messages -#define FOC_POSMAX_HARDWARE 32767 -#define FOC_POSMIN_HARDWARE 0 - -bool astromechanics_foc::Disconnect() -{ - SetApperture(0); - return true; -} - -void ISSnoopDevice(XMLEle *root) -{ - Astromechanics_foc->ISSnoopDevice(root); -} - -/************************************************************************************ - * -************************************************************************************/ -astromechanics_foc::astromechanics_foc() -{ - setVersion(INDI_ASTROMECHFOC_VERSION_MAJOR, INDI_ASTROMECHFOC_VERSION_MINOR); - FI::SetCapability(FOCUSER_CAN_ABS_MOVE | FOCUSER_CAN_REL_MOVE); -} - -/************************************************************************************ - * -************************************************************************************/ -const char *astromechanics_foc::getDefaultName() -{ - return "Astromechanics FOC"; -} - -/************************************************************************************ - * -************************************************************************************/ -bool astromechanics_foc::initProperties() -{ - INDI::Focuser::initProperties(); - - FocusMaxPosN[0].min = FOC_POSMIN_HARDWARE; - FocusMaxPosN[0].max = FOC_POSMAX_HARDWARE; - FocusMaxPosN[0].step = 500; - FocusMaxPosN[0].value = FOC_POSMAX_HARDWARE; - - FocusAbsPosN[0].min = FOC_POSMIN_HARDWARE; - FocusAbsPosN[0].max = FOC_POSMAX_HARDWARE; - FocusAbsPosN[0].step = 500; - FocusAbsPosN[0].value = 0; - - FocusRelPosN[0].min = FocusAbsPosN[0].min; - FocusRelPosN[0].max = FocusAbsPosN[0].max / 2; - FocusRelPosN[0].step = 250; - FocusRelPosN[0].value = 0; - - // Aperture - IUFillNumber(&AppertureN[0], "LENS_APP", "Index", "%.f", 0, 22, 1, 0); - IUFillNumberVector(&AppertureNP, AppertureN, 1, getDeviceName(), "LENS_APP_SETTING", "Apperture", MAIN_CONTROL_TAB, IP_RW, - 60, IPS_IDLE); - - serialConnection->setDefaultBaudRate(Connection::Serial::B_38400); - return true; -} - -/************************************************************************************ - * -************************************************************************************/ -bool astromechanics_foc::updateProperties() -{ - // Get Initial Position before we define it in the INDI::Focuser class - FocusAbsPosN[0].value = GetAbsFocuserPosition(); - - INDI::Focuser::updateProperties(); - - if (isConnected()) - { - defineProperty(&AppertureNP); - } - else - { - deleteProperty(AppertureNP.name); - } - - return true; -} - -/************************************************************************************ - * -************************************************************************************/ -bool astromechanics_foc::Handshake() -{ - char res[DRIVER_LEN] = {0}; - int position = 0; - for (int i = 0; i < 3; i++) - { - if (!sendCommand("P#", res)) - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - else - { - sscanf(res, "%d", &position); - FocusAbsPosN[0].value = position; - FocusAbsPosNP.s = IPS_OK; - SetApperture(0); - return true; - } - } - - return false; -} - -/************************************************************************************ - * -************************************************************************************/ -bool astromechanics_foc::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) -{ - if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) - { - if (strcmp(name, "LENS_APP_SETTING") == 0) - { - IUUpdateNumber(&AppertureNP, values, names, n); - AppertureNP.s = IPS_OK; - IDSetNumber(&AppertureNP, nullptr); - SetApperture(AppertureN[0].value); - return true; - } - } - - return INDI::Focuser::ISNewNumber(dev, name, values, names, n); -} - -/************************************************************************************ - * -************************************************************************************/ -IPState astromechanics_foc::MoveAbsFocuser(uint32_t targetTicks) -{ - char cmd[DRIVER_LEN] = {0}; - snprintf(cmd, DRIVER_LEN, "M%u#", targetTicks); - if (sendCommand(cmd)) - { - FocusAbsPosN[0].value = GetAbsFocuserPosition(); - return IPS_OK; - } - - return IPS_ALERT; -} - -/************************************************************************************ - * -************************************************************************************/ -IPState astromechanics_foc::MoveRelFocuser(FocusDirection dir, uint32_t ticks) -{ - // Clamp - int32_t offset = ((dir == FOCUS_INWARD) ? -1 : 1) * static_cast(ticks); - int32_t newPosition = FocusAbsPosN[0].value + offset; - newPosition = std::max(static_cast(FocusAbsPosN[0].min), std::min(static_cast(FocusAbsPosN[0].max), - newPosition)); - - FocusAbsPosNP.s = IPS_BUSY; - IDSetNumber(&FocusAbsPosNP, nullptr); - - return MoveAbsFocuser(newPosition); -} - -/************************************************************************************ - * -************************************************************************************/ -bool astromechanics_foc::SetApperture(uint32_t index) -{ - char cmd[DRIVER_LEN] = {0}; - snprintf(cmd, DRIVER_LEN, "A%u#", index); - return sendCommand(cmd); -} - -/************************************************************************************ - * -************************************************************************************/ -uint32_t astromechanics_foc::GetAbsFocuserPosition() -{ - char res[DRIVER_LEN] = {0}; - int position = 0; - - if (!sendCommand("P#", res)) - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - else - { - sscanf(res, "%d", &position); - return position; - } - - return 0; -} - -///////////////////////////////////////////////////////////////////////////// -/// Send Command -///////////////////////////////////////////////////////////////////////////// -bool astromechanics_foc::sendCommand(const char * cmd, char * res, int cmd_len, int res_len) -{ - int nbytes_written = 0, nbytes_read = 0, rc = -1; - tcflush(PortFD, TCIOFLUSH); - - if (cmd_len > 0) - { - char hex_cmd[DRIVER_LEN * 3] = {0}; - hexDump(hex_cmd, cmd, cmd_len); - LOGF_DEBUG("CMD <%s>", hex_cmd); - rc = tty_write(PortFD, cmd, cmd_len, &nbytes_written); - } - else - { - LOGF_DEBUG("CMD <%s>", cmd); - rc = tty_write_string(PortFD, cmd, &nbytes_written); - } - - if (rc != TTY_OK) - { - char errstr[MAXRBUF] = {0}; - tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR("Serial write error: %s.", errstr); - return false; - } - - if (res == nullptr) - return true; - - if (res_len > 0) - rc = tty_read(PortFD, res, res_len, DRIVER_TIMEOUT, &nbytes_read); - else - { - // Read respose - rc = tty_nread_section(PortFD, res, DRIVER_LEN, DRIVER_STOP_CHAR, DRIVER_TIMEOUT, &nbytes_read); - } - - if (rc != TTY_OK) - { - char errstr[MAXRBUF] = {0}; - tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR("Serial read error: %s.", errstr); - return false; - } - - if (res_len > 0) - { - char hex_res[DRIVER_LEN * 3] = {0}; - hexDump(hex_res, res, res_len); - LOGF_DEBUG("RES <%s>", hex_res); - } - else - { - // Remove extra # - res[nbytes_read - 1] = 0; - LOGF_DEBUG("RES <%s>", res); - } - - tcflush(PortFD, TCIOFLUSH); - - return true; -} - -///////////////////////////////////////////////////////////////////////////// -/// -///////////////////////////////////////////////////////////////////////////// -void astromechanics_foc::hexDump(char * buf, const char * data, int size) -{ - for (int i = 0; i < size; i++) - sprintf(buf + 3 * i, "%02X ", static_cast(data[i])); - - if (size > 0) - buf[3 * size - 1] = '\0'; -} - -///////////////////////////////////////////////////////////////////////////// -/// -///////////////////////////////////////////////////////////////////////////// -std::vector astromechanics_foc::split(const std::string &input, const std::string ®ex) -{ - // passing -1 as the submatch index parameter performs splitting - std::regex re(regex); - std::sregex_token_iterator - first{input.begin(), input.end(), re, -1}, - last; - return {first, last}; -} diff --git a/indi-astromechfoc/astromech_focuser.h b/indi-astromechfoc/astromech_focuser.h deleted file mode 100644 index adec20da9..000000000 --- a/indi-astromechfoc/astromech_focuser.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - Copyright(c) 2019 Christian Liska. All rights reserved. - - Implementation based on Lacerta MFOC driver - (written 2018 by Franck Le Rhun and Christian Liska). - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - . - This library 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; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*******************************************************************************/ - -#pragma once - -#include "indifocuser.h" - -class astromechanics_foc : public INDI::Focuser -{ - public: - astromechanics_foc(); - bool initProperties() override; - bool updateProperties() override; - const char *getDefaultName() override; - virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; - - protected: - virtual bool Disconnect() override; - virtual bool Handshake() override; - virtual IPState MoveAbsFocuser(uint32_t targetTicks) override; - virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override; - - private: - virtual uint32_t GetAbsFocuserPosition(); - virtual bool SetApperture(uint32_t index); - - INumberVectorProperty AppertureNP; - INumber AppertureN[1]; - - bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1); - void hexDump(char * buf, const char * data, int size); - std::vector split(const std::string &input, const std::string ®ex); - - // # is the stop char - static const char DRIVER_STOP_CHAR { 0x23 }; - // Wait up to a maximum of 3 seconds for serial input - static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. - static constexpr const uint8_t DRIVER_LEN {64}; -}; diff --git a/indi-astromechfoc/config.h.cmake b/indi-astromechfoc/config.h.cmake deleted file mode 100644 index 46a632252..000000000 --- a/indi-astromechfoc/config.h.cmake +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -/* Define INDI Data Dir */ -#cmakedefine INDI_DATA_DIR "@INDI_DATA_DIR@" - -/* Define Driver version */ -#define INDI_ASTROMECHFOC_VERSION_MAJOR @INDI_ASTROMECHFOC_VERSION_MAJOR@ -#define INDI_ASTROMECHFOC_VERSION_MINOR @INDI_ASTROMECHFOC_VERSION_MINOR@ - -#endif // CONFIG_H diff --git a/indi-astromechfoc/indi-astromechfoc.spec b/indi-astromechfoc/indi-astromechfoc.spec deleted file mode 100644 index 0b851ed88..000000000 --- a/indi-astromechfoc/indi-astromechfoc.spec +++ /dev/null @@ -1,77 +0,0 @@ -%define __cmake_in_source_build %{_vpath_builddir} -Name: indi-astromechfoc -Version:2.0.7.git -Release: %(date -u +%%Y%%m%%d%%H%%M%%S)%{?dist} -Summary: Instrument Neutral Distributed Interface 3rd party drivers - -License: LGPLv2 -# See COPYRIGHT file for a description of the licenses and files covered - -URL: https://indilib.org -Source0: https://github.com/indilib/indi-3rdparty/archive/master.tar.gz - -BuildRequires: cmake -BuildRequires: libfli-devel -BuildRequires: libnova-devel -BuildRequires: qt5-qtbase-devel -BuildRequires: systemd -BuildRequires: gphoto2-devel -BuildRequires: LibRaw-devel -BuildRequires: indi-libs -BuildRequires: indi-devel -BuildRequires: libtiff-devel -BuildRequires: cfitsio-devel -BuildRequires: zlib-devel -BuildRequires: gsl-devel -BuildRequires: libcurl-devel -BuildRequires: libjpeg-turbo-devel -BuildRequires: fftw-devel -BuildRequires: libftdi-devel -BuildRequires: gpsd-devel -BuildRequires: libdc1394-devel -BuildRequires: boost-devel -BuildRequires: boost-regex -BuildRequires: libasi - -BuildRequires: gmock - -BuildRequires: pkgconfig(fftw3) -BuildRequires: pkgconfig(cfitsio) -BuildRequires: pkgconfig(libcurl) -BuildRequires: pkgconfig(gsl) -BuildRequires: pkgconfig(libjpeg) -BuildRequires: pkgconfig(libusb-1.0) -BuildRequires: pkgconfig(zlib) - -%description -INDI is a distributed control protocol designed to operate -astronomical instrumentation. INDI is small, flexible, easy to parse, -and scalable. It supports common DCS functions such as remote control, -data acquisition, monitoring, and a lot more. This is a 3rd party driver. - - -%prep -v -%autosetup -v -p1 -n indi-3rdparty-master - -%build -# This package tries to mix and match PIE and PIC which is wrong and will -# trigger link errors when LTO is enabled. -# Disable LTO -%define _lto_cflags %{nil} - -cd indi-astromechfoc -%cmake -DINDI_DATA_DIR=/usr/share/indi . -make VERBOSE=1 %{?_smp_mflags} -j4 - -%install -cd indi-astromechfoc -make DESTDIR=%{buildroot} install - -%files -%{_bindir}/* -%{_datadir}/indi - -%changelog -* Sun Jul 19 2020 Jim Howard 1.8.7.git-1 -- update to build from git for copr, credit to Sergio Pascual and Christian Dersch for prior work on spec files - diff --git a/indi-astromechfoc/indi_astromechfoc.xml.cmake b/indi-astromechfoc/indi_astromechfoc.xml.cmake deleted file mode 100644 index 468870c04..000000000 --- a/indi-astromechfoc/indi_astromechfoc.xml.cmake +++ /dev/null @@ -1,10 +0,0 @@ - - - - - indi_astromechfoc - @INDI_ASTROMECHFOC_VERSION_MAJOR@.@INDI_ASTROMECHFOC_VERSION_MINOR@ - - - - diff --git a/indi-dreamfocuser/AUTHORS b/indi-dreamfocuser/AUTHORS deleted file mode 100644 index f2737b94f..000000000 --- a/indi-dreamfocuser/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Piotr Dlugosz (pidlug AT gmail DOT com) diff --git a/indi-dreamfocuser/CMakeLists.txt b/indi-dreamfocuser/CMakeLists.txt deleted file mode 100644 index 94d18cc9f..000000000 --- a/indi-dreamfocuser/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -PROJECT(indi_dreamfocuser_focus C CXX) - -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") -include(GNUInstallDirs) - -set (DREAMFOCUSER_VERSION_MAJOR 2) -set (DREAMFOCUSER_VERSION_MINOR 1) - -find_package(INDI REQUIRED) -find_package(Threads REQUIRED) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_dreamfocuser_focus.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_dreamfocuser_focus.xml) - -include_directories( ${CMAKE_CURRENT_BINARY_DIR}) -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}) -include_directories( ${INDI_INCLUDE_DIR}) - -include(CMakeCommon) - -########### DreamFocuser Focuser ########### -set(indidreamfocuser_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/dreamfocuser.cpp - ) - -IF (UNITY_BUILD) - ENABLE_UNITY_BUILD(indidreamfocuser indidreamfocuser_SRCS 10 cpp) -ENDIF () - -add_executable(indi_dreamfocuser_focus ${indidreamfocuser_SRCS}) - -target_link_libraries(indi_dreamfocuser_focus ${INDI_DRIVER_LIBRARIES} pthread) - -install(TARGETS indi_dreamfocuser_focus RUNTIME DESTINATION bin ) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_dreamfocuser_focus.xml DESTINATION ${INDI_DATA_DIR}) diff --git a/indi-dreamfocuser/INSTALL b/indi-dreamfocuser/INSTALL deleted file mode 100644 index d4742618d..000000000 --- a/indi-dreamfocuser/INSTALL +++ /dev/null @@ -1,15 +0,0 @@ -Prerequisities required to build DreamFocuser driver -==================================================== -cmake -INDI library with the header files - -To install prerequisities in Debian: ------------------------------------- -sudo apt-get install libindi-dev cmake - -To compile and install: ------------------------ -cd -cmake . -make -sudo make install diff --git a/indi-dreamfocuser/README b/indi-dreamfocuser/README deleted file mode 100644 index 240948fa9..000000000 --- a/indi-dreamfocuser/README +++ /dev/null @@ -1,19 +0,0 @@ -DreamFocuser INDI Driver -======================== - -This is the INDI driver for DreamFocuser http://astromaniak.pl/viewtopic.php?f=1&t=39917 - - -How to Use -========== - -See the INSTALL file for installation instructions. -If you start INDI manually, include the driver into indiserver command: -$ indiserver indi_dreamfocuser_focus - -Alternatively when using other software like KStars to start INDI server, just select the driver when starting. - -Then connect to INDI server with any software acting as indi client. -Find the DreamFocuser tab and na switch to Options tab. Check the port setting, by default it is /dev/ttyACM0 but it may be different if other similar devices connected to the system. -If the port is correct, click connect in the "Main control" tab. After successful connection more properties should be visible and focuser status should be updated instantly. - diff --git a/indi-dreamfocuser/config.h.cmake b/indi-dreamfocuser/config.h.cmake deleted file mode 100644 index 628f9f494..000000000 --- a/indi-dreamfocuser/config.h.cmake +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -/* Define INDI Data Dir */ -#cmakedefine INDI_DATA_DIR "@INDI_DATA_DIR@" -/* Define Driver version */ -#define DREAMFOCUSER_VERSION_MAJOR @DREAMFOCUSER_VERSION_MAJOR@ -#define DREAMFOCUSER_VERSION_MINOR @DREAMFOCUSER_VERSION_MINOR@ - -#endif // CONFIG_H diff --git a/indi-dreamfocuser/dreamfocuser.cpp b/indi-dreamfocuser/dreamfocuser.cpp deleted file mode 100644 index 9ddf344ba..000000000 --- a/indi-dreamfocuser/dreamfocuser.cpp +++ /dev/null @@ -1,799 +0,0 @@ -/* - INDI Driver for DreamFocuser - - Copyright (C) 2016 Piotr Dlugosz - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dreamfocuser.h" -#include "config.h" -#include "connectionplugins/connectionserial.h" - -/* -COMMANDS: - -MMabcd0z - set position x -response - MMabcd0z - -MH00000z - stop -response - MH00000z - -MP00000z - read position -response - MPabcd0z - -MI00000z - is moving -response - MI000d0z - d = 1: yes, 0: no - -MT00000z - read temperature -response - MT00cd0z - temperature = ((c<<8)|d)/16.0 - -MA0000nz - read memory dword - n = address -response - MAabcd0z(?) - -MBabcdnz - write memory dword - abcd = content, n = address -response - MBabcd0z(?) - -MC0000nz - read memory word - n = address -response - - -MDab00nz - write memory word - ab = content, n = address -response - - ----- - -MR000d0z - move with speed d & 0b1111111 (0 - 127), direction d >> 7 (1 up, 0 down) -response - MR000d0z - -MW00000z - is calibrated -response - MW000d0z - d = 1: yes (absolute mode), 0: no (relative mode) - -MZabcd0z - calibrate toposition x -response - MZabcd0z - -MV00000z - firmware version -response - MV00cd0z - version: c.d - -MG00000z - park -response - MG00000z -*/ - -#define PARK_PARK 0 -#define PARK_UNPARK 1 - -// We declare an auto pointer to DreamFocuser. -static std::unique_ptr dreamFocuser(new DreamFocuser()); - -void ISPoll(void *p); - - -/**************************************************************** -** -** -*****************************************************************/ - -DreamFocuser::DreamFocuser() -{ - FI::SetCapability(FOCUSER_CAN_ABS_MOVE | FOCUSER_CAN_REL_MOVE | FOCUSER_CAN_ABORT | FOCUSER_CAN_SYNC); - - isAbsolute = false; - isMoving = false; - isParked = 0; - isVcc12V = false; - - setVersion(DREAMFOCUSER_VERSION_MAJOR, DREAMFOCUSER_VERSION_MINOR); - -} - -bool DreamFocuser::initProperties() -{ - INDI::Focuser::initProperties(); - - // Default speed - //FocusSpeedN[0].min = 0; - //FocusSpeedN[0].max = 127; - //FocusSpeedN[0].value = 50; - //IUUpdateMinMax(&FocusSpeedNP); - - // Max Position - // IUFillNumber(&MaxPositionN[0], "MAXPOSITION", "Ticks", "%.f", 1., 500000., 1000., 300000); - // IUFillNumberVector(&MaxPositionNP, MaxPositionN, 1, getDeviceName(), "MAXPOSITION", "Max Absolute Position", FOCUS_SETTINGS_TAB, IP_RW, 0, IPS_IDLE); - - // IUFillNumber(&MaxTravelN[0], "MAXTRAVEL", "Ticks", "%.f", 1., 500000., 1000., 300000.); - // IUFillNumberVector(&MaxTravelNP, MaxTravelN, 1, getDeviceName(), "MAXTRAVEL", "Max Relative Travel", FOCUS_SETTINGS_TAB, IP_RW, 0, IPS_IDLE ); - - // // Focus Sync - // IUFillSwitch(&SyncS[0], "SYNC", "Synchronize", ISS_OFF); - // IUFillSwitchVector(&SyncSP, SyncS, 1, getDeviceName(), "SYNC", "Synchronize", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); - - // Focus Park - IUFillSwitch(&ParkS[PARK_PARK], "PARK", "Park", ISS_OFF); - IUFillSwitch(&ParkS[PARK_UNPARK], "UNPARK", "Unpark", ISS_OFF); - IUFillSwitchVector(&ParkSP, ParkS, 2, getDeviceName(), "PARK", "Park", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE); - - // Focuser temperature - IUFillNumber(&TemperatureN[0], "TEMPERATURE", "Celsius", "%6.2f", -100, 100, 0, 0); - IUFillNumberVector(&TemperatureNP, TemperatureN, 1, getDeviceName(), "FOCUS_TEMPERATURE", "Temperature", MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE); - - // Focuser humidity and dewpoint - IUFillNumber(&WeatherN[0], "FOCUS_HUMIDITY", "Humidity [%]", "%6.1f", 0, 100, 0, 0); - IUFillNumber(&WeatherN[1], "FOCUS_DEWPOINT", "Dew point [C]", "%6.1f", -100, 100, 0, 0); - IUFillNumberVector(&WeatherNP, WeatherN, 2, getDeviceName(), "FOCUS_WEATHER", "Weather", MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE); - - // We init here the property we wish to "snoop" from the target device - IUFillSwitch(&StatusS[0], "ABSOLUTE", "Absolute", ISS_OFF); - IUFillSwitch(&StatusS[1], "MOVING", "Moving", ISS_OFF); - IUFillSwitch(&StatusS[2], "PARKED", "Parked", ISS_OFF); - IUFillSwitchVector(&StatusSP, StatusS, 3, getDeviceName(), "STATUS", "Status", MAIN_CONTROL_TAB, IP_RO, ISR_NOFMANY, 0, IPS_IDLE); - - // PresetN[0].min = PresetN[1].min = PresetN[2].min = FocusAbsPosN[0].min = -MaxPositionN[0].value; - // PresetN[0].max = PresetN[1].max = PresetN[2].max = FocusAbsPosN[0].max = MaxPositionN[0].value; - // strcpy(PresetN[0].format, "%6.0f"); - // strcpy(PresetN[1].format, "%6.0f"); - // strcpy(PresetN[2].format, "%6.0f"); - // PresetN[0].step = PresetN[1].step = PresetN[2].step = FocusAbsPosN[0].step = DREAMFOCUSER_STEP_SIZE; - - // Maximum position can't be changed from driver - FocusMaxPosNP.p = IP_RO; - - FocusAbsPosN[0].value = 0; - FocusRelPosN[0].min = -FocusMaxPosN[0].max; - FocusRelPosN[0].max = FocusMaxPosN[0].max; - FocusRelPosN[0].step = DREAMFOCUSER_STEP_SIZE; - FocusRelPosN[0].value = 5 * DREAMFOCUSER_STEP_SIZE; - - serialConnection->setDefaultPort("/dev/ttyACM0"); - serialConnection->setDefaultBaudRate(Connection::Serial::B_115200); - setDefaultPollingPeriod(500); - - return true; -} - -bool DreamFocuser::updateProperties() -{ - INDI::Focuser::updateProperties(); - - if (isConnected()) - { - //defineProperty(&SyncSP); - defineProperty(&ParkSP); - defineProperty(&TemperatureNP); - defineProperty(&WeatherNP); - defineProperty(&StatusSP); - //defineProperty(&MaxPositionNP); - //defineProperty(&MaxTravelNP); - } - else - { - //deleteProperty(SyncSP.name); - deleteProperty(ParkSP.name); - deleteProperty(TemperatureNP.name); - deleteProperty(WeatherNP.name); - deleteProperty(StatusSP.name); - //deleteProperty(MaxPositionNP.name); - //deleteProperty(MaxTravelNP.name); - } - return true; -} - - -/* -void DreamFocuser::ISGetProperties(const char *dev) -{ - if(dev && strcmp(dev,getDeviceName())) - { - defineProperty(&MaxPositionNP); - loadConfig(true, "MAXPOSITION"); - }; - return INDI::Focuser::ISGetProperties(dev); -} -*/ - - -//bool DreamFocuser::saveConfigItems(FILE *fp) -//{ -// INDI::Focuser::saveConfigItems(fp); - -// IUSaveConfigNumber(fp, &MaxPositionNP); -// IUSaveConfigNumber(fp, &MaxTravelNP); - -// return true; -//} - -//bool DreamFocuser::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) -//{ - -// if(strcmp(dev, getDeviceName()) == 0) -// { -// // Max Position -// if (!strcmp(MaxPositionNP.name, name)) -// { -// IUUpdateNumber(&MaxPositionNP, values, names, n); - -// if (MaxPositionN[0].value > 0) -// { -// PresetN[0].min = PresetN[1].min = PresetN[2].min = FocusAbsPosN[0].min = -MaxPositionN[0].value;; -// PresetN[0].max = PresetN[1].max = PresetN[2].max = FocusAbsPosN[0].max = MaxPositionN[0].value; -// IUUpdateMinMax(&FocusAbsPosNP); -// IUUpdateMinMax(&PresetNP); -// IDSetNumber(&FocusAbsPosNP, nullptr); - -// LOGF_DEBUG("Focuser absolute limits: min (%g) max (%g)", FocusAbsPosN[0].min, FocusAbsPosN[0].max); -// } - -// MaxPositionNP.s = IPS_OK; -// IDSetNumber(&MaxPositionNP, nullptr); -// return true; -// } - - -// // Max Travel -// if (!strcmp(MaxTravelNP.name, name)) -// { -// IUUpdateNumber(&MaxTravelNP, values, names, n); - -// if (MaxTravelN[0].value > 0) -// { -// FocusRelPosN[0].min = 0; -// FocusRelPosN[0].max = MaxTravelN[0].value; -// IUUpdateMinMax(&FocusRelPosNP); -// IDSetNumber(&FocusRelPosNP, nullptr); - -// LOGF_DEBUG("Focuser relative limits: min (%g) max (%g)", FocusRelPosN[0].min, FocusRelPosN[0].max); -// } - -// MaxTravelNP.s = IPS_OK; -// IDSetNumber(&MaxTravelNP, nullptr); -// return true; -// } - -// } - -// return INDI::Focuser::ISNewNumber(dev, name, values, names, n); - -//} - - -bool DreamFocuser::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) -{ - if(strcmp(dev, getDeviceName()) == 0) - { - // Park - if (!strcmp(ParkSP.name, name)) - { - IUUpdateSwitch(&ParkSP, states, names, n); - int index = IUFindOnSwitchIndex(&ParkSP); - IUResetSwitch(&ParkSP); - - if ( (isParked && (index == PARK_UNPARK)) || ( !isParked && (index == PARK_PARK)) ) - { - LOG_INFO("Park, issuing command."); - if ( setPark() ) - { - //ParkSP.s = IPS_OK; - FocusAbsPosNP.s = IPS_OK; - IDSetNumber(&FocusAbsPosNP, nullptr); - } - else - ParkSP.s = IPS_ALERT; - } - IDSetSwitch(&ParkSP, nullptr); - return true; - } - } - - return INDI::Focuser::ISNewSwitch(dev, name, states, names, n); -} - -bool DreamFocuser::SyncFocuser(uint32_t ticks) -{ - return setSync(ticks); -} - -/**************************************************************** -** -** -*****************************************************************/ - -bool DreamFocuser::getTemperature() -{ - if ( dispatch_command('T') ) - { - currentTemperature = ((short int)( (currentResponse.c << 8) | currentResponse.d )) / 10.; - currentHumidity = ((short int)( (currentResponse.a << 8) | currentResponse.b )) / 10.; - } - else - return false; - return true; -} - -bool DreamFocuser::Handshake() -{ - return getStatus(); -} - -bool DreamFocuser::getStatus() -{ - LOG_DEBUG("getStatus."); - if ( dispatch_command('I') ) - { - isMoving = ( currentResponse.d & 3 ) != 0 ? true : false; - //isZero = ( (currentResponse.d>>2) & 1 ) == 1; - isParked = (currentResponse.d>>3) & 3; - isVcc12V = ( (currentResponse.d>>5) & 1 ) == 1; - } - else - return false; - - if ( dispatch_command('W') ) // Is absolute? - isAbsolute = currentResponse.d == 1 ? true : false; - else - return false; - - return true; -} - - -bool DreamFocuser::getPosition() -{ - //int32_t pos; - - if ( dispatch_command('P') ) - currentPosition = (currentResponse.a << 24) | (currentResponse.b << 16) | (currentResponse.c << 8) | currentResponse.d; - else - return false; - - return true; -} - - -bool DreamFocuser::setPosition( int32_t position) -{ - if ( dispatch_command('M', position) ) - if ( ((currentResponse.a << 24) | (currentResponse.b << 16) | (currentResponse.c << 8) | currentResponse.d) == position ) - { - LOGF_DEBUG("Moving to position %d", position); - return true; - }; - return false; -} - -bool DreamFocuser::getMaxPosition() -{ - if ( dispatch_command('A', 0, 3) ) - { - currentMaxPosition = (currentResponse.a << 24) | (currentResponse.b << 16) | (currentResponse.c << 8) | currentResponse.d; - LOGF_DEBUG("getMaxPosition: %d", currentMaxPosition); - return true; - } - else - LOG_ERROR("getMaxPosition error"); - - return false; -} - - -bool DreamFocuser::setSync( uint32_t position) -{ - if ( dispatch_command('Z', position) ) - if ( static_cast((currentResponse.a << 24) | (currentResponse.b << 16) | (currentResponse.c << 8) | currentResponse.d) == position ) - { - LOGF_DEBUG("Syncing to position %d", position); - return true; - }; - LOG_ERROR("Sync failed."); - return false; -} - -bool DreamFocuser::setPark() -{ - if (isAbsolute == false) - { - LOG_ERROR("Focuser is not in Absolute mode. Please sync before to allow parking."); - return false; - } - - if ( dispatch_command('G') ) - { - LOG_INFO( "Focuser park command."); - return true; - } - LOG_ERROR("Park failed."); - return false; -} - -bool DreamFocuser::AbortFocuser() -{ - if ( dispatch_command('H') ) - { - LOG_INFO("Focusing aborted."); - return true; - }; - LOG_ERROR("Abort failed."); - return false; -} - - -/* -IPState DreamFocuser::MoveFocuser(FocusDirection dir, int speed, uint16_t duration) -{ - DreamFocuserCommand c; - unsigned char d = (unsigned char) (speed & 0b01111111) | (dir == FOCUS_INWARD) ? 0b10000000 : 0; - - if ( dispatch_command('R', d) ) - { - gettimeofday(&focusMoveStart,nullptr); - focusMoveRequest = duration/1000.0; - if ( read_response() ) - if ( ( currentResponse.k == 'R' ) && (currentResponse.d == d) ) - if (duration <= getCurrentPollingPeriod()) - { - usleep(getCurrentPollingPeriod() * 1000); - AbortFocuser(); - return IPS_OK; - } - else - return IPS_BUSY; - } - return IPS_ALERT; -} -*/ - -IPState DreamFocuser::MoveAbsFocuser(uint32_t ticks) -{ - LOGF_DEBUG("MoveAbsPosition: %d", ticks); - - if (isAbsolute == false) - { - LOG_ERROR("Focuser is not in Absolute mode. Please sync."); - return IPS_ALERT; - } - - if (isParked != 0) - { - LOG_ERROR("Please unpark before issuing any motion commands."); - return IPS_ALERT; - } - if ( setPosition(ticks) ) - { - FocusAbsPosNP.s = IPS_OK; - IDSetNumber(&FocusAbsPosNP, nullptr); - return IPS_OK; - } - return IPS_ALERT; -} - -IPState DreamFocuser::MoveRelFocuser(FocusDirection dir, uint32_t ticks) -{ - int32_t finalTicks = currentPosition + ((int32_t)ticks * (dir == FOCUS_INWARD ? -1 : 1)); - - LOGF_DEBUG("MoveRelPosition: %d", finalTicks); - - if (isParked != 0) - { - LOG_ERROR("Please unpark before issuing any motion commands."); - return IPS_ALERT; - } - - if ( setPosition(finalTicks) ) - { - FocusRelPosNP.s = IPS_OK; - IDSetNumber(&FocusRelPosNP, nullptr); - return IPS_OK; - } - return IPS_ALERT; -} - - -void DreamFocuser::TimerHit() -{ - - if ( ! isConnected() ) - return; - - int oldAbsStatus = FocusAbsPosNP.s; - int32_t oldPosition = currentPosition; - - if ( getMaxPosition() ) - { - if ( FocusMaxPosN[0].value != currentMaxPosition ) { - FocusMaxPosN[0].value = currentMaxPosition; - FocusMaxPosNP.s = IPS_OK; - IDSetNumber(&FocusMaxPosNP, nullptr); - SetFocuserMaxPosition(currentMaxPosition); - } - } - else - FocusMaxPosNP.s = IPS_ALERT; - - if ( getStatus() ) - { - - StatusSP.s = IPS_OK; - if ( isMoving ) - { - //LOG_INFO("Moving" ); - FocusAbsPosNP.s = IPS_BUSY; - StatusS[1].s = ISS_ON; - } - else - { - if ( FocusAbsPosNP.s != IPS_IDLE ) - FocusAbsPosNP.s = IPS_OK; - StatusS[1].s = ISS_OFF; - }; - - if ( isParked == 1 ) - { - ParkSP.s = IPS_BUSY; - StatusS[2].s = ISS_ON; - ParkS[0].s = ISS_ON; - } - else if ( isParked == 2 ) - { - ParkSP.s = IPS_OK; - StatusS[2].s = ISS_ON; - ParkS[0].s = ISS_ON; - } - else - { - StatusS[2].s = ISS_OFF; - ParkS[1].s = ISS_ON; - ParkSP.s = IPS_IDLE; - } - - if ( isAbsolute ) - { - StatusS[0].s = ISS_ON; - if ( FocusAbsPosN[0].min != 0 ) - { - FocusAbsPosN[0].min = 0; - IDSetNumber(&FocusAbsPosNP, nullptr); - } - } - else - { - if ( FocusAbsPosN[0].min == 0 ) - { - FocusAbsPosN[0].min = -FocusAbsPosN[0].max; - IDSetNumber(&FocusAbsPosNP, nullptr); - } - StatusS[0].s = ISS_OFF; - } - - } - else - StatusSP.s = IPS_ALERT; - - if ( getTemperature() ) - { - TemperatureNP.s = TemperatureN[0].value != currentTemperature ? IPS_BUSY : IPS_OK; - WeatherNP.s = WeatherN[1].value != currentHumidity ? IPS_BUSY : IPS_OK; - TemperatureN[0].value = currentTemperature; - WeatherN[0].value = currentHumidity; - WeatherN[1].value = pow(currentHumidity / 100, 1.0 / 8) * (112 + 0.9 * currentTemperature) + 0.1 * currentTemperature - 112; - } - else - { - TemperatureNP.s = IPS_ALERT; - WeatherNP.s = IPS_ALERT; - } - - if ( FocusAbsPosNP.s != IPS_IDLE ) - { - if ( getPosition() ) - { - if ( oldPosition != currentPosition ) - { - FocusAbsPosNP.s = IPS_BUSY; - StatusS[1].s = ISS_ON; - FocusAbsPosN[0].value = currentPosition; - } - else - { - StatusS[1].s = ISS_OFF; - FocusAbsPosNP.s = IPS_OK; - } - //if ( currentPosition < 0 ) - // FocusAbsPosNP.s = IPS_ALERT; - } - else - FocusAbsPosNP.s = IPS_ALERT; - } - - - if ((oldAbsStatus != FocusAbsPosNP.s) || (oldPosition != currentPosition)) - IDSetNumber(&FocusAbsPosNP, nullptr); - - IDSetNumber(&TemperatureNP, nullptr); - IDSetNumber(&WeatherNP, nullptr); - //IDSetSwitch(&SyncSP, nullptr); - IDSetSwitch(&StatusSP, nullptr); - IDSetSwitch(&ParkSP, NULL); - - SetTimer(getCurrentPollingPeriod()); - -} - - -/**************************************************************** -** -** -*****************************************************************/ - -unsigned char DreamFocuser::calculate_checksum(DreamFocuserCommand c) -{ - unsigned char z; - - // calculate checksum - z = (c.M + c.k + c.a + c.b + c.c + c.d + c.addr) & 0xff; - return z; -} - -bool DreamFocuser::send_command(char k, uint32_t l, unsigned char addr) -{ - DreamFocuserCommand c; - int err_code = 0, nbytes_written = 0; - char dreamFocuser_error[DREAMFOCUSER_ERROR_BUFFER]; - unsigned char *x = (unsigned char *)&l; - - switch(k) - { - case 'M': - case 'Z': - c.a = x[3]; - c.b = x[2]; - c.c = x[1]; - c.d = x[0]; - break; - case 'H': - case 'P': - case 'I': - case 'T': - case 'W': - case 'G': - case 'V': - c.a = 0; - c.b = 0; - c.c = 0; - c.d = 0; - break; - case 'R': - c.a = 0; - c.b = 0; - c.c = 0; - c.d = x[0]; - break; - case 'A': - case 'C': - c.a = 0; - c.b = 0; - c.c = 0; - c.d = x[0]; - break; - case 'B': - case 'D': - c.a = x[3]; - c.b = x[2]; - c.c = 0; - c.d = x[0]; - break; - default: - DEBUGF(INDI::Logger::DBG_ERROR, "Unknown command: '%c'", k); - return false; - } - c.k = k; - c.addr = addr; - c.z = calculate_checksum(c); - - LOGF_DEBUG("Sending command: c=%c, a=%hhu, b=%hhu, c=%hhu, d=%hhu ($%hhx), n=%hhu, z=%hhu", c.k, c.a, c.b, c.c, c.d, c.d, c.addr, c.z); - - tcflush(PortFD, TCIOFLUSH); - - if ( (err_code = tty_write(PortFD, (char *)&c, sizeof(c), &nbytes_written) != TTY_OK)) - { - tty_error_msg(err_code, dreamFocuser_error, DREAMFOCUSER_ERROR_BUFFER); - LOGF_ERROR("TTY error detected: %s", dreamFocuser_error); - return false; - } - - LOGF_DEBUG("Sending complete. Number of bytes written: %d", nbytes_written); - - return true; -} - -bool DreamFocuser::read_response() -{ - int err_code = 0, nbytes_read = 0, z; - char err_msg[DREAMFOCUSER_ERROR_BUFFER]; - - //LOG_DEBUG("Read response"); - - // Read a single response - if ( (err_code = tty_read(PortFD, (char *)¤tResponse, sizeof(currentResponse), 5, &nbytes_read)) != TTY_OK) - { - tty_error_msg(err_code, err_msg, 32); - LOGF_ERROR("TTY error detected: %s", err_msg); - return false; - } - LOGF_DEBUG("Response: %c, a=%hhu, b=%hhu, c=%hhu, d=%hhu ($%hhx), n=%hhu, z=%hhu", currentResponse.k, currentResponse.a, currentResponse.b, currentResponse.c, currentResponse.d, currentResponse.d, currentResponse.addr, currentResponse.z); - - if ( nbytes_read != sizeof(currentResponse) ) - { - LOGF_ERROR("Number of bytes read: %d, expected: %d", nbytes_read, sizeof(currentResponse)); - return false; - } - - z = calculate_checksum(currentResponse); - if ( z != currentResponse.z ) - { - LOGF_ERROR("Response checksum in not correct %hhu, expected: %hhu", currentResponse.z, z ); - return false; - } - - if ( currentResponse.k == '!' ) - { - LOG_ERROR("Focuser reported unrecognized command."); - return false; - } - - if ( currentResponse.k == '?' ) - { - LOG_ERROR("Focuser reported bad checksum."); - return false; - } - - return true; -} - -bool DreamFocuser::dispatch_command(char k, uint32_t l, unsigned char addr) -{ - LOG_DEBUG("send_command"); - if ( send_command(k, l, addr) ) - { - if ( read_response() ) - { - LOG_DEBUG("check currentResponse.k"); - if ( currentResponse.k == k ) - return true; - } - } - return false; -} - -/**************************************************************** -** -** -*****************************************************************/ - -const char * DreamFocuser::getDefaultName() -{ - return (char *)"DreamFocuser"; -} diff --git a/indi-dreamfocuser/dreamfocuser.h b/indi-dreamfocuser/dreamfocuser.h deleted file mode 100644 index 5b8e18a6f..000000000 --- a/indi-dreamfocuser/dreamfocuser.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - INDI Driver for DreamFocuser - - Copyright (C) 2016 Piotr Dlugosz - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#ifndef DREAMFOCUSER_H -#define DREAMFOCUSER_H - -#include - -#include -#include -#include - -using namespace std; - -#define DREAMFOCUSER_STEP_SIZE 32 -#define DREAMFOCUSER_ERROR_BUFFER 1024 - - -class DreamFocuser : public INDI::Focuser -{ - - public: - - struct DreamFocuserCommand - { - char M = 'M'; - char k; - unsigned char a; - unsigned char b; - unsigned char c; - unsigned char d; - unsigned char addr = '\0'; - unsigned char z; - }; - - DreamFocuser(); - - const char *getDefaultName() override; - virtual bool initProperties() override; - virtual bool updateProperties() override; - //virtual bool saveConfigItems(FILE *fp) override; - //virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) override; - virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) override; - - protected: - virtual bool Handshake() override; - virtual void TimerHit() override; - virtual bool SyncFocuser(uint32_t ticks) override; - - virtual IPState MoveAbsFocuser(uint32_t ticks) override; - virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override; - virtual bool AbortFocuser() override; - - private: - - INumber TemperatureN[1]; - INumberVectorProperty TemperatureNP; - - INumber WeatherN[2]; - INumberVectorProperty WeatherNP; - - ISwitch ParkS[2]; - ISwitchVectorProperty ParkSP; - - ISwitch StatusS[3]; - ISwitchVectorProperty StatusSP; - - //INumber SetBacklashN[1]; - //INumberVectorProperty SetBacklashNP; - - unsigned char calculate_checksum(DreamFocuserCommand c); - bool send_command(char k, uint32_t l = 0, unsigned char addr = 0); - bool read_response(); - bool dispatch_command(char k, uint32_t l = 0, unsigned char addr = 0); - - bool getTemperature(); - bool getStatus(); - bool getPosition(); - bool getMaxPosition(); - bool setPosition(int32_t position); - bool setSync(uint32_t position = 0); - bool setPark(); - - // Variables - float currentTemperature; - float currentHumidity; - int32_t currentPosition; - int32_t currentMaxPosition; - bool isAbsolute; - bool isMoving; - unsigned char isParked; - bool isVcc12V; - DreamFocuserCommand currentResponse; -}; - -#endif diff --git a/indi-dreamfocuser/indi-dreamfocuser.spec b/indi-dreamfocuser/indi-dreamfocuser.spec deleted file mode 100644 index 53c53bbd2..000000000 --- a/indi-dreamfocuser/indi-dreamfocuser.spec +++ /dev/null @@ -1,78 +0,0 @@ -%define __cmake_in_source_build %{_vpath_builddir} -Name: indi-dreamfocuser -Version:2.0.7.git -Release: %(date -u +%%Y%%m%%d%%H%%M%%S)%{?dist} -Summary: Instrument Neutral Distributed Interface 3rd party drivers - -License: LGPLv2 -# See COPYRIGHT file for a description of the licenses and files covered - -URL: https://indilib.org -Source0: https://github.com/indilib/indi-3rdparty/archive/master.tar.gz - -BuildRequires: cmake -BuildRequires: libfli-devel -BuildRequires: libnova-devel -BuildRequires: qt5-qtbase-devel -BuildRequires: systemd -BuildRequires: gphoto2-devel -BuildRequires: LibRaw-devel -BuildRequires: indi-libs -BuildRequires: indi-devel -BuildRequires: libtiff-devel -BuildRequires: cfitsio-devel -BuildRequires: zlib-devel -BuildRequires: gsl-devel -BuildRequires: libcurl-devel -BuildRequires: libjpeg-turbo-devel -BuildRequires: fftw-devel -BuildRequires: libftdi-devel -BuildRequires: gpsd-devel -BuildRequires: libdc1394-devel -BuildRequires: boost-devel -BuildRequires: boost-regex -BuildRequires: libasi - -BuildRequires: gmock - -BuildRequires: pkgconfig(fftw3) -BuildRequires: pkgconfig(cfitsio) -BuildRequires: pkgconfig(libcurl) -BuildRequires: pkgconfig(gsl) -BuildRequires: pkgconfig(libjpeg) -BuildRequires: pkgconfig(libusb-1.0) -BuildRequires: pkgconfig(zlib) - - -%description -INDI is a distributed control protocol designed to operate -astronomical instrumentation. INDI is small, flexible, easy to parse, -and scalable. It supports common DCS functions such as remote control, -data acquisition, monitoring, and a lot more. This is a 3rd party driver. - - -%prep -v -%autosetup -v -p1 -n indi-3rdparty-master - -%build -# This package tries to mix and match PIE and PIC which is wrong and will -# trigger link errors when LTO is enabled. -# Disable LTO -%define _lto_cflags %{nil} - -cd indi-dreamfocuser -%cmake -DINDI_DATA_DIR=/usr/share/indi . -make VERBOSE=1 %{?_smp_mflags} -j4 - -%install -cd indi-dreamfocuser -make DESTDIR=%{buildroot} install - -%files -%{_bindir}/* -%{_datadir}/indi - -%changelog -* Sun Jul 19 2020 Jim Howard 1.8.7.git-1 -- update to build from git for copr, credit to Sergio Pascual and Christian Dersch for prior work on spec files - diff --git a/indi-dreamfocuser/indi_dreamfocuser_focus.xml.cmake b/indi-dreamfocuser/indi_dreamfocuser_focus.xml.cmake deleted file mode 100644 index d6073e234..000000000 --- a/indi-dreamfocuser/indi_dreamfocuser_focus.xml.cmake +++ /dev/null @@ -1,9 +0,0 @@ - - - - - indi_dreamfocuser_focus - @DREAMFOCUSER_VERSION_MAJOR@.@DREAMFOCUSER_VERSION_MINOR@ - - - diff --git a/indi-spectracyber/.project b/indi-spectracyber/.project deleted file mode 100644 index 7a2571cf0..000000000 --- a/indi-spectracyber/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - Project-Source@indi-knro - - - - - - - - diff --git a/indi-spectracyber/Authors b/indi-spectracyber/Authors deleted file mode 100644 index bb7d7eb6f..000000000 --- a/indi-spectracyber/Authors +++ /dev/null @@ -1 +0,0 @@ -Jasem Mutlaq diff --git a/indi-spectracyber/CMakeLists.txt b/indi-spectracyber/CMakeLists.txt deleted file mode 100644 index b3aa3de43..000000000 --- a/indi-spectracyber/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -PROJECT(indi_spectracyber C CXX) - -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") -include(GNUInstallDirs) - -find_package(CFITSIO REQUIRED) -find_package(INDI REQUIRED) -find_package(ZLIB REQUIRED) -find_package(Threads REQUIRED) -find_package(Nova REQUIRED) - -set (SPECTRACYBER_VERSION_MAJOR 1) -set (SPECTRACYBER_VERSION_MINOR 3) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_spectracyber.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_spectracyber.xml ) - -include_directories( ${CMAKE_CURRENT_BINARY_DIR}) -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}) -include_directories( ${INDI_INCLUDE_DIR}) -include_directories( ${NOVA_INCLUDE_DIR}/..) - -########### SpectraCyber ########### -set(indispectracyber_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/spectracyber.cpp - ) - -include(CMakeCommon) - -add_executable(indi_spectracyber ${indispectracyber_SRCS}) - -target_link_libraries(indi_spectracyber ${INDI_LIBRARIES} ${NOVA_LIBRARIES} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) - -install(TARGETS indi_spectracyber RUNTIME DESTINATION bin) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_spectracyber.xml indi_spectracyber_sk.xml DESTINATION ${INDI_DATA_DIR}) - diff --git a/indi-spectracyber/ChangeLog b/indi-spectracyber/ChangeLog deleted file mode 100644 index 49dcdc982..000000000 --- a/indi-spectracyber/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -ChangeLog: - -2009-10-02 Initial import to SVN. - diff --git a/indi-spectracyber/Readme b/indi-spectracyber/Readme deleted file mode 100644 index 577050147..000000000 --- a/indi-spectracyber/Readme +++ /dev/null @@ -1,32 +0,0 @@ -KNRO INDI Driver -================== - -This package provides the INDI driver for Radio Astronomy Supplies' SpectraCyber hydrogen line spectrometer. It supports all the functionality provided by the spectrometer including scanning continuum and spectral channels. - -TODO: Add stuff about GNUPlot or other solutions here? - -Requirements -============ - -+ libindi0 >= v0.6 (http://indi.sf.net) - - You need to install both libindi0 and libindi0-devel to build this package. - - -Installation -============ - - See INSTALL - -How to Use -========== - - You can use the SpectraCyber INDI Driver in any INDI-compatible client such as KStars or Xephem. - - To run the driver from the command line: - - $ indiserver indi_spectracyber - - You can then connect to the driver from any client, the default port is 7624. - If you're using KStars, the driver will be automatically listed in KStars' Device Manager, - no further configuration is necessary. diff --git a/indi-spectracyber/config.h.cmake b/indi-spectracyber/config.h.cmake deleted file mode 100644 index 702135d0a..000000000 --- a/indi-spectracyber/config.h.cmake +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -/* Define INDI Data Dir */ -#cmakedefine INDI_DATA_DIR "@INDI_DATA_DIR@" -/* Define Driver version */ -#define SPECTRACYBER_VERSION_MAJOR @SPECTRACYBER_VERSION_MAJOR@ -#define SPECTRACYBER_VERSION_MINOR @SPECTRACYBER_VERSION_MINOR@ - -#endif // CONFIG_H - diff --git a/indi-spectracyber/copying.lib b/indi-spectracyber/copying.lib deleted file mode 100644 index e38ffa837..000000000 --- a/indi-spectracyber/copying.lib +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307, USA. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/indi-spectracyber/indi-spectracyber.spec b/indi-spectracyber/indi-spectracyber.spec deleted file mode 100644 index a8273ce39..000000000 --- a/indi-spectracyber/indi-spectracyber.spec +++ /dev/null @@ -1,78 +0,0 @@ -%define __cmake_in_source_build %{_vpath_builddir} -Name: indi-spectracyber -Version:2.0.7.git -Release: %(date -u +%%Y%%m%%d%%H%%M%%S)%{?dist} -Summary: Instrument Neutral Distributed Interface 3rd party drivers - -License: LGPLv2 -# See COPYRIGHT file for a description of the licenses and files covered - -URL: https://indilib.org -Source0: https://github.com/indilib/indi-3rdparty/archive/master.tar.gz - -BuildRequires: cmake -BuildRequires: libfli-devel -BuildRequires: libnova-devel -BuildRequires: qt5-qtbase-devel -BuildRequires: systemd -BuildRequires: gphoto2-devel -BuildRequires: LibRaw-devel -BuildRequires: indi-libs -BuildRequires: indi-devel -BuildRequires: libtiff-devel -BuildRequires: cfitsio-devel -BuildRequires: zlib-devel -BuildRequires: gsl-devel -BuildRequires: libcurl-devel -BuildRequires: libjpeg-turbo-devel -BuildRequires: fftw-devel -BuildRequires: libftdi-devel -BuildRequires: gpsd-devel -BuildRequires: libdc1394-devel -BuildRequires: boost-devel -BuildRequires: boost-regex -BuildRequires: libasi - -BuildRequires: gmock - -BuildRequires: pkgconfig(fftw3) -BuildRequires: pkgconfig(cfitsio) -BuildRequires: pkgconfig(libcurl) -BuildRequires: pkgconfig(gsl) -BuildRequires: pkgconfig(libjpeg) -BuildRequires: pkgconfig(libusb-1.0) -BuildRequires: pkgconfig(zlib) - - -%description -INDI is a distributed control protocol designed to operate -astronomical instrumentation. INDI is small, flexible, easy to parse, -and scalable. It supports common DCS functions such as remote control, -data acquisition, monitoring, and a lot more. This is a 3rd party driver. - - -%prep -v -%autosetup -v -p1 -n indi-3rdparty-master - -%build -# This package tries to mix and match PIE and PIC which is wrong and will -# trigger link errors when LTO is enabled. -# Disable LTO -%define _lto_cflags %{nil} - -cd indi-spectracyber -%cmake -DINDI_DATA_DIR=/usr/share/indi . -make VERBOSE=1 %{?_smp_mflags} -j4 - -%install -cd indi-spectracyber -make DESTDIR=%{buildroot} install - -%files -%{_bindir}/* -%{_datadir}/indi - -%changelog -* Sun Jul 19 2020 Jim Howard 1.8.7.git-1 -- update to build from git for copr, credit to Sergio Pascual and Christian Dersch for prior work on spec files - diff --git a/indi-spectracyber/indi_spectracyber.xml.cmake b/indi-spectracyber/indi_spectracyber.xml.cmake deleted file mode 100644 index b26272d00..000000000 --- a/indi-spectracyber/indi_spectracyber.xml.cmake +++ /dev/null @@ -1,9 +0,0 @@ - - - - - indi_spectracyber - @SPECTRACYBER_VERSION_MAJOR@.@SPECTRACYBER_VERSION_MINOR@ - - - diff --git a/indi-spectracyber/indi_spectracyber_sk.xml b/indi-spectracyber/indi_spectracyber_sk.xml deleted file mode 100644 index ee28e0982..000000000 --- a/indi-spectracyber/indi_spectracyber_sk.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - -/dev/ttyUSB0 - - - - -1420.4049999999999727 - - - - --600 - - -600 - - -1 - - - - -On - - -Off - - - - -Off - - -On - - - - - - - - - - - -10 - - - - -On - - -Off - - -Off - - -Off - - -Off - - -Off - - - - -On - - -Off - - -Off - - - - -On - - -Off - - -Off - - -Off - - -Off - - -Off - - - - -On - - -Off - - -Off - - - - -0 - - -0 - - - - -On - - -Off - - - - -Off - - - - - diff --git a/indi-spectracyber/install b/indi-spectracyber/install deleted file mode 100644 index d04eb6a75..000000000 --- a/indi-spectracyber/install +++ /dev/null @@ -1,15 +0,0 @@ -Spectra Cyber INSTALL -============== - -You must have CMake >= 2.4.7 in order to build this package. - -1) $ tar -xzf indi-spectracyber.tar.gz -2) $ mkdir indi-spectracyber_build -3) $ cd indi-spectracyber_build -4) $ cmake -DCMAKE_INSTALL_PREFIX=/usr . ../indi-spectracyber -5) $ su -c 'make install' or sudo make install - -Refer to README for instructions on using the driver. - -That's it! - diff --git a/indi-spectracyber/spectracyber.cpp b/indi-spectracyber/spectracyber.cpp deleted file mode 100644 index b3f3487ae..000000000 --- a/indi-spectracyber/spectracyber.cpp +++ /dev/null @@ -1,1048 +0,0 @@ -/* - Kuwait National Radio Observatory - INDI Driver for SpectraCyber Hydrogen Line Spectrometer - Communication: RS232 <---> USB - - Copyright (C) 2009 Jasem Mutlaq (mutlaqja@ikarustech.com) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - Change Log: - - Format of BLOB data is: - - ########### ####### ########## ## ### - Julian_Date Voltage Freqnuency RA DEC - -*/ - -#include "spectracyber.h" - -#include "config.h" - -#include - -#include - -#include -#include -#include -#include -#include - -#define mydev "SpectraCyber" -#define BASIC_GROUP "Main Control" -#define OPTIONS_GROUP "Options" - -#define CONT_CHANNEL 0 -#define SPEC_CHANNEL 1 - -//const int SPECTROMETER_READ_BUFFER = 16; -const int SPECTROMETER_ERROR_BUFFER = 128; -const int SPECTROMETER_CMD_LEN = 5; -const int SPECTROMETER_CMD_REPLY = 4; - -//const double SPECTROMETER_MIN_FREQ = 46.4; -const double SPECTROMETER_REST_FREQ = 48.6; -//const double SPECTROMETER_MAX_FREQ = 51.2; -const double SPECTROMETER_RF_FREQ = 1371.805; - -const unsigned int SPECTROMETER_OFFSET = 0x050; - -/* 90 Khz Rest Correction */ -const double SPECTROMETER_REST_CORRECTION = 0.090; - -static const char *contFMT = ".ascii_cont"; -static const char *specFMT = ".ascii_spec"; - -// We declare an auto pointer to spectrometer. -std::unique_ptr spectracyber(new SpectraCyber()); - -/**************************************************************** -** -** -*****************************************************************/ -SpectraCyber::SpectraCyber() -{ - // Command pre-limiter - command[0] = '!'; - - telescopeID = nullptr; - - srand(time(nullptr)); - - buildSkeleton("indi_spectracyber_sk.xml"); - - // Optional: Add aux controls for configuration, debug & simulation - addAuxControls(); - - setVersion(SPECTRACYBER_VERSION_MAJOR, SPECTRACYBER_VERSION_MINOR); -} - -/**************************************************************** -** -** -*****************************************************************/ -void SpectraCyber::ISGetProperties(const char *dev) -{ - static int propInit = 0; - - INDI::DefaultDevice::ISGetProperties(dev); - - if (propInit == 0) - { - loadConfig(); - - propInit = 1; - - auto tProp = getText("ACTIVE_DEVICES"); - - if (tProp) - { - telescopeID = tProp.findWidgetByName("ACTIVE_TELESCOPE"); - - if (telescopeID && strlen(telescopeID->text) > 0) - { - IDSnoopDevice(telescopeID->text, "EQUATORIAL_EOD_COORD"); - } - } - } -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::ISSnoopDevice(XMLEle *root) -{ - if (IUSnoopNumber(root, &EquatorialCoordsRNP) != 0) - { - LOG_WARN("Error processing snooped EQUATORIAL_EOD_COORD_REQUEST value! No RA/DEC information available."); - - return true; - } - //else - // IDLog("Received RA: %g - DEC: %g\n", EquatorialCoordsRNP.np[0].value, EquatorialCoordsRNP.np[1].value); - - return false; -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::initProperties() -{ - - INDI::DefaultDevice::initProperties(); - - FreqNP = getNumber("Freq (Mhz)"); - if (!FreqNP) - LOG_ERROR("Error: Frequency property is missing. Spectrometer cannot be operated."); - - ScanNP = getNumber("Scan Parameters"); - if (!ScanNP) - LOG_ERROR("Error: Scan parameters property is missing. Spectrometer cannot be operated."); - - ChannelSP = getSwitch("Channels"); - if (!ChannelSP) - LOG_ERROR("Error: Channel property is missing. Spectrometer cannot be operated."); - - ScanSP = getSwitch("Scan"); - if (!ScanSP) - LOG_ERROR("Error: Channel property is missing. Spectrometer cannot be operated."); - - DataStreamBP = getBLOB("Data"); - if (!DataStreamBP) - LOG_ERROR("Error: BLOB data property is missing. Spectrometer cannot be operated."); - - if (DataStreamBP) - DataStreamBP[0].setBlob((char *)malloc(MAXBLEN * sizeof(char))); - - /**************************************************************************/ - // Equatorial Coords - SET - IUFillNumber(&EquatorialCoordsRN[0], "RA", "RA H:M:S", "%10.6m", 0., 24., 0., 0.); - IUFillNumber(&EquatorialCoordsRN[1], "DEC", "Dec D:M:S", "%10.6m", -90., 90., 0., 0.); - IUFillNumberVector(&EquatorialCoordsRNP, EquatorialCoordsRN, NARRAY(EquatorialCoordsRN), "", "EQUATORIAL_EOD_COORD", - "Equatorial AutoSet", "", IP_RW, 0, IPS_IDLE); - /**************************************************************************/ - - setDriverInterface(SPECTROGRAPH_INTERFACE); - - return true; -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::Connect() -{ - auto tProp = getText("DEVICE_PORT"); - - if (isConnected()) - return true; - - if (!tProp) - return false; - - if (isSimulation()) - { - LOGF_INFO("%s Spectrometer: Simulating connection to port %s.", type_name.c_str(), - tProp[0].getText()); - SetTimer(getCurrentPollingPeriod()); - return true; - } - - if (tty_connect(tProp[0].getText(), 2400, 8, 0, 1, &fd) != TTY_OK) - { - LOGF_ERROR("Error connecting to port %s. Make sure you have BOTH read and write permission to the port.", - tProp[0].getText()); - return false; - } - - // We perform initial handshake check by resetting all parameter and watching for echo reply - if (reset() == true) - { - LOG_INFO("Spectrometer is online. Retrieving preliminary data..."); - SetTimer(getCurrentPollingPeriod()); - return init_spectrometer(); - } - else - { - DEBUG(INDI::Logger::DBG_ERROR, - "Spectrometer echo test failed. Please recheck connection to spectrometer and try again."); - return false; - } -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::init_spectrometer() -{ - // Enable speed mode - if (isSimulation()) - { - LOGF_INFO("%s Spectrometer: Simulating spectrometer init.", type_name.c_str()); - return true; - } - - return true; -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::Disconnect() -{ - tty_disconnect(fd); - - return true; -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) -{ - if (strcmp(dev, getDeviceName()) != 0) - return false; - - static double cont_offset = 0; - static double spec_offset = 0; - - auto nProp = getNumber(name); - - if (!nProp) - return false; - - if (isConnected() == false) - { - resetProperties(); - LOG_ERROR("Spectrometer is offline. Connect before issuing any commands."); - return false; - } - - // IF Gain - if (nProp.isNameMatch("70 Mhz IF")) - { - double last_value = nProp[0].getValue(); - - if (!nProp.update(values, names, n)) - return false; - - if (dispatch_command(IF_GAIN) == false) - { - nProp[0].setValue(last_value); - nProp.setState(IPS_ALERT); - nProp.apply("Error dispatching IF gain command to spectrometer. Check logs."); - return false; - } - - nProp.setState(IPS_OK); - nProp.apply(); - - return true; - } - - // DC Offset - if (nProp.isNameMatch("DC Offset")) - { - if (!nProp.update(values, names, n)) - return false; - - // Check which offset change, if none, return gracefully - if (nProp[CONTINUUM_CHANNEL].getValue() != cont_offset) - { - if (dispatch_command(CONT_OFFSET) == false) - { - nProp[CONTINUUM_CHANNEL].setValue(cont_offset); - nProp.setState(IPS_ALERT); - nProp.apply("Error dispatching continuum DC offset command to spectrometer. Check logs."); - return false; - } - - cont_offset = nProp[CONTINUUM_CHANNEL].getValue(); - } - - if (nProp[SPECTRAL_CHANNEL].getValue() != spec_offset) - { - if (dispatch_command(SPEC_OFFSET) == false) - { - nProp[SPECTRAL_CHANNEL].setValue(spec_offset); - nProp.setState(IPS_ALERT); - nProp.apply("Error dispatching spectral DC offset command to spectrometer. Check logs."); - return false; - } - - spec_offset = nProp[SPECTRAL_CHANNEL].getValue(); - } - - // No Change, return - nProp.setState(IPS_OK); - nProp.apply(); - return true; - } - - // Freq Change - if (nProp.isNameMatch("Freq (Mhz)")) - return update_freq(values[0]); - - // Scan Options - if (nProp.isNameMatch("Scan Parameters")) - { - if (!nProp.update(values, names, n)) - return false; - - nProp.setState(IPS_OK); - nProp.apply(); - return true; - } - return true; -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) -{ - if (strcmp(dev, getDeviceName()) != 0) - return false; - - auto tProp = getText(name); - - if (!tProp) - return false; - - // Device Port Text - if (tProp.isNameMatch("DEVICE_PORT")) - { - if (!tProp.update(texts, names, n)) - return false; - - tProp.setState(IPS_OK); - tProp.apply("Port updated."); - - return true; - } - - // Telescope Source - if (tProp.isNameMatch("ACTIVE_DEVICES")) - { - telescopeID = tProp.findWidgetByName("ACTIVE_TELESCOPE"); - - if (telescopeID && strcmp(texts[0], telescopeID->text)) - { - if (!tProp.update(texts, names, n)) - return false; - - strncpy(EquatorialCoordsRNP.device, tProp[0].getText(), MAXINDIDEVICE); - - LOGF_INFO("Active telescope updated to %s. Please save configuration.", telescopeID->text); - - IDSnoopDevice(telescopeID->text, "EQUATORIAL_EOD_COORD"); - } - - tProp.setState(IPS_OK); - tProp.apply(); - return true; - } - - return true; -} - -/**************************************************************** -** -** -*****************************************************************/ -bool SpectraCyber::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) -{ - if (strcmp(dev, getDeviceName()) != 0) - return false; - - // First process parent! - if (INDI::DefaultDevice::ISNewSwitch(getDeviceName(), name, states, names, n) == true) - return true; - - auto sProp = getSwitch(name); - - if (!sProp) - return false; - - if (isConnected() == false) - { - resetProperties(); - LOG_ERROR("Spectrometer is offline. Connect before issuing any commands."); - return false; - } - - // Scan - if (sProp.isNameMatch("Scan")) - { - if (!FreqNP || !DataStreamBP) - return false; - - if (!sProp.update(states, names, n)) - return false; - - if (sProp[1].getState() == ISS_ON) - { - if (sProp.getState() == IPS_BUSY) - { - sProp.setState(IPS_IDLE); - FreqNP.setState(IPS_IDLE); - DataStreamBP.setState(IPS_IDLE); - - FreqNP.apply(); - DataStreamBP.apply(); - sProp.apply("Scan stopped."); - return false; - } - - sProp.setState(IPS_OK); - sProp.apply(); - return true; - } - - sProp.setState(IPS_BUSY); - DataStreamBP.setState(IPS_BUSY); - - // Compute starting freq = base_freq - low - if (sProp[SPEC_CHANNEL].getState() == ISS_ON) - { - start_freq = (SPECTROMETER_RF_FREQ + SPECTROMETER_REST_FREQ) - abs((int)ScanNP[0].getValue()) / 1000.; - target_freq = (SPECTROMETER_RF_FREQ + SPECTROMETER_REST_FREQ) + abs((int)ScanNP[1].getValue()) / 1000.; - sample_rate = ScanNP[2].getValue() * 5; - FreqNP[0].setValue(start_freq); - FreqNP.setState(IPS_BUSY); - FreqNP.apply(); - sProp.apply("Starting spectral scan from %g MHz to %g MHz in steps of %g KHz...", start_freq, - target_freq, sample_rate); - } - else - sProp.apply("Starting continuum scan @ %g MHz...", FreqNP[0].getValue()); - - return true; - } - - // Continuum Gain Control - if (sProp.isNameMatch("Continuum Gain")) - { - int last_switch = sProp.findOnSwitchIndex(); - - if (!sProp.update(states, names, n)) - return false; - - if (dispatch_command(CONT_GAIN) == false) - { - sProp.setState(IPS_ALERT); - sProp.reset(); - sProp[last_switch].setState(ISS_ON); - sProp.apply("Error dispatching continuum gain command to spectrometer. Check logs."); - return false; - } - - sProp.setState(IPS_OK); - sProp.apply(); - - return true; - } - - // Spectral Gain Control - if (sProp.isNameMatch("Spectral Gain")) - { - int last_switch = sProp.findOnSwitchIndex(); - - if (!sProp.update(states, names, n)) - return false; - - if (dispatch_command(SPEC_GAIN) == false) - { - sProp.setState(IPS_ALERT); - sProp.reset(); - sProp[last_switch].setState(ISS_ON); - sProp.apply("Error dispatching spectral gain command to spectrometer. Check logs."); - return false; - } - - sProp.setState(IPS_OK); - sProp.apply(); - - return true; - } - - // Continuum Integration Control - if (sProp.isNameMatch("Continuum Integration (s)")) - { - int last_switch = sProp.findOnSwitchIndex(); - - if (!sProp.update(states, names, n)) - return false; - - if (dispatch_command(CONT_TIME) == false) - { - sProp.setState(IPS_ALERT); - sProp.reset(); - sProp[last_switch].setState(ISS_ON); - sProp.apply("Error dispatching continuum integration command to spectrometer. Check logs."); - return false; - } - - sProp.setState(IPS_OK); - sProp.apply(); - - return true; - } - - // Spectral Integration Control - if (sProp.isNameMatch("Spectral Integration (s)")) - { - int last_switch = sProp.findOnSwitchIndex(); - - if (!sProp.update(states, names, n)) - return false; - - if (dispatch_command(SPEC_TIME) == false) - { - sProp.setState(IPS_ALERT); - sProp.reset(); - sProp[last_switch].setState(ISS_ON); - sProp.apply("Error dispatching spectral integration command to spectrometer. Check logs."); - return false; - } - - sProp.setState(IPS_OK); - sProp.apply(); - - return true; - } - - // Bandwidth Control - if (sProp.isNameMatch("Bandwidth (Khz)")) - { - int last_switch = sProp.findOnSwitchIndex(); - - if (!sProp.update(states, names, n)) - return false; - - if (dispatch_command(BANDWIDTH) == false) - { - sProp.setState(IPS_ALERT); - sProp.reset(); - sProp[last_switch].setState(ISS_ON); - sProp.apply("Error dispatching bandwidth change command to spectrometer. Check logs."); - return false; - } - - sProp.setState(IPS_OK); - sProp.apply(); - - return true; - } - - // Channel selection - if (sProp.isNameMatch("Channels")) - { - static int lastChannel; - - lastChannel = sProp.findOnSwitchIndex(); - - if (!sProp.update(states, names, n)) - return false; - - sProp.setState(IPS_OK); - if (ScanSP.getState() == IPS_BUSY && lastChannel != sProp.findOnSwitchIndex()) - { - abort_scan(); - sProp.apply("Scan aborted due to change of channel selection."); - } - else - sProp.apply(); - - return true; - } - - // Reset - if (sProp.isNameMatch("Reset")) - { - if (reset() == true) - { - sProp.setState(IPS_OK); - sProp.apply(); - } - else - { - sProp.setState(IPS_ALERT); - sProp.apply("Error dispatching reset parameter command to spectrometer. Check logs."); - return false; - } - return true; - } - - return true; -} - -bool SpectraCyber::dispatch_command(SpectrometerCommand command_type) -{ - char spectrometer_error[SPECTROMETER_ERROR_BUFFER]; - int err_code = 0, nbytes_written = 0, final_value = 0; - // Maximum of 3 hex digits in addition to null terminator - char hex[5]; - - tcflush(fd, TCIOFLUSH); - - switch (command_type) - { - // Intermediate Frequency Gain - case IF_GAIN: { - auto prop = getNumber("70 Mhz IF"); - if (!prop) - return false; - command[1] = 'A'; - command[2] = '0'; - // Equation is - // Value = ((X - 10) * 63) / 15.75, where X is the user selection (10dB to 25.75dB) - final_value = (int)((prop[0].getValue() - 10) * 63) / 15.75; - sprintf(hex, "%02X", (uint16_t)final_value); - command[3] = hex[0]; - command[4] = hex[1]; - break; - } - - // Continuum Gain - case CONT_GAIN: { - auto prop = getSwitch("Continuum Gain"); - if (!prop) - return false; - command[1] = 'G'; - command[2] = '0'; - command[3] = '0'; - final_value = prop.findOnSwitchIndex(); - sprintf(hex, "%d", (uint8_t)final_value); - command[4] = hex[0]; - break; - } - - // Continuum Integration - case CONT_TIME: { - auto prop = getSwitch("Continuum Integration (s)"); - if (!prop) - return false; - command[1] = 'I'; - command[2] = '0'; - command[3] = '0'; - final_value = prop.findOnSwitchIndex(); - sprintf(hex, "%d", (uint8_t)final_value); - command[4] = hex[0]; - break; - } - - // Spectral Gain - case SPEC_GAIN: { - auto prop = getSwitch("Spectral Gain"); - if (!prop) - return false; - command[1] = 'K'; - command[2] = '0'; - command[3] = '0'; - final_value = prop.findOnSwitchIndex(); - sprintf(hex, "%d", (uint8_t)final_value); - command[4] = hex[0]; - break; - } - - // Spectral Integration - case SPEC_TIME: { - auto prop = getSwitch("Spectral Integration (s)"); - if (!prop) - return false; - command[1] = 'L'; - command[2] = '0'; - command[3] = '0'; - final_value = prop.findOnSwitchIndex(); - sprintf(hex, "%d", (uint8_t)final_value); - command[4] = hex[0]; - break; - } - - // Continuum DC Offset - case CONT_OFFSET: { - auto prop = getNumber("DC Offset"); - if (!prop) - return false; - command[1] = 'O'; - final_value = (int)prop[CONTINUUM_CHANNEL].getValue() / 0.001; - sprintf(hex, "%03X", (uint32_t)final_value); - command[2] = hex[0]; - command[3] = hex[1]; - command[4] = hex[2]; - break; - } - - // Spectral DC Offset - case SPEC_OFFSET: { - auto prop = getNumber("DC Offset"); - if (!prop) - return false; - command[1] = 'J'; - final_value = (int)prop[SPECTRAL_CHANNEL].getValue() / 0.001; - sprintf(hex, "%03X", (uint32_t)final_value); - command[2] = hex[0]; - command[3] = hex[1]; - command[4] = hex[2]; - break; - } - - // FREQ - case RECV_FREQ: { - command[1] = 'F'; - // Each value increment is 5 Khz. Range is 050h to 3e8h. - // 050h corresponds to 46.4 Mhz (min), 3e8h to 51.2 Mhz (max) - // To compute the desired received freq, we take the diff (target - min) / 0.005 - // 0.005 Mhz = 5 Khz - // Then we add the diff to 050h (80 in decimal) to get the final freq. - // e.g. To set 50.00 Mhz, diff = 50 - 46.4 = 3.6 / 0.005 = 800 = 320h - // Freq = 320h + 050h (or 800 + 80) = 370h = 880 decimal - - final_value = (int)((FreqNP[0].getValue() + SPECTROMETER_REST_CORRECTION - FreqNP[0].getMin()) / 0.005 + - SPECTROMETER_OFFSET); - sprintf(hex, "%03X", (uint32_t)final_value); - if (isDebug()) - IDLog("Required Freq is: %.3f --- Min Freq is: %.3f --- Spec Offset is: %d -- Final Value (Dec): %d " - "--- Final Value (Hex): %s\n", - FreqNP[0].getValue(), FreqNP[0].getMin(), SPECTROMETER_OFFSET, final_value, hex); - command[2] = hex[0]; - command[3] = hex[1]; - command[4] = hex[2]; - break; - } - - // Read Channel - case READ_CHANNEL: { - command[1] = 'D'; - command[2] = '0'; - command[3] = '0'; - final_value = ChannelSP.findOnSwitchIndex(); - command[4] = (final_value == 0) ? '0' : '1'; - break; - } - - // Bandwidth - case BANDWIDTH: { - auto prop = getSwitch("Bandwidth (Khz)"); - if (!prop) - return false; - command[1] = 'B'; - command[2] = '0'; - command[3] = '0'; - final_value = prop.findOnSwitchIndex(); - //sprintf(hex, "%x", final_value); - command[4] = (final_value == 0) ? '0' : '1'; - break; - } - - // Reset - case RESET: - command[1] = 'R'; - command[2] = '0'; - command[3] = '0'; - command[4] = '0'; - break; - - // Noise source - case NOISE_SOURCE: - // TODO: Do something here? - break; - } - - if (isDebug()) - IDLog("Dispatching command #%s#\n", command); - - if (isSimulation()) - return true; - - if ((err_code = tty_write(fd, command, SPECTROMETER_CMD_LEN, &nbytes_written) != TTY_OK)) - { - tty_error_msg(err_code, spectrometer_error, SPECTROMETER_ERROR_BUFFER); - if (isDebug()) - IDLog("TTY error detected: %s\n", spectrometer_error); - return false; - } - - return true; -} - -int SpectraCyber::get_on_switch(ISwitchVectorProperty *sp) -{ - for (int i = 0; i < sp->nsp; i++) - if (sp->sp[i].s == ISS_ON) - return i; - - return -1; -} - -bool SpectraCyber::update_freq(double nFreq) -{ - double last_value = FreqNP[0].getValue(); - - if (nFreq < FreqNP[0].getMin() || nFreq > FreqNP[0].getMax()) - return false; - - FreqNP[0].setValue(nFreq); - - if (dispatch_command(RECV_FREQ) == false) - { - FreqNP[0].setValue(last_value); - FreqNP.setState(IPS_ALERT); - FreqNP.apply("Error dispatching RECV FREQ command to spectrometer. Check logs."); - return false; - } - - if (ScanSP.getState() != IPS_BUSY) - FreqNP.setState(IPS_OK); - - FreqNP.apply(); - - // Delay 0.5s for INT - usleep(500000); - return true; -} - -bool SpectraCyber::reset() -{ - int err_code = 0, nbytes_read = 0; - char response[4]; - char err_msg[SPECTROMETER_ERROR_BUFFER]; - - if (isDebug()) - IDLog("Attempting to write to spectrometer....\n"); - - dispatch_command(RESET); - - if (isDebug()) - IDLog("Attempting to read from spectrometer....\n"); - - // Read echo from spectrometer, we're expecting R000 - if ((err_code = tty_read(fd, response, SPECTROMETER_CMD_REPLY, 5, &nbytes_read)) != TTY_OK) - { - tty_error_msg(err_code, err_msg, 32); - if (isDebug()) - IDLog("TTY error detected: %s\n", err_msg); - return false; - } - - if (isDebug()) - IDLog("Response from Spectrometer: #%c# #%c# #%c# #%c#\n", response[0], response[1], response[2], response[3]); - - if (strstr(response, "R000")) - { - if (isDebug()) - IDLog("Echo test passed.\n"); - - loadDefaultConfig(); - - return true; - } - - if (isDebug()) - IDLog("Echo test failed.\n"); - return false; -} - -void SpectraCyber::TimerHit() -{ - if (!isConnected()) - return; - - char RAStr[16], DecStr[16]; - - switch (ScanSP.getState()) - { - case IPS_BUSY: - if (ChannelSP[CONT_CHANNEL].getState() == ISS_ON) - break; - - if (FreqNP[0].getValue() >= target_freq) - { - ScanSP.setState(IPS_OK); - FreqNP.setState(IPS_OK); - - FreqNP.apply(); - ScanSP.apply("Scan complete."); - SetTimer(getCurrentPollingPeriod()); - return; - } - - if (update_freq(FreqNP[0].getValue()) == false) - { - abort_scan(); - SetTimer(getCurrentPollingPeriod()); - return; - } - - FreqNP[0].setValue(FreqNP[0].getValue() + sample_rate / 1000.); - break; - - default: - break; - } - - switch (DataStreamBP.getState()) - { - case IPS_BUSY: { - if (ScanSP.getState() != IPS_BUSY) - { - DataStreamBP.setState(IPS_IDLE); - DataStreamBP.apply(); - break; - } - - if (read_channel() == false) - { - DataStreamBP.setState(IPS_ALERT); - - if (ScanSP.getState() == IPS_BUSY) - abort_scan(); - - DataStreamBP.apply(); - } - - JD = ln_get_julian_from_sys(); - - // Continuum - if (ChannelSP[0].getState() == ISS_ON) - DataStreamBP[0].setFormat(contFMT); - else - DataStreamBP[0].setFormat(specFMT); - - fs_sexa(RAStr, EquatorialCoordsRN[0].value, 2, 3600); - fs_sexa(DecStr, EquatorialCoordsRN[1].value, 2, 3600); - - if (telescopeID && strlen(telescopeID->text) > 0) - snprintf(bLine, MAXBLEN, "%.8f %.3f %.3f %s %s", JD, chanValue, FreqNP[0].getValue(), RAStr, DecStr); - else - snprintf(bLine, MAXBLEN, "%.8f %.3f %.3f", JD, chanValue, FreqNP[0].getValue()); - - auto bLineSize = strlen(bLine); - DataStreamBP[0].setBlobLen(bLineSize); - DataStreamBP[0].setSize(bLineSize); - memcpy(DataStreamBP[0].getBlob(), bLine, bLineSize); - - //IDLog("\nSTRLEN: %d -- BLOB:'%s'\n", strlen(bLine), (char *) DataStreamBP->bp[0].blob); - - DataStreamBP.apply(); - - break; - } - default: - break; - } - - SetTimer(getCurrentPollingPeriod()); -} - -void SpectraCyber::abort_scan() -{ - FreqNP.setState(IPS_IDLE); - ScanSP.setState(IPS_ALERT); - - ScanSP.reset(); - ScanSP[1].setState(ISS_ON); - - FreqNP.apply(); - ScanSP.apply("Scan aborted due to errors."); -} - -bool SpectraCyber::read_channel() -{ - int err_code = 0, nbytes_read = 0; - char response[SPECTROMETER_CMD_REPLY]; - char err_msg[SPECTROMETER_ERROR_BUFFER]; - - if (isSimulation()) - { - chanValue = ((double)rand()) / ((double)RAND_MAX) * 10.0; - return true; - } - - dispatch_command(READ_CHANNEL); - if ((err_code = tty_read(fd, response, SPECTROMETER_CMD_REPLY, 5, &nbytes_read)) != TTY_OK) - { - tty_error_msg(err_code, err_msg, 32); - if (isDebug()) - IDLog("TTY error detected: %s\n", err_msg); - return false; - } - - if (isDebug()) - IDLog("Response from Spectrometer: #%s#\n", response); - - int result = 0; - sscanf(response, "D%x", &result); - // We divide by 409.5 to scale the value to 0 - 10 VDC range - chanValue = result / 409.5; - - return true; -} - -const char *SpectraCyber::getDefaultName() -{ - return mydev; -} diff --git a/indi-spectracyber/spectracyber.h b/indi-spectracyber/spectracyber.h deleted file mode 100644 index af35f2cd4..000000000 --- a/indi-spectracyber/spectracyber.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - Kuwait National Radio Observatory - INDI Driver for SpectraCyber Hydrogen Line Spectrometer - Communication: RS232 <---> USB - - Copyright (C) 2009 Jasem Mutlaq (mutlaqja@ikarustech.com) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - Change Log: - 2009-09-17: Creating spectrometer class (JM) - -*/ - -#pragma once - -#include - -#include - -#define MAXBLEN 64 - -class SpectraCyber : public INDI::DefaultDevice -{ - public: - enum SpectrometerCommand - { - IF_GAIN, // IF Gain - CONT_GAIN, // Continuum Gain - SPEC_GAIN, // Spectral Gain - CONT_TIME, // Continuum Channel Integration Constant - SPEC_TIME, // Spectral Channel Integration Constant - NOISE_SOURCE, // Noise Source Control - CONT_OFFSET, // Continuum DC Offset - SPEC_OFFSET, // Spectral DC Offset - RECV_FREQ, // Receive Frequency - READ_CHANNEL, // Read Channel Value - BANDWIDTH, // Bandwidth - RESET // Reset All - }; - - enum SpectrometerChannel - { - CONTINUUM_CHANNEL, - SPECTRAL_CHANNEL - }; - enum SpectrometerError - { - NO_ERROR, - BAUD_RATE_ERROR, - FLASH_MEMORY_ERROR, - WRONG_COMMAND_ERROR, - WRONG_PARAMETER_ERROR, - FATAL_ERROR - }; - - SpectraCyber(); - - // Standard INDI interface functions - virtual void ISGetProperties(const char *dev) override; - virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; - virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override; - virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override; - virtual bool ISSnoopDevice(XMLEle *root) override; - - protected: - virtual const char *getDefaultName() override; - - virtual bool Connect() override; - virtual bool Disconnect() override; - virtual void TimerHit() override; - - //void reset_all_properties(bool reset_to_idle=false); - bool update_freq(double nFreq); - - private: - INDI::PropertyNumber FreqNP {INDI::Property()}; - INDI::PropertyNumber ScanNP {INDI::Property()}; - INDI::PropertySwitch ScanSP {INDI::Property()}; - INDI::PropertySwitch ChannelSP {INDI::Property()}; - INDI::PropertyBlob DataStreamBP {INDI::Property()}; - IText *telescopeID; - - // Snooping On - INumber EquatorialCoordsRN[2]; - INumberVectorProperty EquatorialCoordsRNP; - - // Functions - virtual bool initProperties() override; - bool init_spectrometer(); - void abort_scan(); - bool read_channel(); - bool dispatch_command(SpectrometerCommand command); - int get_on_switch(ISwitchVectorProperty *sp); - bool reset(); - - // Variables - std::string type_name; - std::string default_port; - - int fd; - char bLine[MAXBLEN]; - char command[5]; - double start_freq, target_freq, sample_rate, JD, chanValue; -};