diff --git a/.github/docker/Dockerfile.debian b/.github/docker/Dockerfile.debian index 012a04eb80..7284d11456 100644 --- a/.github/docker/Dockerfile.debian +++ b/.github/docker/Dockerfile.debian @@ -1,5 +1,7 @@ FROM debian:latest +RUN cat /etc/os-release + WORKDIR /tmp RUN apt-get update && apt-get -y upgrade && apt-get install -y \ @@ -18,8 +20,9 @@ RUN git clone https://github.com/google/googletest.git googletest && \ # INDI 3rd Party RUN apt-get install -y \ libftdi1-dev libavcodec-dev libavdevice-dev libavformat-dev libswscale-dev \ - libgps-dev libraw-dev libdc1394-22-dev libgphoto2-dev \ - libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev + libgps-dev libraw-dev libdc1394-dev libgphoto2-dev \ + libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev \ + libzmq3-dev # Install Qt5 RUN apt-get install -y \ diff --git a/.github/docker/Dockerfile.debian-buster b/.github/docker/Dockerfile.debian-buster index e4e11309e3..24791e56b1 100644 --- a/.github/docker/Dockerfile.debian-buster +++ b/.github/docker/Dockerfile.debian-buster @@ -1,5 +1,7 @@ FROM debian:buster +RUN cat /etc/os-release + WORKDIR /tmp RUN apt-get update && apt-get -y upgrade && apt-get install -y \ @@ -19,7 +21,8 @@ RUN git clone https://github.com/google/googletest.git googletest && \ RUN apt-get install -y \ libftdi1-dev libavcodec-dev libavdevice-dev libavformat-dev libswscale-dev \ libgps-dev libraw-dev libdc1394-22-dev libgphoto2-dev \ - libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev + libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev \ + libzmq3-dev # Install Qt5 RUN apt-get install -y \ diff --git a/.github/docker/Dockerfile.debian-i386 b/.github/docker/Dockerfile.debian-i386 index 86eadd8d92..898ca6c2dc 100644 --- a/.github/docker/Dockerfile.debian-i386 +++ b/.github/docker/Dockerfile.debian-i386 @@ -1,4 +1,4 @@ -FROM i386/debian +FROM i386/debian:latest WORKDIR /tmp @@ -18,8 +18,9 @@ RUN git clone https://github.com/google/googletest.git googletest && \ # INDI 3rd Party RUN apt-get install -y \ libftdi1-dev libavcodec-dev libavdevice-dev libavformat-dev libswscale-dev \ - libgps-dev libraw-dev libdc1394-22-dev libgphoto2-dev \ - libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev + libgps-dev libraw-dev libdc1394-dev libgphoto2-dev \ + libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev \ + libzmq3-dev # Install Qt5 RUN apt-get install -y \ diff --git a/.github/docker/Dockerfile.fedora b/.github/docker/Dockerfile.fedora index 42232d7fa4..f0314c9ecd 100644 --- a/.github/docker/Dockerfile.fedora +++ b/.github/docker/Dockerfile.fedora @@ -1,5 +1,7 @@ FROM fedora:latest +RUN cat /etc/os-release + WORKDIR /tmp RUN dnf -y upgrade && dnf -y install \ @@ -25,7 +27,8 @@ RUN dnf -y install \ ffmpeg-devel \ libftdi-devel \ gpsd-devel LibRaw-devel libdc1394-devel libgphoto2-devel \ - boost-devel rtl-sdr-devel + boost-devel rtl-sdr-devel \ + zeromq-devel # Install Qt5 RUN dnf -y install \ diff --git a/.github/docker/Dockerfile.ubuntu b/.github/docker/Dockerfile.ubuntu index 69134e7269..d6a0ab753e 100644 --- a/.github/docker/Dockerfile.ubuntu +++ b/.github/docker/Dockerfile.ubuntu @@ -1,5 +1,7 @@ FROM ubuntu:latest +RUN cat /etc/os-release + WORKDIR /tmp RUN apt-get update && apt-get -y upgrade && apt-get install -y \ @@ -19,7 +21,8 @@ RUN git clone https://github.com/google/googletest.git googletest && \ RUN apt-get install -y \ libftdi1-dev libavcodec-dev libavdevice-dev libavformat-dev libswscale-dev \ libgps-dev libraw-dev libdc1394-dev libgphoto2-dev \ - libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev + libboost-dev libboost-regex-dev librtlsdr-dev liblimesuite-dev \ + libzmq3-dev # Install Qt5 RUN apt-get install -y \ diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 97f5d23740..31a7e860b5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,14 +21,14 @@ jobs: steps: - name: Login to Registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: file: ./.github/docker/Dockerfile.${{ matrix.container }} push: true diff --git a/.github/workflows/linux-codestyle.yml b/.github/workflows/linux-codestyle.yml index 5eaafe369c..edba004c0f 100644 --- a/.github/workflows/linux-codestyle.yml +++ b/.github/workflows/linux-codestyle.yml @@ -21,7 +21,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v35 + uses: tj-actions/changed-files@v41 - name: Check codestyle of all changed files with suffix cpp,cxx,c,h run: | diff --git a/.github/workflows/linux-i386.yml b/.github/workflows/linux-i386.yml index e3bd36d030..9cbac63479 100644 --- a/.github/workflows/linux-i386.yml +++ b/.github/workflows/linux-i386.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Get INDI Sources - uses: actions/checkout@v1 + uses: actions/checkout@v1 # Only v1 is compatible because of the different arch - name: Build INDI Core run: | diff --git a/.github/workflows/linux-packages.yml b/.github/workflows/linux-packages.yml index aca10ef197..dadf2bf004 100644 --- a/.github/workflows/linux-packages.yml +++ b/.github/workflows/linux-packages.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Get INDI Sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: 'indi' diff --git a/.github/workflows/linux-pyindi.yml b/.github/workflows/linux-pyindi.yml index 609bf5d307..4dee4c7f5c 100644 --- a/.github/workflows/linux-pyindi.yml +++ b/.github/workflows/linux-pyindi.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Get INDI Sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: 'indi' diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 09867f467c..98fcfcd890 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Get INDI Sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: 'indi' diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e0838a1fda..e6e3e22e69 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Get INDI Sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: 'indi' diff --git a/CMakeLists.txt b/CMakeLists.txt index e4e12c1f31..44f86883ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ endif() # #################################### INDI version ################################################ set(CMAKE_INDI_VERSION_MAJOR 2) set(CMAKE_INDI_VERSION_MINOR 0) -set(CMAKE_INDI_VERSION_RELEASE 4) +set(CMAKE_INDI_VERSION_RELEASE 5) set(INDI_SOVERSION ${CMAKE_INDI_VERSION_MAJOR}) set(CMAKE_INDI_VERSION_STRING "${CMAKE_INDI_VERSION_MAJOR}.${CMAKE_INDI_VERSION_MINOR}.${CMAKE_INDI_VERSION_RELEASE}") @@ -96,6 +96,10 @@ OPTION(INDI_BUILD_SHARED "Build shared library" ON) OPTION(INDI_BUILD_STATIC "Build static library" ON) OPTION(INDI_BUILD_XISF "Build XISF support" ON) +# System provided or bundled libs +OPTION(INDI_SYSTEM_HTTPLIB "Use system provided httplib" OFF) +OPTION(INDI_SYSTEM_JSONLIB "Use system provided json library" OFF) + if(UNIX AND NOT APPLE) OPTION(INDI_SHARED_MEMORY "Build INDI with support for UNIX protocol with shared memory" ON) else() @@ -165,6 +169,32 @@ install(FILES COMPONENT Devel ) +# ################################################################################################## +# #################################### bundled libs ############################################## +# ################################################################################################## +if(INDI_SYSTEM_HTTPLIB) + find_package(httplib REQUIRED) + include_directories(${HTTPLIB_INCLUDE_DIR}) + set(SYSTEM_HTTPLIB 1) + message(STATUS "Using system provided httplib version ${HTTPLIB_VERSION}") +else() + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/httplib) + set(SYSTEM_HTTPLIB 0) + message(STATUS "Using bundled httplib") +endif(INDI_SYSTEM_HTTPLIB) + +if(INDI_SYSTEM_JSONLIB) + find_package(nlohmann_json REQUIRED) + set(SYSTEM_JSONLIB 1) + set(JSONLIB nlohmann_json::nlohmann_json) + add_definitions(-D_USE_SYSTEM_JSONLIB) + message(STATUS "Using system provided Niels Lohmann's json library") +else(INDI_SYSTEM_JSONLIB) + set(SYSTEM_JSONLIB 0) + set(JSONLIB "") + message(STATUS "Using bundled json library") +endif(INDI_SYSTEM_JSONLIB) + # ################################################################################################### # # Component : INDI Core @@ -380,12 +410,22 @@ endif() # Install common dev files for all except server if(INDI_BUILD_DRIVERS OR INDI_BUILD_CLIENT OR INDI_BUILD_QT5_CLIENT) install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/libs/json.h - ${CMAKE_CURRENT_SOURCE_DIR}/libs/httplib.h ${CMAKE_CURRENT_SOURCE_DIR}/libs/inicpp.h ${CMAKE_CURRENT_BINARY_DIR}/indiversion.h DESTINATION ${INCLUDE_INSTALL_DIR}/libindi COMPONENT Devel ) + if(NOT SYSTEM_HTTPLIB) + install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/libs/httplib/httplib.h + DESTINATION ${INCLUDE_INSTALL_DIR}/libindi COMPONENT Devel + ) + endif(NOT SYSTEM_HTTPLIB) + if(NOT SYSTEM_JSONLIB) + install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/libs/indijson.hpp + DESTINATION ${INCLUDE_INSTALL_DIR}/libindi COMPONENT Devel + ) + endif(NOT SYSTEM_JSONLIB) endif(INDI_BUILD_DRIVERS OR INDI_BUILD_CLIENT OR INDI_BUILD_QT5_CLIENT) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/ChangeLog b/ChangeLog index e97c9bc1a8..d19c5bd14f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ ++ From 2.0.4 to 2.0.5 + + 4729c8b1e 2023-11-25 Jasem Mutlaq Another attempt at fixing MINGW32. Needs to test with CYGWIN + a223fb69c 2023-11-25 Jasem Mutlaq Fix on MINGW + ddf44bde7 2023-11-25 Jasem Mutlaq Use _WIN32 as the standard preprocessor macro for Windows builds + b24472523 2023-11-09 Orestes Sanchez Snapcap driver with network connections (#1961) + d045d17f3 2023-11-08 Jasem Mutlaq Fix issue with reporting updated measurements due to creep in from cumulative threshold + d7c3b1b93 2023-11-02 James Amendolagine Added several missing commands: (#1957) + 16fef45f2 2023-10-28 Jasem Mutlaq Escape backslashes in custom FITS values. Do not add TELESCOP keyword if already exists in custom headers + 1a85d8117 2023-10-27 Alain On step work (#1958) + 58ae68b81 2023-10-23 Alain Fixed 9 Stars Align (#1956) + 408b89251 2023-10-19 James Amendolagine Handling tracking mode in the pegasus driver, and enable King mode. (#1954) + b01e72046 2023-10-11 Sonny Cavazos Update ioptronv3driver.cpp (#1952) + d670b6acf 2023-10-10 Ladislav Heller Windows/Cygwin support (#1950) + 63757a06e 2023-10-10 Jasem Mutlaq Remove old package name. Fixes #1949 + 7f9f9645f 2023-10-10 Jasem Mutlaq Fix issue with temperature update. Fixes #1951 + bff9ddf06 2023-10-04 Jasem Mutlaq Do not turn cooler on if target temperature is higher than current + 7eb84626f 2023-10-09 Jasem Mutlaq Set park type per dome type + b38785840 2023-10-06 Mattia Verga Option to use system provided httplib (#1946) + ef37011d0 2023-10-06 Paweł Soja Fix PyIndi build fail - revert code formatting changes (#1948) + ac22c6c11 2023-10-05 Jasem Mutlaq Add option to toggle between dome and rolloff types + 769623ac3 2023-10-02 Jasem Mutlaq Add one more check to ensure minimum count is met (#1903) + f5ad7924f 2023-10-02 Jasem Mutlaq Remove all scope configuration from INDI::Telescope class as it was already moved to INDI::CCD class in prior releases and what is left in INDI::Tel.. + 6f156b476 2023-10-01 Jasem Mutlaq Only start if period is not zero + f81ced61d 2023-09-30 d33psky Fix issue 1938 (#1945) + + From 2.0.3 to 2.0.4 be521c4f3 2023-09-30 anjok Openastrotech (#1943) diff --git a/README.Cygwin b/README.Cygwin new file mode 100644 index 0000000000..75eecc8cea --- /dev/null +++ b/README.Cygwin @@ -0,0 +1,74 @@ +Build and install INDI on Windows/Cygwin platform +================================================= + +Install Cygwin and the required packages +------------------------------------ +Download Cygwin setup executable from [cygwin.com](https://cygwin.com/setup-x86_64.exe). It provides a GUI wizard to support the installation but probably it is faster to install it via the command line to a predefined location and a preselected list of required packages: + +> setup-x86_64.exe -q -v -R "C:\cygwin" -O -s "https://cygwin.mirror.constant.com/" -l "%Temp%\CygwinPackages" -P aalib-devel -P autoconf -P automake -P cmake -P curl -P gcc-g++ -P gettext -P gettext-devel -P git -P help2man -P libboost-devel -P libcfitsio-devel -P libcurl-devel -P libev-devel -P libexif-devel -P libffi-devel -P libfftw3-devel -P libftdi1-devel -P libgd-devel -P libgsl-devel -P libiconv -P libiconv-devel -P libintl-devel -P libjpeg-devel -P libkrb5-devel -P liblapack-devel -P libpng-devel -P libpng16-devel -P libpopt-devel -P libraw-devel -P libtheora-devel -P libtiff-devel -P libtool -P libusb-devel -P libusb0 -P libusb-win32 -P libxml2-devel -P m4 -P make -P mc -P procps-ng -P texi2html -P texinfo -P wget -P zlib-devel + +The above command line installs the Cygwin environment and required packages silently to the _C:\cygwin_ folder while downloading packages from the preselected mirror _https://cygwin.mirror.constant.com/_ to the current user's _TEMP_ folder. + +Note: +The latest versions of Cygwin installers support only 64-bit versions of Windows 7 and newer! + +Once Cygwin is installed, a shortcut icon to _Cygwin Terminal_ is created on the user's Desktop. It is recommended to run Cygwin Terminal with elevated privileges (by right-clicking and _Run as Administrator_). + +Build and install libnova +------------------------- +Since the [libnova](https://gitlab.com/libnova/libnova) is not prebuilt for Cygwin, but required for INDI, we have to build it manually: + +> git clone https://gitlab.com/libnova/libnova.git + +> cd ./libnova + +> ./autogen.sh + +> ./configure --prefix=/usr + +> make + +> make install + +Once built & installed, INDI should find its headers and library. + +Build and install INDI +---------------------- + +This is similar to what happens in Linux environments: + + +> git clone https://github.com/indilib/indi.git + +> cd ./indi + +> mkdir _build && cd _build + +> export CXXFLAGS="-std=c++17 -I/usr/lib/gcc/x86_64-pc-cygwin/11/include/c++" + +> cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug .. + +> make -j 4 + +> make install + +Build and install indiweb manager +---------------------------------- +Indiweb Manager is a python web application that requires the _psutil_ python package. In cygwin environment, we have to manually build this requirement package: + +> git clone -b cygwin/v3 https://github.com/embray/psutil.git + +> cd ./psutil + +> pip3 install -e . + +Once _psutil_ is installed we can easily install indiweb: + +> pip3 install indiweb + +Finally, run it: +> indi-web -v + +Test using clients like KSTARS +------------------------------ +Once INDI & indiweb manager are installed, all the simulator devices should work out-of-the-box using KSTARS/EKOS. diff --git a/README.md b/README.md index da92e6b52e..2bde161620 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ sudo apt-get install -y \ libusb-dev \ zlib1g-dev \ libftdi-dev \ - libgsl0-dev \ libjpeg-dev \ libkrb5-dev \ libnova-dev \ @@ -257,7 +256,7 @@ You can base a new driver from an existing driver. Look in either the examples o # Unit tests -In order to run the unit test suite you must first install the [Google Test Framework](https://github.com/google/googletest). You will need to build and install this from source code as Google does not recommend package managers for distributing distros.(This is because each build system is often unique and a one size fits all aproach does not work well). +In order to run the unit test suite you must first install the [Google Test Framework](https://github.com/google/googletest). You will need to build and install this from source code as Google does not recommend package managers for distributing distros.(This is because each build system is often unique and a one size fits all approach does not work well). Once you have the Google Test Framework installed follow this alternative build sequence:- diff --git a/debian/changelog b/debian/changelog index 6d7be254b4..f69e764d0a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libindi (2.0.5) focal; urgency=medium + + * Minor release. + + -- Jasem Mutlaq Fri, 1 Dec 2023 10:00:00 +0300 + libindi (2.0.4) focal; urgency=medium * Minor release. diff --git a/drivers.xml b/drivers.xml index 9bce86afad..9b2ba0b164 100644 --- a/drivers.xml +++ b/drivers.xml @@ -33,7 +33,7 @@ indi_lx200_OnStep - 1.20 + 1.22 indi_lx200_OpenAstroTech @@ -41,7 +41,7 @@ indi_lx200_TeenAstro - 1.3 + 1.4 indi_lx200_16 @@ -111,10 +111,6 @@ indi_lx200fs2 2.3 - - indi_lx200basic - 2.1 - indi_paramount_telescope 1.1 @@ -317,6 +313,10 @@ indi_robo_focus 1.0 + + indi_ieaf_focus + 1.0 + indi_fcusb_focus 0.3 @@ -429,6 +429,10 @@ indi_simulator_rotator 1.0 + + indi_wanderer_lite_rotator + 1.0 + indi_microtouch_focus 0.1 @@ -487,7 +491,7 @@ indi_siefs_focus - 0.1 + 0.2 indi_lacerta_mfoc_focus @@ -671,7 +675,7 @@ indi_snapcap - 1.2 + 1.3 indi_Excalibur @@ -725,14 +729,10 @@ indi_deepskydad_fr1 1.0 - - indi_wanderer_lite_rotator - 1.0 - indi_wanderer_cover 1.0 - + diff --git a/drivers/README.md b/drivers/README.md index a3818bd38a..7789f0c358 100644 --- a/drivers/README.md +++ b/drivers/README.md @@ -110,7 +110,7 @@ sudo apt-get update && sudo apt-get install indi-DRIVER_NAME

The Slew Rate dropdown is used to control the manual speeds when using the NSWE controls either directly or via a joystick. To set the GOTO speeds (when mount moves from one target to another via a GOTO command), you need to update the Custom Speeds control.

Site Management

-

Time, Locaiton, and Park settings are configured in the Site Management tab.

+

Time, Location, and Park settings are configured in the Site Management tab.

Site Management

  • UTC: UTC time and offsets must be set for proper operation of the driver upon connection. The UTC offset is in hours. East is positive and west is negative.
  • diff --git a/drivers/auxiliary/STAR2kdriver.c b/drivers/auxiliary/STAR2kdriver.c index 40b4438520..f98ca7589f 100644 --- a/drivers/auxiliary/STAR2kdriver.c +++ b/drivers/auxiliary/STAR2kdriver.c @@ -106,7 +106,7 @@ int ConnectSTAR2k(char *port) } /* Start a slew in chosen direction at slewRate */ -/* Use auxilliary NexStar command set through the hand control computer */ +/* Use auxiliary NexStar command set through the hand control computer */ void StartPulse(int direction) { diff --git a/drivers/auxiliary/astrometrydriver.cpp b/drivers/auxiliary/astrometrydriver.cpp index b29461bc19..00f8045d52 100644 --- a/drivers/auxiliary/astrometrydriver.cpp +++ b/drivers/auxiliary/astrometrydriver.cpp @@ -297,7 +297,7 @@ bool AstrometryDriver::processBLOB(uint8_t *data, uint32_t size, uint32_t len) if (destLen != size) { - LOGF_WARN("Discrepency between uncompressed data size %ld and expected size %ld", + LOGF_WARN("Discrepancy between uncompressed data size %ld and expected size %ld", size, destLen); } diff --git a/drivers/auxiliary/astrometrydriver.h b/drivers/auxiliary/astrometrydriver.h index c88978f649..97b57addb9 100644 --- a/drivers/auxiliary/astrometrydriver.h +++ b/drivers/auxiliary/astrometrydriver.h @@ -39,7 +39,7 @@ * The solver settings should be set before running the solver in order to ensure correct and timely response from astrometry.net * It is assumed that astrometry.net is property set-up in the same machine the driver is running along with the appropriate index files. * - * If the solver is successfull, the driver sets the solver results which include: + * If the solver is successful, the driver sets the solver results which include: * + Pixel Scale (arcsec/pixel). * + Orientation (E or W) degrees. * + Center RA (J2000) Hours. diff --git a/drivers/auxiliary/flip_flat.cpp b/drivers/auxiliary/flip_flat.cpp index eb9a494219..8492b654c9 100644 --- a/drivers/auxiliary/flip_flat.cpp +++ b/drivers/auxiliary/flip_flat.cpp @@ -150,6 +150,12 @@ bool FlipFlat::Handshake() i |= TIOCM_RTS; if (ioctl(PortFD, TIOCMBIC, &i) != 0) { + /* Try ping anyway, to allow flip-flat implementations using virtual serial ports to proceed */ + if(ping()) + { + LOG_DEBUG("Successfully connected to flip-flat without hardware IOCTL"); + return true; + } LOGF_ERROR("IOCTL error %s.", strerror(errno)); return false; } diff --git a/drivers/auxiliary/giotto.cpp b/drivers/auxiliary/giotto.cpp index e5f82df9e6..309662f1a9 100644 --- a/drivers/auxiliary/giotto.cpp +++ b/drivers/auxiliary/giotto.cpp @@ -73,7 +73,6 @@ bool GIOTTO::updateProperties() { defineProperty(&LightSP); defineProperty(&LightIntensityNP); - updateLightBoxProperties(); } else { @@ -81,6 +80,8 @@ bool GIOTTO::updateProperties() deleteProperty(LightIntensityNP.name); } + updateLightBoxProperties(); + return true; } diff --git a/drivers/auxiliary/mydcp4esp32.cpp b/drivers/auxiliary/mydcp4esp32.cpp index 22b45fa152..af4601999f 100644 --- a/drivers/auxiliary/mydcp4esp32.cpp +++ b/drivers/auxiliary/mydcp4esp32.cpp @@ -305,7 +305,7 @@ bool MyDCP4ESP::sendCommand(const char *cmd, char *resp) // Determine which of the 4 channels have temperature probes attached. Only those with probes can be active // except for Channel 3 which can mirrior Channels 1 & 2 or be controlled manually. -// Check to see if each channel can be set to Overide if it doesn't currently have a power output +// Check to see if each channel can be set to Override if it doesn't currently have a power output bool MyDCP4ESP::getActiveChannels() { char cmd[MDCP_CMD_LENGTH] = {}; @@ -519,7 +519,7 @@ bool MyDCP4ESP::setAmbientOffset(float value) return sendCommand(cmd, nullptr); } -// set or reset Channel overide. Channel = 5 resets all channels +// set or reset Channel override. Channel = 5 resets all channels bool MyDCP4ESP::setChannelBoost( unsigned int channel, unsigned int value) { char cmd[MDCP_CMD_LENGTH] = {}; @@ -839,7 +839,7 @@ bool MyDCP4ESP::readSettings() if ((ok == 1) && (ch3_mode <= 4)) { - // Enabel/Disable Ch3 Manual Power setting if Ch3 Mode Manual enabled + // Enable/Disable Ch3 Manual Power setting if Ch3 Mode Manual enabled if ((ch3_mode == CH3MODE_MANUAL) && (!ch3ManualPower)) { defineProperty(Ch3ManualPowerNP); diff --git a/drivers/auxiliary/mydcp4esp32.h b/drivers/auxiliary/mydcp4esp32.h index 13f52482f4..fc1a52d164 100644 --- a/drivers/auxiliary/mydcp4esp32.h +++ b/drivers/auxiliary/mydcp4esp32.h @@ -85,7 +85,7 @@ #define MDCP_GET_ALL_CH_POWER_CMD ":40#" // Get the power settings for ch1/ch2/ch3/ch4 - Response: lch1pwr,ch2pwr,ch3pwr,ch4pwr# #define MDCP_SET_CH3_MODE_CMD ":41%d#" // Set the Channel 3 mode (0=disabled, 1=dewstrap1, 2=dewstrap2, 3=Manual, 4=use temp probe3) - Response: none #define MDCP_GET_CH3_MODE_CMD ":42#" // Get the Channel 3 mode (0=disabled, 1=dewstrap1, 2=dewstrap2, 3=Manual, 4=use temp probe3) - Response: mmode# -#define MDCP_SET_CH3_MANUAL_POWER_CMD ":43%d#" // Set the Channel 3 power to a manual seting of Num - Response: none +#define MDCP_SET_CH3_MANUAL_POWER_CMD ":43%d#" // Set the Channel 3 power to a manual setting of Num - Response: none /**************************** myDCP4ESP32 Command Responses **************************/ @@ -128,7 +128,7 @@ #define MDCP_GET_ALL_CH_POWER_RES "l%d,%d,%d,%d" // Get the power settings for ch1/ch2/ch3/ch4 - Response: lch1pwr,ch2pwr,ch3pwr,ch4pwr# #define MDCP_SET_CH3_MODE_RES "" // Set the Channel 3 mode (0=disabled, 1=dewstrap1, 2=dewstrap2, 3=Manual, 4=use temp probe3) - Response: none #define MDCP_GET_CH3_MODE_RES "m%d" // Get the Channel 3 mode (0=disabled, 1=dewstrap1, 2=dewstrap2, 3=Manual, 4=use temp probe3) - Response: mmode# -#define MDCP_SET_CH3_MANUAL_POWER_RES "" // Set the Channel 3 power to a manual seting of Num - Response: none +#define MDCP_SET_CH3_MANUAL_POWER_RES "" // Set the Channel 3 power to a manual setting of Num - Response: none /******************************************************************************/ diff --git a/drivers/auxiliary/pegasus_upb.cpp b/drivers/auxiliary/pegasus_upb.cpp index 437d3e19cc..ea243d8d3d 100644 --- a/drivers/auxiliary/pegasus_upb.cpp +++ b/drivers/auxiliary/pegasus_upb.cpp @@ -98,7 +98,7 @@ bool PegasusUPB::initProperties() /// Power Group //////////////////////////////////////////////////////////////////////////// - // Dew Labels. Need to delare them here to use in the Power usage section + // Dew Labels. Need to declare them here to use in the Power usage section IUFillText(&DewControlsLabelsT[0], "DEW_LABEL_1", "Dew A", "Dew A"); IUFillText(&DewControlsLabelsT[1], "DEW_LABEL_2", "Dew B", "Dew B"); IUFillText(&DewControlsLabelsT[2], "DEW_LABEL_3", "Dew C", "Dew C"); diff --git a/drivers/auxiliary/planewave_delta.h b/drivers/auxiliary/planewave_delta.h index cb2c39f3c8..18ee9f00a8 100644 --- a/drivers/auxiliary/planewave_delta.h +++ b/drivers/auxiliary/planewave_delta.h @@ -116,7 +116,7 @@ class DeltaT : public INDI::DefaultDevice /// Properties /////////////////////////////////////////////////////////////////////////////////// - // Delta-T Informatin + // Delta-T Information ITextVectorProperty InfoTP; IText InfoT[1] {}; enum diff --git a/drivers/auxiliary/skysafariclient.cpp b/drivers/auxiliary/skysafariclient.cpp index 81699c2221..c01a2cd7cb 100644 --- a/drivers/auxiliary/skysafariclient.cpp +++ b/drivers/auxiliary/skysafariclient.cpp @@ -187,7 +187,7 @@ bool SkySafariClient::setSlewRate(int slewRate) int finalSlewRate = slewRate; - // If slew rate is betwee min and max, we intepolate + // If slew rate is between min and max, we interpolate if (slewRate > 0 && slewRate < maxSlewRate) finalSlewRate = static_cast(ceil(slewRate * maxSlewRate / 3.0)); diff --git a/drivers/auxiliary/snapcap.cpp b/drivers/auxiliary/snapcap.cpp index 006f6917fa..2e9ff9dd2d 100644 --- a/drivers/auxiliary/snapcap.cpp +++ b/drivers/auxiliary/snapcap.cpp @@ -28,6 +28,7 @@ #include "indicom.h" #include "connectionplugins/connectionserial.h" +#include "connectionplugins/connectiontcp.h" #include #include @@ -44,7 +45,13 @@ std::unique_ptr snapcap(new SnapCap()); SnapCap::SnapCap() : LightBoxInterface(this, true) { - setVersion(1, 2); + setVersion(1, 3); +} + +SnapCap::~SnapCap(){ + + delete serialConnection; + delete tcpConnection; } bool SnapCap::initProperties() @@ -82,13 +89,27 @@ bool SnapCap::initProperties() addAuxControls(); - serialConnection = new Connection::Serial(this); - serialConnection->registerHandshake([&]() + if (dustcapConnection & CONNECTION_SERIAL) + { + serialConnection = new Connection::Serial(this); + serialConnection->registerHandshake([&]() + { + return callHandshake(); + }); + registerConnection(serialConnection); + } + + if (dustcapConnection & CONNECTION_TCP) { - return Handshake(); - }); - registerConnection(serialConnection); - serialConnection->setDefaultBaudRate(Connection::Serial::B_38400); + tcpConnection = new Connection::TCP(this); + tcpConnection->registerHandshake([&]() + { + return callHandshake(); + }); + registerConnection(tcpConnection); + } + + return true; } @@ -152,8 +173,6 @@ bool SnapCap::Handshake() return true; } - PortFD = serialConnection->getPortFD(); - if (!ping()) { LOG_ERROR("Device ping failed."); @@ -163,6 +182,19 @@ bool SnapCap::Handshake() return true; } +bool SnapCap::callHandshake() +{ + if (dustcapConnection > 0) + { + if (getActiveConnection() == serialConnection) + PortFD = serialConnection->getPortFD(); + else if (getActiveConnection() == tcpConnection) + PortFD = tcpConnection->getPortFD(); + } + + return Handshake(); +} + bool SnapCap::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) { if (!dev || strcmp(dev, getDeviceName())) @@ -199,8 +231,8 @@ bool SnapCap::ISNewSwitch(const char *dev, const char *name, ISState *states, ch } if (ForceSP.isNameMatch(name)) { - AbortSP.update(states, names, n); - AbortSP.apply(); + ForceSP.update(states, names, n); + ForceSP.apply(); return true; } @@ -642,3 +674,22 @@ bool SnapCap::SetLightBoxBrightness(uint16_t value) return true; } + +uint8_t SnapCap::getDustcapConnection() const +{ + return dustcapConnection; +} + +void SnapCap::setDustcapConnection(const uint8_t &value) +{ + uint8_t mask = CONNECTION_SERIAL | CONNECTION_TCP | CONNECTION_NONE; + + if (value == 0 || (mask & value) == 0) + { + LOGF_ERROR( "Invalid connection mode %d", value); + return; + } + + dustcapConnection = value; +} + diff --git a/drivers/auxiliary/snapcap.h b/drivers/auxiliary/snapcap.h index 3b09b7d3ed..b69850f234 100644 --- a/drivers/auxiliary/snapcap.h +++ b/drivers/auxiliary/snapcap.h @@ -35,13 +35,14 @@ namespace Connection { class Serial; +class TCP; } class SnapCap : public INDI::DefaultDevice, public INDI::LightBoxInterface, public INDI::DustCapInterface { public: SnapCap(); - virtual ~SnapCap() = default; + virtual ~SnapCap(); virtual bool initProperties() override; virtual void ISGetProperties(const char *dev) override; @@ -52,6 +53,28 @@ class SnapCap : public INDI::DefaultDevice, public INDI::LightBoxInterface, publ virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; virtual bool ISSnoopDevice(XMLEle *root) override; + /** \struct SnapcapConnection + \brief Holds the connection mode of the Dome. + */ + enum + { + CONNECTION_NONE = 1 << 0, /** Do not use any connection plugin */ + CONNECTION_SERIAL = 1 << 1, /** For regular serial and bluetooth connections */ + CONNECTION_TCP = 1 << 2 /** For Wired and WiFI connections */ + } DustcapConnection; + + /** + * @brief setDustcapConnection Set Dustcap connection mode. Child class should call this in the constructor before Dustcap registers + * any connection interfaces + * @param value ORed combination of DustcapConnection values. + */ + void setDustcapConnection(const uint8_t &value); + + /** + * @return Get current Dustcap connection mode + */ + uint8_t getDustcapConnection() const; + protected: const char *getDefaultName() override; @@ -100,5 +123,9 @@ class SnapCap : public INDI::DefaultDevice, public INDI::LightBoxInterface, publ uint8_t prevMotorStatus{ 0xFF }; uint8_t prevBrightness{ 0xFF }; - Connection::Serial *serialConnection{ nullptr }; -}; + Connection::Serial *serialConnection = nullptr; + Connection::TCP *tcpConnection = nullptr; + + private: + bool callHandshake(); + uint8_t dustcapConnection = CONNECTION_SERIAL | CONNECTION_TCP;}; diff --git a/drivers/auxiliary/sqm.h b/drivers/auxiliary/sqm.h index 43be1494b2..ac6b995b30 100644 --- a/drivers/auxiliary/sqm.h +++ b/drivers/auxiliary/sqm.h @@ -103,6 +103,6 @@ class SQM : public INDI::DefaultDevice static const char DRIVER_STOP_CHAR { 0x0A }; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {128}; }; diff --git a/drivers/auxiliary/wanderer_cover.cpp b/drivers/auxiliary/wanderer_cover.cpp index ba359895d6..a7eff05ccc 100644 --- a/drivers/auxiliary/wanderer_cover.cpp +++ b/drivers/auxiliary/wanderer_cover.cpp @@ -124,7 +124,7 @@ bool WandererCover::Handshake() { if (isSimulation()) { - LOGF_INFO("Connected successfuly to simulated %s. Retrieving startup data...", getDeviceName()); + LOGF_INFO("Connected successfully to simulated %s. Retrieving startup data...", getDeviceName()); // SetTimer(getCurrentPollingPeriod()); IUSaveText(&FirmwareT[0], "Simulation version"); @@ -716,7 +716,7 @@ void WandererCover::displayConfigurationMessage() LOG_WARN(" - Click on 'Set current position as close' to define the park position"); LOG_WARN(" - Use again the select list to move your cover panel in close position on the scope"); LOG_WARN(" - Click on 'Set current position as open' to define the unpark position"); - LOG_WARN(" - Use the select controler to move your panel to the open position"); + LOG_WARN(" - Use the select controller to move your panel to the open position"); LOG_WARN("In order to do so, go to 'Dust cover configurtation' tab and do the following steps :"); LOG_WARN("Before first use, or when you change your setup, you need to configure Open and closed position first in 'Dust cover configurtation' tab."); } \ No newline at end of file diff --git a/drivers/auxiliary/watchdog.cpp b/drivers/auxiliary/watchdog.cpp index 5cea196949..7c5063e2df 100644 --- a/drivers/auxiliary/watchdog.cpp +++ b/drivers/auxiliary/watchdog.cpp @@ -606,7 +606,7 @@ void WatchDog::TimerHit() break; } - // Watch mount if requied + // Watch mount if required if (ShutdownProcedureS[PARK_MOUNT].s == ISS_ON) m_WatchDogClientInstance->setMount(ActiveDeviceT[ACTIVE_TELESCOPE].text); // Watch dome diff --git a/drivers/ccd/ccd_simulator.cpp b/drivers/ccd/ccd_simulator.cpp index 385f878a96..90a02e7f53 100644 --- a/drivers/ccd/ccd_simulator.cpp +++ b/drivers/ccd/ccd_simulator.cpp @@ -189,6 +189,15 @@ bool CCDSim::initProperties() DirectorySP[INDI_DISABLED].fill("INDI_DISABLED", "Disabled", ISS_ON); DirectorySP.fill(getDeviceName(), "CCD_DIRECTORY_TOGGLE", "Use Dir.", SIMULATOR_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); + // Resolution + for (uint8_t i = 0; i < Resolutions.size(); i++) + { + std::ostringstream ss; + ss << Resolutions[i].first << " x " << Resolutions[i].second; + ResolutionSP[i].fill(ss.str().c_str(), ss.str().c_str(), i == 0 ? ISS_ON : ISS_OFF); + } + ResolutionSP.fill(getDeviceName(), "CCD_RESOLUTION", "Resolution", SIMULATOR_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); + auto mount = ActiveDeviceT[ACTIVE_TELESCOPE].text ? ActiveDeviceT[ACTIVE_TELESCOPE].text : ""; #ifdef USE_EQUATORIAL_PE @@ -274,6 +283,7 @@ bool CCDSim::updateProperties() defineProperty(DirectoryTP); defineProperty(DirectorySP); + defineProperty(ResolutionSP); setupParameters(); @@ -295,6 +305,7 @@ bool CCDSim::updateProperties() deleteProperty(OffsetNP.name); deleteProperty(DirectoryTP); deleteProperty(DirectorySP); + deleteProperty(ResolutionSP); INDI::FilterInterface::updateProperties(); } @@ -311,9 +322,10 @@ int CCDSim::SetTemperature(double temperature) return 1; } - CoolerS[0].s = ISS_ON; - CoolerS[1].s = ISS_OFF; - CoolerSP.s = IPS_BUSY; + auto isCooling = TemperatureRequest < temperature; + CoolerS[0].s = isCooling ? ISS_ON : ISS_OFF; + CoolerS[1].s = isCooling ? ISS_OFF : ISS_ON; + CoolerSP.s = isCooling ? IPS_BUSY : IPS_IDLE; IDSetSwitch(&CoolerSP, nullptr); return 0; } @@ -410,7 +422,7 @@ void CCDSim::TimerHit() float timeleft; timeleft = CalcTimeLeft(ExpStart, ExposureRequest); - //IDLog("CCD Exposure left: %g - Requset: %g\n", timeleft, ExposureRequest); + //IDLog("CCD Exposure left: %g - Request: %g\n", timeleft, ExposureRequest); if (timeleft < 0) timeleft = 0; @@ -723,7 +735,7 @@ int CCDSim::DrawCcdFrame(INDI::CCDChip * targetChip) while (fgets(line, 256, pp) != nullptr) { - // ok, lets parse this line for specifcs we want + // ok, lets parse this line for specifics we want char id[20]; char plate[6]; char ob[6]; @@ -1204,6 +1216,30 @@ bool CCDSim::ISNewSwitch(const char * dev, const char * name, ISState * states, DirectorySP.apply(nullptr); return true; } + else if (ResolutionSP.isNameMatch(name)) + { + ResolutionSP.update(states, names, n); + ResolutionSP.setState(IPS_OK); + ResolutionSP.apply(); + + int index = ResolutionSP.findOnSwitchIndex(); + if (index >= 0 && index < static_cast(Resolutions.size())) + { + SimulatorSettingsN[SIM_XRES].value = Resolutions[index].first; + SimulatorSettingsN[SIM_YRES].value = Resolutions[index].second; + SetCCDParams(SimulatorSettingsN[SIM_XRES].value, + SimulatorSettingsN[SIM_YRES].value, + 16, + SimulatorSettingsN[SIM_XSIZE].value, + SimulatorSettingsN[SIM_YSIZE].value); + UpdateCCDFrame(0, 0, SimulatorSettingsN[SIM_XRES].value, SimulatorSettingsN[SIM_YRES].value); + uint32_t nbuf = PrimaryCCD.getXRes() * PrimaryCCD.getYRes() * PrimaryCCD.getBPP() / 8; + PrimaryCCD.setFrameBufferSize(nbuf); + + IDSetNumber(&SimulatorSettingsNP, nullptr); + } + return true; + } else if (strcmp(name, CrashSP.name) == 0) { abort(); @@ -1360,6 +1396,9 @@ bool CCDSim::saveConfigItems(FILE * fp) // Directory DirectoryTP.save(fp); + // Resolution + ResolutionSP.save(fp); + // Bayer IUSaveConfigSwitch(fp, &SimulateBayerSP); diff --git a/drivers/ccd/ccd_simulator.h b/drivers/ccd/ccd_simulator.h index ec834c1bda..b96d93e694 100644 --- a/drivers/ccd/ccd_simulator.h +++ b/drivers/ccd/ccd_simulator.h @@ -240,5 +240,12 @@ class CCDSim : public INDI::CCD, public INDI::FilterInterface ISwitchVectorProperty CrashSP; ISwitch CrashS[1]; + INDI::PropertySwitch ResolutionSP {2}; + inline static const std::vector> Resolutions = + { + {1280, 1024}, + {6000, 4000} + }; + static const constexpr char* SIMULATOR_TAB = "Simulator Config"; }; diff --git a/drivers/ccd/guide_simulator.cpp b/drivers/ccd/guide_simulator.cpp index 49f9715daf..cf1fd6aa38 100644 --- a/drivers/ccd/guide_simulator.cpp +++ b/drivers/ccd/guide_simulator.cpp @@ -333,7 +333,7 @@ void GuideSim::TimerHit() float timeleft; timeleft = CalcTimeLeft(ExpStart, ExposureRequest); - //IDLog("CCD Exposure left: %g - Requset: %g\n", timeleft, ExposureRequest); + //IDLog("CCD Exposure left: %g - Request: %g\n", timeleft, ExposureRequest); if (timeleft < 0) timeleft = 0; diff --git a/drivers/dome/dome_script.cpp b/drivers/dome/dome_script.cpp index 4494d0d1f6..55b893ac9f 100644 --- a/drivers/dome/dome_script.cpp +++ b/drivers/dome/dome_script.cpp @@ -50,74 +50,126 @@ static std::unique_ptr scope_script(new DomeScript()); DomeScript::DomeScript() { - SetDomeCapability(DOME_CAN_PARK | DOME_CAN_ABORT | DOME_CAN_ABS_MOVE | DOME_HAS_SHUTTER); } const char *DomeScript::getDefaultName() { - return (const char *)"Dome Scripting Gateway"; + return "Dome Scripting Gateway"; } bool DomeScript::initProperties() { INDI::Dome::initProperties(); - SetParkDataType(PARK_AZ); #if defined(__APPLE__) - IUFillText(&ScriptsT[SCRIPT_FOLDER], "SCRIPT_FOLDER", "Folder", "/usr/local/share/indi/scripts"); + ScriptsTP[SCRIPT_FOLDER].fill("SCRIPT_FOLDER", "Folder", "/usr/local/share/indi/scripts"); #else - IUFillText(&ScriptsT[SCRIPT_FOLDER], "SCRIPT_FOLDER", "Folder", "/usr/share/indi/scripts"); + ScriptsTP[SCRIPT_FOLDER].fill("SCRIPT_FOLDER", "Folder", "/usr/share/indi/scripts"); #endif - IUFillText(&ScriptsT[SCRIPT_CONNECT], "SCRIPT_CONNECT", "Connect script", "connect.py"); - IUFillText(&ScriptsT[SCRIPT_DISCONNECT], "SCRIPT_DISCONNECT", "Disconnect script", "disconnect.py"); - IUFillText(&ScriptsT[SCRIPT_STATUS], "SCRIPT_STATUS", "Get status script", "status.py"); - IUFillText(&ScriptsT[SCRIPT_OPEN], "SCRIPT_OPEN", "Open shutter script", "open.py"); - IUFillText(&ScriptsT[SCRIPT_CLOSE], "SCRIPT_CLOSE", "Close shutter script", "close.py"); - IUFillText(&ScriptsT[SCRIPT_PARK], "SCRIPT_PARK", "Park script", "park.py"); - IUFillText(&ScriptsT[SCRIPT_UNPARK], "SCRIPT_UNPARK", "Unpark script", "unpark.py"); - IUFillText(&ScriptsT[SCRIPT_GOTO], "SCRIPT_GOTO", "Goto script", "goto.py"); - IUFillText(&ScriptsT[SCRIPT_MOVE_CW], "SCRIPT_MOVE_CW", "Move clockwise script", "move_cw.py"); - IUFillText(&ScriptsT[SCRIPT_MOVE_CCW], "SCRIPT_MOVE_CCW", "Move counter clockwise script", "move_ccw.py"); - IUFillText(&ScriptsT[SCRIPT_ABORT], "SCRIPT_ABORT", "Abort motion script", "abort.py"); - IUFillTextVector(&ScriptsTP, ScriptsT, SCRIPT_COUNT, getDefaultName(), "SCRIPTS", "Scripts", OPTIONS_TAB, IP_RW, 60, - IPS_IDLE); + + ScriptsTP[SCRIPT_CONNECT].fill("SCRIPT_CONNECT", "Connect script", "connect.py"); + ScriptsTP[SCRIPT_DISCONNECT].fill("SCRIPT_DISCONNECT", "Disconnect script", "disconnect.py"); + ScriptsTP[SCRIPT_STATUS].fill("SCRIPT_STATUS", "Get status script", "status.py"); + ScriptsTP[SCRIPT_OPEN].fill("SCRIPT_OPEN", "Open shutter script", "open.py"); + ScriptsTP[SCRIPT_CLOSE].fill("SCRIPT_CLOSE", "Close shutter script", "close.py"); + ScriptsTP[SCRIPT_PARK].fill("SCRIPT_PARK", "Park script", "park.py"); + ScriptsTP[SCRIPT_UNPARK].fill("SCRIPT_UNPARK", "Unpark script", "unpark.py"); + ScriptsTP[SCRIPT_GOTO].fill("SCRIPT_GOTO", "Goto script", "goto.py"); + ScriptsTP[SCRIPT_MOVE_CW].fill("SCRIPT_MOVE_CW", "Move clockwise script", "move_cw.py"); + ScriptsTP[SCRIPT_MOVE_CCW].fill("SCRIPT_MOVE_CCW", "Move counter clockwise script", "move_ccw.py"); + ScriptsTP[SCRIPT_ABORT].fill("SCRIPT_ABORT", "Abort motion script", "abort.py"); + ScriptsTP.fill(getDeviceName(), "SCRIPTS", "Scripts", OPTIONS_TAB, IP_RW, 60, IPS_IDLE); + ScriptsTP.load(); + + // Dome Type + TypeSP[Dome].fill("DOME", "Dome", ISS_ON); + TypeSP[Rolloff].fill("ROLLOFF", "Roll off", ISS_OFF); + TypeSP.fill(getDeviceName(), "DOME_TYPE", "Type", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); + TypeSP.load(); + + if (TypeSP[Dome].getState() == ISS_ON) + { + SetParkDataType(PARK_AZ); + SetDomeCapability(DOME_CAN_PARK | DOME_CAN_ABORT | DOME_CAN_ABS_MOVE | DOME_HAS_SHUTTER); + } + else + { + SetParkDataType(PARK_NONE); + SetDomeCapability(DOME_CAN_PARK | DOME_CAN_ABORT); + } setDefaultPollingPeriod(2000); return true; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::saveConfigItems(FILE *fp) { INDI::Dome::saveConfigItems(fp); - IUSaveConfigText(fp, &ScriptsTP); + + TypeSP.save(fp); + ScriptsTP.save(fp); return true; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// void DomeScript::ISGetProperties(const char *dev) { INDI::Dome::ISGetProperties(dev); - defineProperty(&ScriptsTP); - loadConfig(true, "SCRIPTS"); + + defineProperty(TypeSP); + defineProperty(ScriptsTP); } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { - if (strcmp(name, ScriptsTP.name) == 0) + if (ScriptsTP.isNameMatch(name)) { - IUUpdateText(&ScriptsTP, texts, names, n); - ScriptsTP.s = IPS_OK; - IDSetText(&ScriptsTP, nullptr); + ScriptsTP.update(texts, names, n); + ScriptsTP.setState(IPS_OK); + ScriptsTP.apply(); + saveConfig(ScriptsTP); return true; } } return Dome::ISNewText(dev, name, texts, names, n); } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// +bool DomeScript::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) +{ + if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) + { + if (TypeSP.isNameMatch(name)) + { + TypeSP.update(states, names, n); + TypeSP.setState(IPS_OK); + TypeSP.apply(); + saveConfig(TypeSP); + LOG_INFO("Driver must be restarted for this change to take effect"); + return true; + } + } + return Dome::ISNewSwitch(dev, name, states, names, n); +} + +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::RunScript(int script, ...) { char tmp[256]; - strncpy(tmp, ScriptsT[script].text, sizeof(tmp)); + strncpy(tmp, ScriptsTP[script].getText(), sizeof(tmp)); char **args = (char **)malloc(MAXARGS * sizeof(char *)); int arg = 1; @@ -143,7 +195,7 @@ bool DomeScript::RunScript(int script, ...) } va_end(ap); char path[1024]; - snprintf(path, sizeof(path), "%s/%s", ScriptsT[0].text, tmp); + snprintf(path, sizeof(path), "%s/%s", ScriptsTP[0].getText(), tmp); if (access(path, F_OK | X_OK) != 0) { @@ -180,11 +232,14 @@ bool DomeScript::RunScript(int script, ...) { int status; waitpid(pid, &status, 0); - LOGF_DEBUG("Script %s returned %d", ScriptsT[script].text, status); + LOGF_DEBUG("Script %s returned %d", ScriptsTP[script].getText(), status); return status == 0; } } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::updateProperties() { INDI::Dome::updateProperties(); @@ -204,6 +259,9 @@ bool DomeScript::updateProperties() return true; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// void DomeScript::TimerHit() { if (!isConnected()) @@ -228,6 +286,7 @@ void DomeScript::TimerHit() fclose(file); unlink(tmpfile); DomeAbsPosN[0].value = az = round(range360(az) * 10) / 10; + if (parked != 0) { if (getDomeState() == DOME_PARKING || getDomeState() == DOME_UNPARKED) @@ -246,7 +305,7 @@ void DomeScript::TimerHit() LOG_INFO("Unpark successfully executed"); } } - if (std::round(az * 10) != std::round(TargetAz * 10)) + if (TypeSP[Dome].getState() == ISS_ON && std::round(az * 10) != std::round(TargetAz * 10)) { LOGF_INFO("Moving %g -> %g %d", std::round(az * 10) / 10, std::round(TargetAz * 10) / 10, getDomeState()); IDSetNumber(&DomeAbsPosNP, nullptr); @@ -256,24 +315,28 @@ void DomeScript::TimerHit() setDomeState(DOME_SYNCED); IDSetNumber(&DomeAbsPosNP, nullptr); } - if (m_ShutterState == SHUTTER_OPENED) + + if (TypeSP[Dome].getState() == ISS_ON) { - if (shutter == 0) + if (m_ShutterState == SHUTTER_OPENED) { - m_ShutterState = SHUTTER_CLOSED; - DomeShutterSP.s = IPS_OK; - IDSetSwitch(&DomeShutterSP, nullptr); - LOG_INFO("Shutter was successfully closed"); + if (shutter == 0) + { + m_ShutterState = SHUTTER_CLOSED; + DomeShutterSP.s = IPS_OK; + IDSetSwitch(&DomeShutterSP, nullptr); + LOG_INFO("Shutter was successfully closed"); + } } - } - else - { - if (shutter == 1) + else { - m_ShutterState = SHUTTER_OPENED; - DomeShutterSP.s = IPS_OK; - IDSetSwitch(&DomeShutterSP, nullptr); - LOG_INFO("Shutter was successfully opened"); + if (shutter == 1) + { + m_ShutterState = SHUTTER_OPENED; + DomeShutterSP.s = IPS_OK; + IDSetSwitch(&DomeShutterSP, nullptr); + LOG_INFO("Shutter was successfully opened"); + } } } } @@ -282,13 +345,17 @@ void DomeScript::TimerHit() LOG_ERROR("Failed to read status"); } SetTimer(getCurrentPollingPeriod()); - if (!isParked() && TimeSinceUpdate++ > 4) + + if (TypeSP[Dome].getState() == ISS_ON && !isParked() && TimeSinceUpdate++ > 4) { TimeSinceUpdate = 0; UpdateMountCoords(); } } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::Connect() { if (isConnected()) @@ -306,6 +373,9 @@ bool DomeScript::Connect() return status; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::Disconnect() { bool status = RunScript(SCRIPT_DISCONNECT, nullptr); @@ -320,6 +390,9 @@ bool DomeScript::Disconnect() return status; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::Park() { bool status = RunScript(SCRIPT_PARK, nullptr); @@ -331,6 +404,9 @@ IPState DomeScript::Park() return IPS_ALERT; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::UnPark() { bool status = RunScript(SCRIPT_UNPARK, nullptr); @@ -342,6 +418,9 @@ IPState DomeScript::UnPark() return IPS_ALERT; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::ControlShutter(ShutterOperation operation) { if (RunScript(operation == SHUTTER_OPEN ? SCRIPT_OPEN : SCRIPT_CLOSE, nullptr)) @@ -352,6 +431,9 @@ IPState DomeScript::ControlShutter(ShutterOperation operation) return IPS_ALERT; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::MoveAbs(double az) { char _az[16]; @@ -366,35 +448,42 @@ IPState DomeScript::MoveAbs(double az) return IPS_ALERT; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::Move(DomeDirection dir, DomeMotionCommand operation) { + auto commandOk = false; if (operation == MOTION_START) { if (RunScript(dir == DOME_CW ? SCRIPT_MOVE_CW : SCRIPT_MOVE_CCW, nullptr)) { - DomeAbsPosNP.s = IPS_BUSY; - TargetAz = -1; + commandOk = true; + TargetAz = -1; } else { - DomeAbsPosNP.s = IPS_ALERT; + commandOk = false; } } else { - if (RunScript(SCRIPT_ABORT, nullptr)) - { - DomeAbsPosNP.s = IPS_IDLE; - } - else - { - DomeAbsPosNP.s = IPS_ALERT; - } + commandOk = RunScript(SCRIPT_ABORT, nullptr); } - IDSetNumber(&DomeAbsPosNP, nullptr); - return ((operation == MOTION_START) ? IPS_BUSY : IPS_OK); + + auto state = commandOk ? (operation == MOTION_START ? IPS_BUSY : IPS_OK) : IPS_ALERT; + if (TypeSP[Dome].getState()) + { + DomeAbsPosNP.s = state; + IDSetNumber(&DomeAbsPosNP, nullptr); + } + + return state; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::Abort() { bool status = RunScript(SCRIPT_ABORT, nullptr); diff --git a/drivers/dome/dome_script.h b/drivers/dome/dome_script.h index 3d276312b0..2fd8e85a91 100644 --- a/drivers/dome/dome_script.h +++ b/drivers/dome/dome_script.h @@ -1,4 +1,5 @@ /******************************************************************************* + Copyright(c) 2023 Jasem Mutlaq Copyright(c) 2016 CloudMakers, s. r. o.. All rights reserved. This library is free software; you can redistribute it and/or @@ -19,6 +20,8 @@ #pragma once #include "indidome.h" +#include "indipropertyswitch.h" +#include "indipropertytext.h" class DomeScript : public INDI::Dome { @@ -31,7 +34,9 @@ class DomeScript : public INDI::Dome virtual bool saveConfigItems(FILE *fp) override; void ISGetProperties(const char *dev) override; - bool ISNewText(const char *dev, const char *name, char *texts[], 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; + bool updateProperties() override; protected: @@ -49,8 +54,15 @@ class DomeScript : public INDI::Dome bool ReadDomeStatus(); bool RunScript(int script, ...); - ITextVectorProperty ScriptsTP; - IText ScriptsT[15] {}; + INDI::PropertyText ScriptsTP {15}; + + INDI::PropertySwitch TypeSP {2}; + enum + { + Dome, + Rolloff + }; + double TargetAz { 0 }; int TimeSinceUpdate { 0 }; }; diff --git a/drivers/dome/domepro2.h b/drivers/dome/domepro2.h index f61390b45f..ca54e1fd17 100644 --- a/drivers/dome/domepro2.h +++ b/drivers/dome/domepro2.h @@ -119,7 +119,7 @@ class DomePro2 : public INDI::Dome * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ @@ -174,7 +174,7 @@ class DomePro2 : public INDI::Dome static const char DRIVER_STOP_CHAR { 0x3B }; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {64}; // Dome AZ Threshold static constexpr const double DOME_AZ_THRESHOLD {0.01}; @@ -225,7 +225,7 @@ class DomePro2 : public INDI::Dome {"Parking", "Parking"}, {"Gauging", "Gauging"}, {"Timeout", "Azimuth movement timeout"}, - {"Stall", "Azimuth encoder registering insufficent counts… motor stalled"}, + {"Stall", "Azimuth encoder registering insufficient counts… motor stalled"}, {"OCP", "Over Current Protection was tripped"} }; diff --git a/drivers/dome/nexdome_beaver.h b/drivers/dome/nexdome_beaver.h index 78e33bccaf..0d7e99a974 100644 --- a/drivers/dome/nexdome_beaver.h +++ b/drivers/dome/nexdome_beaver.h @@ -200,7 +200,7 @@ class Beaver : public INDI::Dome 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. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {128}; int domeDir = 1; double lastAzDiff = 1; diff --git a/drivers/dome/rigel_dome.h b/drivers/dome/rigel_dome.h index 7f8b70d0b6..2903d8d373 100644 --- a/drivers/dome/rigel_dome.h +++ b/drivers/dome/rigel_dome.h @@ -134,6 +134,6 @@ class RigelDome : public INDI::Dome static const char DRIVER_STOP_CHAR { 0x0D }; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {64}; }; diff --git a/drivers/dome/scopedome_dome.h b/drivers/dome/scopedome_dome.h index 3b6a491b54..e3f97a27b4 100644 --- a/drivers/dome/scopedome_dome.h +++ b/drivers/dome/scopedome_dome.h @@ -256,7 +256,7 @@ class ScopeDome : public INDI::Dome INDI::PropertyText CredentialsTP{2}; - // Dynamic properies initialized based on card type + // Dynamic properties initialized based on card type INDI::PropertySwitch RelaysSP{0}; INDI::PropertyNumber SensorsNP{0}; INDI::PropertySwitch InputsSP{0}; diff --git a/drivers/filter_wheel/ifwoptec.cpp b/drivers/filter_wheel/ifwoptec.cpp index 627a8a2ea0..787006e6bf 100644 --- a/drivers/filter_wheel/ifwoptec.cpp +++ b/drivers/filter_wheel/ifwoptec.cpp @@ -418,7 +418,7 @@ bool FilterIFW::ISNewSwitch(const char *dev, const char *name, ISState *states, ************************************************************************************/ void FilterIFW::simulationTriggered(bool enable) { - // toogle buttons to select 5 or 8 filters depend if Simulation active or not + // toggle buttons to select 5 or 8 filters depend if Simulation active or not if (enable) { if (isConnected()) @@ -738,7 +738,7 @@ bool FilterIFW::SetFilterNames() LOG_INFO("Filters name are saved in IFW"); - // Interface not ready before the message "DATA OK" disapear from the display IFW + // Interface not ready before the message "DATA OK" disappear from the display IFW for (int i = OPTEC_WAIT_DATA_OK; i > 0; i--) { LOGF_INFO("Please wait for HOME command start... %d", i); @@ -943,7 +943,7 @@ bool FilterIFW::GetFirmware() return false; } - // remove chars fomr the string to get only the nzuméric value of the Firmware version + // remove chars from the string to get only the nzuméric value of the Firmware version char *p = nullptr; for (int i = 0; i < (int)strlen(response); i++) diff --git a/drivers/filter_wheel/ifwoptec.h b/drivers/filter_wheel/ifwoptec.h index 6731e2a44a..9889dad121 100644 --- a/drivers/filter_wheel/ifwoptec.h +++ b/drivers/filter_wheel/ifwoptec.h @@ -119,7 +119,7 @@ class FilterIFW : public INDI::FilterWheel ISwitchVectorProperty CharSetSP; ISwitch CharSetS[2]; - // Firmware of teh IFW + // Firmware of the IFW ITextVectorProperty FirmwareTP; IText FirmwareT[1] {}; diff --git a/drivers/filter_wheel/pegasus_indigo.h b/drivers/filter_wheel/pegasus_indigo.h index 052fc1123d..31361035cc 100644 --- a/drivers/filter_wheel/pegasus_indigo.h +++ b/drivers/filter_wheel/pegasus_indigo.h @@ -58,7 +58,7 @@ class PegasusINDIGO : public INDI::FilterWheel * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ diff --git a/drivers/filter_wheel/xagyl_wheel.h b/drivers/filter_wheel/xagyl_wheel.h index dc33786dfa..3c488d01f5 100644 --- a/drivers/filter_wheel/xagyl_wheel.h +++ b/drivers/filter_wheel/xagyl_wheel.h @@ -148,6 +148,6 @@ class XAGYLWheel : public INDI::FilterWheel // Some commands optionally return an extra string. static constexpr const int OPTIONAL_TIMEOUT {1}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const int DRIVER_LEN {64}; }; diff --git a/drivers/focuser/CMakeLists.txt b/drivers/focuser/CMakeLists.txt index 29fc237b50..88f094dc24 100644 --- a/drivers/focuser/CMakeLists.txt +++ b/drivers/focuser/CMakeLists.txt @@ -15,6 +15,16 @@ target_link_libraries(indi_robo_focus indidriver) install(TARGETS indi_robo_focus RUNTIME DESTINATION bin) # ############### Robo Focuser ################ +# ############### iEAF Focuser ################ +SET(ieaffocus_SRC + ieaffocus.cpp) + +add_executable(indi_ieaf_focus ${ieaffocus_SRC}) +target_link_libraries(indi_ieaf_focus indidriver) +install(TARGETS indi_ieaf_focus RUNTIME DESTINATION bin) + + +# ############### iEAF Focuser ################ SET(fcusb_SRC fcusb.cpp) @@ -126,7 +136,7 @@ SET(sesto2_SRC ) add_executable(indi_sestosenso2_focus ${sesto2_SRC}) -target_link_libraries(indi_sestosenso2_focus indidriver) +target_link_libraries(indi_sestosenso2_focus indidriver ${JSONLIB}) install(TARGETS indi_sestosenso2_focus RUNTIME DESTINATION bin) # ############### Esatto Focuser ################ @@ -136,7 +146,7 @@ SET(esatto_SRC ) add_executable(indi_esatto_focus ${esatto_SRC}) -target_link_libraries(indi_esatto_focus indidriver) +target_link_libraries(indi_esatto_focus indidriver ${JSONLIB}) install(TARGETS indi_esatto_focus RUNTIME DESTINATION bin) # ############### Esatto with Arco Focuser ################ @@ -146,7 +156,7 @@ SET(esarc_SRC ) add_executable(indi_esattoarco_focus ${esarc_SRC}) -target_link_libraries(indi_esattoarco_focus indidriver) +target_link_libraries(indi_esattoarco_focus indidriver ${JSONLIB}) install(TARGETS indi_esattoarco_focus RUNTIME DESTINATION bin) # ############### Televue FocusMaster ################ diff --git a/drivers/focuser/aaf2.h b/drivers/focuser/aaf2.h index bb71c6580c..21f0147b68 100644 --- a/drivers/focuser/aaf2.h +++ b/drivers/focuser/aaf2.h @@ -69,8 +69,8 @@ class AAF2 : public INDI::Focuser bool Ack(); /** * @brief sendCommand Send a string command to AAF2. - * @param cmd Command to be sent, must already have the necessary delimeter ('#') - * @param res If not nullptr, the function will read until it detects the default delimeter ('#') up to ML_RES length. + * @param cmd Command to be sent, must already have the necessary delimiter ('#') + * @param res If not nullptr, the function will read until it detects the default delimiter ('#') up to ML_RES length. * if nullptr, no read back is done and the function returns true. * @return True if successful, false otherwise. */ @@ -93,8 +93,8 @@ class AAF2 : public INDI::Focuser // AAF2 Buffer static const uint8_t DRIVER_RES { 32 }; - // AAF2 Delimeter + // AAF2 Delimiter static const char DRIVER_DEL { '#' }; - // AAF2 Tiemout + // AAF2 Timeout static const uint8_t DRIVER_TIMEOUT { 3 }; }; diff --git a/drivers/focuser/celestron.cpp b/drivers/focuser/celestron.cpp index 42a1f14b8f..ba590f0fbe 100644 --- a/drivers/focuser/celestron.cpp +++ b/drivers/focuser/celestron.cpp @@ -93,7 +93,7 @@ bool CelestronSCT::initProperties() FocusRelPosN[0].value = 0; FocusRelPosN[0].step = 1000; - // Absolute Postition Range + // Absolute Position Range FocusAbsPosN[0].min = 0.; FocusAbsPosN[0].max = 60000.; FocusAbsPosN[0].value = 0; @@ -116,7 +116,7 @@ bool CelestronSCT::initProperties() communicator.setDeviceName(getDeviceName()); - // Defualt port to /dev/ttyACM0 + // Default port to /dev/ttyACM0 //serialConnection->setDefaultPort("/dev/ttyACM0"); //LOG_INFO("initProperties end"); diff --git a/drivers/focuser/celestron.h b/drivers/focuser/celestron.h index 837521865f..12956e3ddd 100644 --- a/drivers/focuser/celestron.h +++ b/drivers/focuser/celestron.h @@ -124,8 +124,8 @@ class CelestronSCT : public INDI::Focuser ///////////////////////////////////////////////////////////////////////////// // // Celestron Buffer // static const uint8_t CELESTRON_LEN { 32 }; - // // Celestorn Delimeter + // // Celestorn Delimiter // static const char CELESTRON_DEL { '#' }; - // // Celestron Tiemout in seconds + // // Celestron Timeout in seconds // static const uint8_t CELESTRON_TIMEOUT { 3 }; }; diff --git a/drivers/focuser/esatto.cpp b/drivers/focuser/esatto.cpp index 7d088b259c..4c787656ad 100644 --- a/drivers/focuser/esatto.cpp +++ b/drivers/focuser/esatto.cpp @@ -304,8 +304,10 @@ void Esatto::TimerHit() auto lastPos = FocusAbsPosN[0].value; bool rc = updatePosition(); - if (rc && (std::abs(lastPos - FocusAbsPosN[0].value) > 0)) { - if (FocusAbsPosNP.s == IPS_BUSY && m_Esatto->isBusy() == false) { + if (rc && (std::abs(lastPos - FocusAbsPosN[0].value) > 0)) + { + if (FocusAbsPosNP.s == IPS_BUSY && m_Esatto->isBusy() == false) + { // To prevent reporting a bit too old position as the final one updatePosition(); @@ -319,18 +321,24 @@ void Esatto::TimerHit() if (m_TemperatureCounter++ == TEMPERATURE_FREQUENCY) { - auto lastValue = TemperatureNP[0].value; rc = updateTemperature(); - if (rc && std::abs(lastValue - TemperatureNP[0].value) >= 0.1) + + // Only update temperature if there is a change of 0.1 or more + if (rc && (std::abs(m_LastTemperature[TEMPERATURE_EXTERNAL] - TemperatureNP[TEMPERATURE_EXTERNAL].value) >= MEASUREMENT_THRESHOLD || + std::abs(m_LastTemperature[TEMPERATURE_MOTOR] - TemperatureNP[TEMPERATURE_MOTOR].value) >= MEASUREMENT_THRESHOLD )) + { + m_LastTemperature[TEMPERATURE_EXTERNAL] = TemperatureNP[TEMPERATURE_EXTERNAL].value; + m_LastTemperature[TEMPERATURE_MOTOR] = TemperatureNP[TEMPERATURE_MOTOR].value; TemperatureNP.apply(); + } - auto current12V = VoltageNP[VOLTAGE_12V].getValue(); - auto currentUSB = VoltageNP[VOLTAGE_USB].getValue(); if (updateVoltageIn()) { - if (std::abs(current12V - VoltageNP[VOLTAGE_12V].getValue()) >= 0.1 || - std::abs(currentUSB - VoltageNP[VOLTAGE_USB].getValue()) >= 0.1) + if (std::abs(m_LastVoltage[VOLTAGE_12V] - VoltageNP[VOLTAGE_12V].getValue()) >= MEASUREMENT_THRESHOLD || + std::abs(m_LastVoltage[VOLTAGE_USB] - VoltageNP[VOLTAGE_USB].getValue()) >= MEASUREMENT_THRESHOLD) { + m_LastVoltage[VOLTAGE_12V] = VoltageNP[VOLTAGE_12V].getValue(); + m_LastVoltage[VOLTAGE_USB] = VoltageNP[VOLTAGE_USB].getValue(); VoltageNP.apply(); if (VoltageNP[VOLTAGE_12V].getValue() < 11.0) LOG_WARN("Please check 12v DC power supply is connected."); diff --git a/drivers/focuser/esatto.h b/drivers/focuser/esatto.h index 6cdb379576..ce08a2529b 100644 --- a/drivers/focuser/esatto.h +++ b/drivers/focuser/esatto.h @@ -59,6 +59,8 @@ class Esatto : public INDI::Focuser void hexDump(char * buf, const char * data, int size); uint16_t m_TemperatureCounter { 0 }; + double m_LastTemperature[2] = {-1, -1}; + double m_LastVoltage[2] = {-1, -1}; INDI::PropertyNumber TemperatureNP {2}; enum @@ -91,4 +93,5 @@ class Esatto : public INDI::Focuser std::unique_ptr m_Esatto; static constexpr uint8_t TEMPERATURE_FREQUENCY {10}; + static constexpr double MEASUREMENT_THRESHOLD {0.1}; }; diff --git a/drivers/focuser/esattoarco.cpp b/drivers/focuser/esattoarco.cpp index 30ab73e4c9..9b6bd1c30f 100644 --- a/drivers/focuser/esattoarco.cpp +++ b/drivers/focuser/esattoarco.cpp @@ -25,7 +25,12 @@ #include "esattoarco.h" #include "indicom.h" -#include "json.h" + +#ifdef _USE_SYSTEM_JSONLIB +#include +#else +#include +#endif #include #include diff --git a/drivers/focuser/focuslynx.cpp b/drivers/focuser/focuslynx.cpp index 5612beb4ca..e4530a7e47 100644 --- a/drivers/focuser/focuslynx.cpp +++ b/drivers/focuser/focuslynx.cpp @@ -120,7 +120,7 @@ const char *FocusLynxF1::getDefaultName() * * ***********************************************************************************/ bool FocusLynxF1::Connect() -/* Overide of connect() function +/* Override of connect() function * different for F1 or F2 focuser * F1 connect only himself to the driver and * it is the only one who's connect to the communication port to establish the physical communication @@ -304,7 +304,7 @@ bool FocusLynxF1::getHubConfig() IUSaveText(&HubT[0], text); IDSetText(&HubTP, nullptr); - //Save localy the Version of the firmware's Hub + //Save locally the Version of the firmware's Hub strncpy(version, text, sizeof(version)); LOGF_DEBUG("Text = %s, Key = %s", text, key); @@ -550,7 +550,7 @@ bool FocusLynxF1::getHubConfig() memset(response, 0, sizeof(response)); memset(text, 0, sizeof(text)); - // WIFI IP adress + // WIFI IP address if (isSimulation()) { strncpy(response, "WF IP = 192.168.1.11\n", 32); @@ -691,7 +691,7 @@ bool FocusLynxF1::getHubConfig() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES <%s>", response); if (strcmp(response, "END")) @@ -791,7 +791,7 @@ const char *FocusLynxF2::getDefaultName() * * ***********************************************************************************/ bool FocusLynxF2::Connect() -/* Overide of connect() function +/* Override of connect() function * different for F2 or F1 focuser * F2 don't connect himself to the hub */ @@ -846,7 +846,7 @@ bool FocusLynxF2::RemoteDisconnect() updateProperties(); } - // When called by F1, the PortFD should be -1; For debbug purpose + // When called by F1, the PortFD should be -1; For debug purposes PortFD = lynxDriveF1->getPortFD(); LOGF_INFO("Remote disconnection: %s is offline.", getDeviceName()); LOGF_INFO("Value of F2 PortFD = %d", PortFD); diff --git a/drivers/focuser/focuslynxbase.cpp b/drivers/focuser/focuslynxbase.cpp index 16c8168cf7..72ffe9b121 100644 --- a/drivers/focuser/focuslynxbase.cpp +++ b/drivers/focuser/focuslynxbase.cpp @@ -38,7 +38,7 @@ FocusLynxBase::FocusLynxBase() lynxModels["Optec TCF-Lynx 3"] = "OB"; // "OC" is now reserved, it is hard coded into focusers that use it - // Allthough it can be selected it should not be + // Although it can be selected it should not be // lynxModels["Optec TCF-Lynx 2 with Extended Travel"] = "OC"; lynxModels["Optec Fast Focus Secondary Focuser"] = "OD"; @@ -324,7 +324,7 @@ bool FocusLynxBase::Handshake() * ***********************************************************************************/ const char *FocusLynxBase::getDefaultName() { - // Has to be overide by child instance + // Has to be overridden by child instance return "FocusLynxBase"; } @@ -874,7 +874,7 @@ bool FocusLynxBase::getFocusConfig() defineProperty(&GotoSP); // If not 'No Focuser' then do iterator - // iterate throught all elements in std::map and search the index from the code. + // iterate through all elements in std::map and search the index from the code. std::map::iterator it = lynxModels.begin(); while(it != lynxModels.end()) { @@ -1007,7 +1007,7 @@ bool FocusLynxBase::getFocusConfig() FocusBacklashNP.s = IPS_OK; IDSetNumber(&FocusBacklashNP, nullptr); - // Led brightnesss + // Led brightness memset(response, 0, sizeof(response)); if (isSimulation()) { @@ -1082,7 +1082,7 @@ bool FocusLynxBase::getFocusConfig() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES (%s)", response); if (strcmp(response, "END")) @@ -1461,7 +1461,7 @@ bool FocusLynxBase::getFocusStatus() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES (%s)", response); if (strcmp(response, "END")) return false; @@ -1949,7 +1949,7 @@ bool FocusLynxBase::getFocusTemp() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES (%s)", response); if (strcmp(response, "END")) return false; diff --git a/drivers/focuser/ieaffocus.cpp b/drivers/focuser/ieaffocus.cpp new file mode 100644 index 0000000000..4a37ea83e1 --- /dev/null +++ b/drivers/focuser/ieaffocus.cpp @@ -0,0 +1,710 @@ +/* + IOPTRON iEAF Focuser 2023 + Copyright (C) 2018 Paul de Backer (74.0632@gmail.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 + +*/ + +#include "ieaffocus.h" +#include "indicom.h" + +#include +#include +#include +#include +#include +#include +#include + +#define iEAFFOCUS_TIMEOUT 4 + +#define POLLMS_OVERRIDE 1500 + +std::unique_ptr ieafFocus(new iEAFFocus()); + +iEAFFocus::iEAFFocus() +{ + FI::SetCapability(FOCUSER_CAN_ABS_MOVE | FOCUSER_CAN_REL_MOVE | FOCUSER_CAN_ABORT|FOCUSER_CAN_REVERSE); + lastPos = 0; +} + +iEAFFocus::~iEAFFocus() +{ +} + +bool iEAFFocus::initProperties() +{ + INDI::Focuser::initProperties(); + maxpos = 99999; + // SetZero +// IUFillSwitch(&SetZeroS[0], "SETZERO", "Set Current Position to 0", ISS_OFF); +// IUFillSwitchVector(&SetZeroSP, SetZeroS, 1, getDeviceName(), "Zero Position", "", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, +// IPS_IDLE); + SetZeroSP[0].fill("SETZERO", "Set Current Position to 0", ISS_OFF); + SetZeroSP.fill(getDeviceName(),"Zero Position", "", OPTIONS_TAB, IP_RW,ISR_1OFMANY, 0,IPS_IDLE); + + + + // Maximum Travel +// IUFillNumber(&MaxPosN[0], "MAXPOS", "Maximum Out Position", "%5.0f", 1., 99999., 0, 0); +// IUFillNumberVector(&MaxPosNP, MaxPosN, 1, getDeviceName(), "FOCUS_MAXPOS", "Position", OPTIONS_TAB, IP_RW, 0, IPS_IDLE ); + + +// MaxPositionNP[0].fill("MAXPOSITION", "Maximum position", "%5.0f", 1., 99999., 0., 99999.); +// MaxPositionNP.fill(getDeviceName(), "FOCUS_MAXPOSITION", "Max. Position", +// OPTIONS_TAB, IP_RW, 0, IPS_IDLE); + + + /* Focuser temperature */ +// IUFillNumber(&TemperatureN[0], "TEMPERATURE", "Celsius", "%2.2f", 0, 50., 0., 50.); +// IUFillNumberVector(&TemperatureNP, TemperatureN, 1, getDeviceName(), "FOCUS_TEMPERATURE", "Temperature", +// MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE); + + TemperatureNP[0].fill("TEMPERATURE", "Celsius", "%2.2f", 0., 50., 0., 50.); + TemperatureNP.fill(getDeviceName(), "FOCUS_TEMPERATURE", "Temperature", + MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE); + + + + /* Relative and absolute movement */ + FocusRelPosN[0].min = 0.; + FocusRelPosN[0].max = 5000.; + FocusRelPosN[0].value = 0.; + FocusRelPosN[0].step = 10.; + +// FocusAbsPosN[0].min = 0.; +// FocusAbsPosN[0].max = 99999.; +// FocusAbsPosN[0].value = 0.; + FocusAbsPosN[0].step = 10.; + + addDebugControl(); + + return true; + +} + +bool iEAFFocus::updateProperties() +{ + INDI::Focuser::updateProperties(); + if (isConnected()) + { + defineProperty(TemperatureNP); + // defineProperty(&MaxPosNP); +// defineProperty(MaxPositionNP); + defineProperty(SetZeroSP); + GetFocusParams(); +// loadConfig(true); + + DEBUG(INDI::Logger::DBG_SESSION, "iEAF Focus parameters updated, focuser ready for use."); + } + else + { + deleteProperty(TemperatureNP); + //deleteProperty(MaxPosNP.name); +// deleteProperty(MaxPositionNP); + deleteProperty(SetZeroSP); + } + + return true; + +} + +bool iEAFFocus::Handshake() +{ + if (Ack()) + { + DEBUG(INDI::Logger::DBG_SESSION, "iEAFFocus is online. Getting focus parameters..."); + return true; + } + return false; +} + +const char * iEAFFocus::getDefaultName() +{ + return "iEAFFocus"; +} + +bool iEAFFocus::Ack() +{ + int nbytes_written = 0, nbytes_read = 0, rc = -1; +// char errstr[MAXRBUF]; + char resp[16]; + int ieafpos,ieafmodel,ieaflast; + sleep(2); + tcflush(PortFD, TCIOFLUSH); + if ( (rc = tty_write(PortFD, ":DeviceInfo#",12, &nbytes_written)) != TTY_OK) + { + char errstr[MAXRBUF] = {0}; + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "Init send getdeviceinfo error: %s.", errstr); + return false; + } + + if ( (rc = tty_read_section(PortFD, resp, '#', iEAFFOCUS_TIMEOUT * 2, &nbytes_read)) != TTY_OK) + { + char errstr[MAXRBUF] = {0}; + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "Init read deviceinfo error: %s.", errstr); + return false; + } + tcflush(PortFD, TCIOFLUSH); + resp[nbytes_read] = '\0'; + sscanf(resp,"%6d%2d%4d",&ieafpos,&ieafmodel,&ieaflast); + if (ieafmodel==2) + { + return true; + } + else + { + DEBUGF(INDI::Logger::DBG_ERROR, "Ack Response: %s", resp); + return false; + } + + + return true; +} + +bool iEAFFocus::readReverseDirection() +{ + + int nbytes_written = 0, nbytes_read = 0, rc = -1; + char errstr[MAXRBUF]; + char resp[16]; + char joedeviceinfo[12]; + + int ieafpos,ieafmove,ieaftemp,ieafdir; +// float current_ieaf_temp; + sleep(2); + + tcflush(PortFD, TCIOFLUSH); + if ( (rc = tty_write(PortFD, ":FI#", 4, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "readReverseDirection error: %s.", errstr); + } + if ( (rc = tty_read_section(PortFD, resp, '#', iEAFFOCUS_TIMEOUT, &nbytes_read)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "readReverseDirection error: %s.", errstr); + return false; + } + + tcflush(PortFD, TCIOFLUSH); + + resp[nbytes_read] = '\0'; + + + sscanf(resp,"%14s",joedeviceinfo); + rc=sscanf(resp,"%7d%1d%5d%1d",&ieafpos,&ieafmove,&ieaftemp,&ieafdir); + FocusReverseS[INDI_DISABLED].s = ISS_ON; + if(ieafdir == 0) + { + FocusReverseS[INDI_DISABLED].s = ISS_ON; + } + else if (ieafdir == 1) + { + FocusReverseS[INDI_ENABLED].s = ISS_ON; + } + else + { + DEBUGF(INDI::Logger::DBG_ERROR,"Invalid Response: focuser Reverse direction value (%s)", resp); + return false; + } + + + return true; +} + + +bool iEAFFocus::updateTemperature() +{ + int nbytes_written = 0, nbytes_read = 0, rc = -1; + char errstr[MAXRBUF]; + char resp[16]; + char joedeviceinfo[12]; + + int ieafpos,ieafmove,ieaftemp,ieafdir; + float current_ieaf_temp; + sleep(2); + + tcflush(PortFD, TCIOFLUSH); + if ( (rc = tty_write(PortFD, ":FI#", 4, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "updateTemperature error: %s.", errstr); + return false; + } + if ( (rc = tty_read_section(PortFD, resp, '#', iEAFFOCUS_TIMEOUT, &nbytes_read)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "updateTemperature error: %s.", errstr); + return false; + } + + tcflush(PortFD, TCIOFLUSH); + + resp[nbytes_read] = '\0'; + + + sscanf(resp,"%14s",joedeviceinfo); + rc=sscanf(resp,"%7d%1d%5d%1d",&ieafpos,&ieafmove,&ieaftemp,&ieafdir); + current_ieaf_temp=ieaftemp/100.0-273.15; + if (rc > 0) + { +// TemperatureN[0].value = current_ieaf_temp; +// IDSetNumber(&TemperatureNP, NULL); + + TemperatureNP[0].setValue(current_ieaf_temp); + + + } + else + { + DEBUGF(INDI::Logger::DBG_ERROR, "Unknown error: focuser Temperature value (%s)", resp); + return false; + } + + return true; + + + +} + +bool iEAFFocus::updatePosition() +{ + int nbytes_written = 0, nbytes_read = 0, rc = -1; + char errstr[MAXRBUF]; + char resp[16]; + char joedeviceinfo[12]; + + int ieafpos,ieafmove,ieaftemp,ieafdir; + float current_ieaf_temp; + sleep(2); + + tcflush(PortFD, TCIOFLUSH); + if ( (rc = tty_write(PortFD, ":FI#", 4, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "updatePosition error: %s.", errstr); + return false; + } + + + if ( (rc = tty_read_section(PortFD, resp, '#', iEAFFOCUS_TIMEOUT, &nbytes_read)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "updatePosition error: %s.", errstr); + return false; + } + + tcflush(PortFD, TCIOFLUSH); + + resp[nbytes_read] = '\0'; + + + sscanf(resp,"%14s",joedeviceinfo); + rc=sscanf(resp,"%7d%1d%5d%1d",&ieafpos,&ieafmove,&ieaftemp,&ieafdir); + current_ieaf_temp=ieaftemp/100.0-273.15; + + if (rc > 0) + { + FocusAbsPosN[0].value = ieafpos; + IDSetNumber(&FocusAbsPosNP, NULL); +// TemperatureN[0].value = current_ieaf_temp; +// IDSetNumber(&TemperatureNP, NULL); + TemperatureNP[0].setValue(current_ieaf_temp); + + + } + else + { + DEBUGF(INDI::Logger::DBG_ERROR, "Unknown error: focuser position value (%s)", resp); + return false; + } + + return true; + + +} + +bool iEAFFocus::updateMaxPos() +{ + +// MaxPosN[0].value = 99999; +// FocusAbsPosN[0].max = 99999; +// IDSetNumber(&FocusAbsPosNP, NULL); +// IDSetNumber(&MaxPosNP, NULL); + + MaxPositionNP[0].setValue(maxpos); + FocusAbsPosN[0].max = maxpos; + + return true; +} + + + +bool iEAFFocus::isMoving() +{ + int nbytes_written = 0, nbytes_read = 0, rc = -1; + char errstr[MAXRBUF]; + char resp[16]; + int ieafpos,ieafmove,ieaftemp,ieafdir; + + tcflush(PortFD, TCIOFLUSH); + + if ( (rc = tty_write(PortFD, ":FI#", 4, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "isMoving error: %s.", errstr); + return false; + } + + if ( (rc = tty_read_section(PortFD, resp, '#', iEAFFOCUS_TIMEOUT, &nbytes_read)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "isMoving error: %s.", errstr); + return false; + } + + tcflush(PortFD, TCIOFLUSH); + + resp[nbytes_read] = '\0'; + rc=sscanf(resp,"%7d%d%5d%d",&ieafpos,&ieafmove,&ieaftemp,&ieafdir); + + if (rc > 0) + { + if (ieafmove==1) + { + return true; + } + else + { + return false; + } + } + else + { + DEBUGF(INDI::Logger::DBG_ERROR, "Unknown error: focuser moving value (%s)", resp); + return false; + } + + + +} + +bool iEAFFocus::MoveMyFocuser(uint32_t position) +{ + int nbytes_written = 0, rc = -1; + char errstr[MAXRBUF]; + char cmd[12]; + + snprintf(cmd, 12, ":FM%7d#", position); + + // Set Position + if ( (rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "setPosition error: %s.", errstr); + return false; + } + return true; +} + + +bool iEAFFocus::ReverseFocuser(bool enabled) +{ + int nbytes_written = 0, rc = -1; + char errstr[MAXRBUF]; + // char cmd[12]; + if (enabled) + { + ; + } + + // Change Direction + if ( (rc = tty_write(PortFD, ":FR#", 4, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "change Direction error: %s.", errstr); + return false; + } + +/* + if (enabled) + { + FocusReverseS[INDI_ENABLED].s = ISS_ON; + FocusReverseS[INDI_DISABLED].s = ISS_OFF; + } + else + { + FocusReverseS[INDI_ENABLED].s = ISS_OFF; + FocusReverseS[INDI_DISABLED].s = ISS_ON; + + } +*/ + +/* + if (FocusReverseS[INDI_DISABLED].s == ISS_ON) + { + FocusReverseS[INDI_ENABLED].s = ISS_ON; + } + else + { + FocusReverseS[INDI_DISABLED].s = ISS_ON; + } +*/ + + return true; +} + + + +void iEAFFocus::setZero() +{ + int nbytes_written = 0, rc = -1; + char errstr[MAXRBUF]; + // Set Zero + if ( (rc = tty_write(PortFD, ":FZ#", 4, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "set Zero error: %s.", errstr); + return; + } + updateMaxPos(); + return; +} + +bool iEAFFocus::setMaxPos(unsigned int maxp) +{ +// uint32_t maxp=maxPos; +// maxp=maxp+0; +// updateMaxPos(); + maxpos = maxp; + FocusAbsPosN[0].max = maxpos; + return true; +} + +bool iEAFFocus::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) +{ +/* + if(strcmp(dev, getDeviceName()) == 0) + { + if (!strcmp(SetZeroSP.name, name)) + { + setZero(); + IUResetSwitch(&SetZeroSP); + SetZeroSP.s = IPS_OK; + IDSetSwitch(&SetZeroSP, NULL); + return true; + } + + return INDI::Focuser::ISNewSwitch(dev, name, states, names, n); + } + return false; +*/ + + if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) + { + if (SetZeroSP.isNameMatch(name)) + { + setZero(); + SetZeroSP.setState(IPS_OK); + SetZeroSP.apply(); + return true; + } + + } + + return INDI::Focuser::ISNewSwitch(dev, name, states, names, n); + + + +} + +bool iEAFFocus::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) +{ +/* + if(strcmp(dev, getDeviceName()) == 0) + { + if (!strcmp (name, MaxPosNP.name)) + { + if (values[0] < FocusAbsPosN[0].value) + { + DEBUGF(INDI::Logger::DBG_ERROR, "Can't set max position lower than current absolute position ( %6.0f )", + FocusAbsPosN[0].value); + return false; + } + IUUpdateNumber(&MaxPosNP, values, names, n); + FocusAbsPosN[0].max = MaxPosN[0].value; + setMaxPos(MaxPosN[0].value); + MaxPosNP.s = IPS_OK; + return true; + } + } + + return INDI::Focuser::ISNewNumber(dev, name, values, names, n); +*/ + if (!dev || strcmp(dev, getDeviceName())) + return false; + + if (MaxPositionNP.isNameMatch(name)) + { + MaxPositionNP.update(values, names, n); + + if (!setMaxPos(MaxPositionNP[0].getValue())) + { + MaxPositionNP.setState(IPS_ALERT); + MaxPositionNP.apply(); + return false; + } + MaxPositionNP.setState(IPS_OK); + MaxPositionNP.apply(); + return true; + } + + return INDI::Focuser::ISNewNumber(dev, name, values, names, n); + + + + +} + +void iEAFFocus::GetFocusParams () +{ + if (updateTemperature()) + TemperatureNP.apply(); + + if (updateMaxPos()) + { + MaxPositionNP.apply(); + IDSetNumber(&FocusAbsPosNP, nullptr); + } + + + readReverseDirection(); +// updatePosition(); + + + if (updatePosition()) + IDSetNumber(&FocusAbsPosNP, nullptr); + +} + + +IPState iEAFFocus::MoveAbsFocuser(uint32_t targetTicks) +{ + uint32_t targetPos = targetTicks; + + bool rc = false; + + rc = MoveMyFocuser(targetPos); + + if (rc == false) + return IPS_ALERT; + + FocusAbsPosNP.s = IPS_BUSY; + + return IPS_BUSY; +} + +IPState iEAFFocus::MoveRelFocuser(FocusDirection dir, uint32_t ticks) +{ + uint32_t newPosition = 0; + bool rc = false; + + if (dir == FOCUS_INWARD) + newPosition = uint32_t(FocusAbsPosN[0].value) - ticks; + else + newPosition = uint32_t(FocusAbsPosN[0].value) + ticks; + + rc = MoveMyFocuser(newPosition); + + if (rc == false) + return IPS_ALERT; + + FocusRelPosN[0].value = ticks; + FocusRelPosNP.s = IPS_BUSY; + + return IPS_BUSY; +} + +void iEAFFocus::TimerHit() +{ + if (isConnected() == false) + { + SetTimer(POLLMS_OVERRIDE); + return; + } + + bool rc = updatePosition(); + if (rc) + { + if (fabs(lastPos - FocusAbsPosN[0].value) > 5) + { + IDSetNumber(&FocusAbsPosNP, NULL); + lastPos = FocusAbsPosN[0].value; + } + } + + + if (FocusAbsPosNP.s == IPS_BUSY || FocusRelPosNP.s == IPS_BUSY) + { + if (isMoving() == false) + { + FocusAbsPosNP.s = IPS_OK; + FocusRelPosNP.s = IPS_OK; + IDSetNumber(&FocusAbsPosNP, NULL); + IDSetNumber(&FocusRelPosNP, NULL); + lastPos = FocusAbsPosN[0].value; + DEBUG(INDI::Logger::DBG_SESSION, "Focuser reached requested position."); + } + } + SetTimer(POLLMS_OVERRIDE); + +} + +bool iEAFFocus::AbortFocuser() +{ + int nbytes_written; + if (tty_write(PortFD, ":FQ#", 4, &nbytes_written) == TTY_OK) + { + FocusAbsPosNP.s = IPS_IDLE; + FocusRelPosNP.s = IPS_IDLE; + IDSetNumber(&FocusAbsPosNP, NULL); + IDSetNumber(&FocusRelPosNP, NULL); + return true; + } + else + return false; +} + + +//bool iEAFFocus::saveConfigItems(FILE * fp) +//{ +// Focuser::saveConfigItems(fp); +/* + IUSaveConfigNumber(fp, &TemperatureSettingNP); + IUSaveConfigSwitch(fp, &TemperatureCompensateSP); + IUSaveConfigSwitch(fp, &BacklashInSP); + IUSaveConfigNumber(fp, &BacklashInStepsNP); + IUSaveConfigSwitch(fp, &BacklashOutSP); + IUSaveConfigNumber(fp, &BacklashOutStepsNP); + IUSaveConfigSwitch(fp, &StepModeSP); + IUSaveConfigSwitch(fp, &DisplaySP); +*/ + //IUSaveConfigSwitch(fp, &DisplaySP); +// return true; +//} diff --git a/drivers/focuser/ieaffocus.h b/drivers/focuser/ieaffocus.h new file mode 100644 index 0000000000..211423754f --- /dev/null +++ b/drivers/focuser/ieaffocus.h @@ -0,0 +1,77 @@ +/* + IOPTRON iEAF Focuser 2023 + Copyright (C) 2018 Paul de Backer (74.0632@gmail.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 + +*/ + +#ifndef IEAFFOCUS_H +#define IEAFFOCUS_H + +#include "indifocuser.h" + +class iEAFFocus : public INDI::Focuser +{ + public: + iEAFFocus(); + ~iEAFFocus(); + + virtual bool Handshake() override; + const char * getDefaultName() override; + 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 IPState MoveAbsFocuser(uint32_t ticks) override; + virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override; + virtual bool AbortFocuser() override; + virtual void TimerHit() override; +// virtual bool saveConfigItems(FILE * fp) override; + virtual bool ReverseFocuser(bool enabled) override; + + private: + unsigned int maxpos{ 0 }; + double lastPos; + + void GetFocusParams(); + void setZero(); + bool updateMaxPos(); + bool updateTemperature(); + bool updatePosition(); + bool isMoving(); + bool Ack(); + + bool MoveMyFocuser(uint32_t position); + bool setMaxPos(uint32_t maxPos); + bool readReverseDirection(); + + +// INumber MaxPosN[1]; +// INumberVectorProperty MaxPosNP; +// ISwitch SetZeroS[1]; +// ISwitchVectorProperty SetZeroSP; + +// INumber TemperatureN[1]; +// INumberVectorProperty TemperatureNP; + + + INDI::PropertyNumber TemperatureNP{1}; + INDI::PropertyNumber MaxPositionNP{1}; + INDI::PropertySwitch SetZeroSP{1}; + + +}; + +#endif // IEAFFOCUS_H diff --git a/drivers/focuser/lacerta_mfoc.cpp b/drivers/focuser/lacerta_mfoc.cpp index b7f188c6b8..0133c3dd73 100644 --- a/drivers/focuser/lacerta_mfoc.cpp +++ b/drivers/focuser/lacerta_mfoc.cpp @@ -446,7 +446,7 @@ IPState lacerta_mfoc::MoveRelFocuser(FocusDirection dir, uint32_t ticks) return MoveAbsFocuser(targetTicks); } - //Waiting makes no sense - will be immediatly interrupted by the ekos system... + //Waiting makes no sense - will be immediately interrupted by the ekos system... //int ticks = std::abs((int)(targetTicks - pos) * FOCUS_MOTION_DELAY); //LOGF_INFO("sleep for %d ms", ticks); //usleep(ticks + 5000); diff --git a/drivers/focuser/lakeside.cpp b/drivers/focuser/lakeside.cpp index eef0d2938f..61ea914866 100644 --- a/drivers/focuser/lakeside.cpp +++ b/drivers/focuser/lakeside.cpp @@ -431,7 +431,7 @@ bool Lakeside::updateMoveDirection() // K : Temperature in Kelvin update found - TemperatureKN[0].value // D : DONE# received // O : OK# received -// E : Error due to unknown/misformed command having been sent +// E : Error due to unknown/malformed command having been sent // ? : unknown response received char Lakeside::DecodeBuffer(char * in_response) { @@ -451,7 +451,7 @@ char Lakeside::DecodeBuffer(char * in_response) return 'O'; } - // if focuser returns an error for unknow command + // if focuser returns an error for unknown command if (!strncmp(in_response, "!#", 2)) { return 'E'; diff --git a/drivers/focuser/moonlite.h b/drivers/focuser/moonlite.h index 39695203c3..47b4cc8e42 100644 --- a/drivers/focuser/moonlite.h +++ b/drivers/focuser/moonlite.h @@ -87,8 +87,8 @@ class MoonLite : public INDI::Focuser bool Ack(); /** * @brief sendCommand Send a string command to MoonLite. - * @param cmd Command to be sent, must already have the necessary delimeter ('#') - * @param res If not nullptr, the function will read until it detects the default delimeter ('#') up to ML_RES length. + * @param cmd Command to be sent, must already have the necessary delimiter ('#') + * @param res If not nullptr, the function will read until it detects the default delimiter ('#') up to ML_RES length. * if nullptr, no read back is done and the function returns true. * @param silent if true, do not print any error messages. * @param nret if > 0 read nret chars, otherwise read to the terminator @@ -139,8 +139,8 @@ class MoonLite : public INDI::Focuser // MoonLite Buffer static const uint8_t ML_RES { 32 }; - // MoonLite Delimeter + // MoonLite Delimiter static const char ML_DEL { '#' }; - // MoonLite Tiemout + // MoonLite Timeout static const uint8_t ML_TIMEOUT { 3 }; }; diff --git a/drivers/focuser/myfocuserpro2.cpp b/drivers/focuser/myfocuserpro2.cpp index 388e9d2b8c..42897aa291 100644 --- a/drivers/focuser/myfocuserpro2.cpp +++ b/drivers/focuser/myfocuserpro2.cpp @@ -277,7 +277,7 @@ bool MyFocuserPro2::Ack() if (rc > 0) { - // remove check for firmare => 291, assume user is not using older firmware + // remove check for firmware => 291, assume user is not using older firmware LOGF_INFO("MyFP2 reported firmware %d", firmWareVersion); LOG_INFO("Connection to focuser is successful."); return true; @@ -1292,7 +1292,7 @@ IPState MyFocuserPro2::MoveRelFocuser(FocusDirection dir, uint32_t ticks) return IPS_BUSY; } -// this is occuring every 500ms +// this is occurring every 500ms void MyFocuserPro2::TimerHit() { if (!isConnected()) diff --git a/drivers/focuser/myfocuserpro2.h b/drivers/focuser/myfocuserpro2.h index e4dbafe18b..a943f27351 100644 --- a/drivers/focuser/myfocuserpro2.h +++ b/drivers/focuser/myfocuserpro2.h @@ -119,8 +119,8 @@ class MyFocuserPro2 : public INDI::Focuser bool Ack(); /** * @brief sendCommand Send a string command to MyFocuserPro2. - * @param cmd Command to be sent, must already have the necessary delimeter ('#') - * @param res If not nullptr, the function will read until it detects the default delimeter ('#') up to ML_RES length. + * @param cmd Command to be sent, must already have the necessary delimiter ('#') + * @param res If not nullptr, the function will read until it detects the default delimiter ('#') up to ML_RES length. * if nullptr, no read back is done and the function returns true. * @return True if successful, false otherwise. */ @@ -249,7 +249,7 @@ class MyFocuserPro2 : public INDI::Focuser // MyFocuserPro2 Buffer static const uint8_t ML_RES { 32 }; - // MyFocuserPro2 Delimeter + // MyFocuserPro2 Delimiter static const char ML_DEL { '#' }; // mutex controls access to serial port diff --git a/drivers/focuser/nfocus.h b/drivers/focuser/nfocus.h index ee1f61520f..71502837b1 100644 --- a/drivers/focuser/nfocus.h +++ b/drivers/focuser/nfocus.h @@ -104,6 +104,6 @@ class NFocus : public INDI::Focuser static constexpr const uint8_t NFOCUS_TEMPERATURE_FREQ {10}; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t NFOCUS_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t NFOCUS_LEN {64}; }; diff --git a/drivers/focuser/nstep.h b/drivers/focuser/nstep.h index f8455e91b8..5296e361e1 100644 --- a/drivers/focuser/nstep.h +++ b/drivers/focuser/nstep.h @@ -149,6 +149,6 @@ class NStep : public INDI::Focuser static constexpr const uint8_t NSTEP_TEMPERATURE_FREQ {10}; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t NSTEP_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t NSTEP_LEN {64}; }; diff --git a/drivers/focuser/planewave_efa.cpp b/drivers/focuser/planewave_efa.cpp index e2dd1ec76f..4afbdc52a7 100644 --- a/drivers/focuser/planewave_efa.cpp +++ b/drivers/focuser/planewave_efa.cpp @@ -765,7 +765,7 @@ bool EFA::sendCommand(const uint8_t * cmd, uint8_t *res, uint32_t cmd_len, uint3 } else if (efaDump(hexbuf, hexbuflen, cmd, cmd_len) != NULL) { - // expected there to always be an echo, so note this occurence + // expected there to always be an echo, so note this occurrence LOGF_DEBUG("no echo for command packet: %s", hexbuf); } diff --git a/drivers/focuser/planewave_efa.h b/drivers/focuser/planewave_efa.h index 23cbe3d66d..05a6e60805 100644 --- a/drivers/focuser/planewave_efa.h +++ b/drivers/focuser/planewave_efa.h @@ -125,7 +125,7 @@ class EFA : public INDI::Focuser /// Properties /////////////////////////////////////////////////////////////////////////////////// - // Focuser Informatin + // Focuser Information ITextVectorProperty InfoTP; IText InfoT[1] {}; enum diff --git a/drivers/focuser/primalucacommandset.h b/drivers/focuser/primalucacommandset.h index f736458c19..315a7e690a 100644 --- a/drivers/focuser/primalucacommandset.h +++ b/drivers/focuser/primalucacommandset.h @@ -25,7 +25,12 @@ #pragma once #include -#include "json.h" + +#ifdef _USE_SYSTEM_JSONLIB +#include +#else +#include +#endif using json = nlohmann::json; @@ -60,7 +65,7 @@ typedef enum } Units; /***************************************************************************************** - * Communicaton class handle the serial communication with SestoSenso2/Esatto/Arco + * Communication class handle the serial communication with SestoSenso2/Esatto/Arco * models according to the USB Protocol specifications document in JSON. ******************************************************************************************/ class Communication @@ -77,9 +82,9 @@ class Communication bool sendRequest(const json &command, json *response = nullptr); template bool genericRequest(const std::string &node, const std::string &type, const json &command, T *response = nullptr); /** - * @brief Get paramter from device. + * @brief Get parameter from device. * @param type motor type, if MOT_NONE, then it's a generic device-wide get. - * @param paramter paramter name (e.g.SN) + * @param parameter parameter name (e.g.SN) * @param value where to store the queried value. * @return True if successful, false otherwise. * @example {"req":{"get":{"SN":""}}} --> {"res":{"get":{"SN":" ESATTO30001"}} @@ -118,7 +123,7 @@ class Communication std::string m_DeviceName; int m_PortFD {-1}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const int DRIVER_LEN {4096}; static const char DRIVER_STOP_CHAR { 0xD }; static const char DRIVER_TIMEOUT { 5 }; diff --git a/drivers/focuser/rainbowRSF.h b/drivers/focuser/rainbowRSF.h index 5715707d5b..6e0c593469 100644 --- a/drivers/focuser/rainbowRSF.h +++ b/drivers/focuser/rainbowRSF.h @@ -91,6 +91,6 @@ class RainbowRSF : public INDI::Focuser static constexpr const uint8_t DRIVER_TEMPERATURE_FREQ {10}; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {16}; }; diff --git a/drivers/focuser/rbfocus.h b/drivers/focuser/rbfocus.h index dbbc1bfe75..a382b76d15 100644 --- a/drivers/focuser/rbfocus.h +++ b/drivers/focuser/rbfocus.h @@ -53,8 +53,8 @@ class RBFOCUS : public INDI::Focuser bool Ack(); /** * @brief sendCommand Send a string command to RBFocus. - * @param cmd Command to be sent, must already have the necessary delimeter ('#') - * @param res If not nullptr, the function will read until it detects the default delimeter ('#') up to ML_RES length. + * @param cmd Command to be sent, must already have the necessary delimiter ('#') + * @param res If not nullptr, the function will read until it detects the default delimiter ('#') up to ML_RES length. * if nullptr, no read back is done and the function returns true. * @return True if successful, false otherwise. */ diff --git a/drivers/focuser/robofocus.cpp b/drivers/focuser/robofocus.cpp index 221d80ad1d..21d1500eaa 100644 --- a/drivers/focuser/robofocus.cpp +++ b/drivers/focuser/robofocus.cpp @@ -78,7 +78,7 @@ bool RoboFocus::initProperties() IUFillSwitch(&PowerSwitchesS[1], "2", "Switch 2", ISS_OFF); IUFillSwitch(&PowerSwitchesS[2], "3", "Switch 3", ISS_OFF); IUFillSwitch(&PowerSwitchesS[3], "4", "Switch 4", ISS_ON); - IUFillSwitchVector(&PowerSwitchesSP, PowerSwitchesS, 4, getDeviceName(), "SWTICHES", "Power", SETTINGS_TAB, IP_RW, + IUFillSwitchVector(&PowerSwitchesSP, PowerSwitchesS, 4, getDeviceName(), "SWITCHES", "Power", SETTINGS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); /* Robofocus should stay within these limits */ diff --git a/drivers/focuser/sestosenso.cpp b/drivers/focuser/sestosenso.cpp index c1cd454356..a28c545465 100644 --- a/drivers/focuser/sestosenso.cpp +++ b/drivers/focuser/sestosenso.cpp @@ -27,7 +27,7 @@ #SC;HOLD;RUN;ACC;DEC! Shell_set_current_supply in HOLD, RUN, ACC, DEC situations (Value must be from 0 to 24, maximum hold value 10) #QM! Query max value #Qm! Query min value - #QT! Qeury temperature + #QT! Query temperature #QF! Query firmware version #QN! Read the device name -> reply QN;SESTOSENSO! #QP! Query_position diff --git a/drivers/focuser/sestosenso.h b/drivers/focuser/sestosenso.h index 024730e6be..e96c210add 100644 --- a/drivers/focuser/sestosenso.h +++ b/drivers/focuser/sestosenso.h @@ -107,7 +107,7 @@ class SestoSenso : public INDI::Focuser static constexpr const uint8_t SESTO_TEMPERATURE_FREQ {10}; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t SESTO_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t SESTO_LEN {64}; }; diff --git a/drivers/focuser/sestosenso2.cpp b/drivers/focuser/sestosenso2.cpp index 880b1fb527..56ab52ce0a 100644 --- a/drivers/focuser/sestosenso2.cpp +++ b/drivers/focuser/sestosenso2.cpp @@ -709,7 +709,7 @@ bool SestoSenso2::ISNewSwitch(const char *dev, const char *name, ISState *states LOG_INFO("Motor hold ON. Do NOT attempt to manually adjust the focuser!"); if (MotorCurrentNP[MOTOR_CURR_HOLD].getValue() < 2.0) { - LOGF_WARN("Motor hold current set to %.1f: This may be insufficent to hold focus", + LOGF_WARN("Motor hold current set to %.1f: This may be insufficient to hold focus", MotorCurrentNP[MOTOR_CURR_HOLD].getValue()); } } @@ -985,7 +985,7 @@ void SestoSenso2::TimerHit() } } - // Also use temparature poll rate for tracking input voltage + // Also use temperature poll rate for tracking input voltage rc = updateVoltageIn(); if (rc) { diff --git a/drivers/focuser/sestosenso2.h b/drivers/focuser/sestosenso2.h index b02f7d16cc..f24124d01f 100644 --- a/drivers/focuser/sestosenso2.h +++ b/drivers/focuser/sestosenso2.h @@ -186,7 +186,7 @@ class SestoSenso2 : public INDI::Focuser static constexpr const uint8_t SESTO_TEMPERATURE_FREQ {10}; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t SESTO_TIMEOUT {5}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const int SESTO_LEN {1024}; }; diff --git a/drivers/focuser/si_efs.cpp b/drivers/focuser/si_efs.cpp index 4d4ef33adc..87d0d80dcb 100644 --- a/drivers/focuser/si_efs.cpp +++ b/drivers/focuser/si_efs.cpp @@ -39,6 +39,7 @@ const std::map SIEFS::CommandsMap = {SIEFS::SI_FAST_IN, "Fast In"}, {SIEFS::SI_FAST_OUT, "Fast Out"}, {SIEFS::SI_HALT, "Halt"}, + {SIEFS::SI_MOTOR_POLARITY, "Motor Polarity"}, }; const std::map SIEFS::MotorMap = @@ -51,9 +52,13 @@ const std::map SIEFS::MotorMap = SIEFS::SIEFS() { - setVersion(0, 1); + setVersion(0, 2); - FI::SetCapability(FOCUSER_CAN_ABS_MOVE | FOCUSER_CAN_REL_MOVE | FOCUSER_CAN_ABORT | FOCUSER_CAN_SYNC); + FI::SetCapability(FOCUSER_CAN_ABS_MOVE | + FOCUSER_CAN_REL_MOVE | + FOCUSER_CAN_ABORT | + FOCUSER_CAN_SYNC | + FOCUSER_CAN_REVERSE); setSupportedConnections(CONNECTION_NONE); } @@ -93,6 +98,10 @@ bool SIEFS::Connect() FocusRelPosN[0].min = 0; } + bool reversed = isReversed(); + FocusReverseS[INDI_ENABLED].s = reversed ? ISS_ON : ISS_OFF; + FocusReverseS[INDI_DISABLED].s = reversed ? ISS_OFF : ISS_ON; + FocusReverseSP.s = IPS_OK; SetTimer(getCurrentPollingPeriod()); } @@ -539,3 +548,93 @@ bool SIEFS::SetFocuserMaxPosition(uint32_t ticks) return rc; } + +bool SIEFS::ReverseFocuser(bool enabled) +{ + return setReversed(enabled); +} + +bool SIEFS::setReversed(bool enabled) +{ + int rc = 0; + uint8_t command[2] = {0}; + uint8_t response[2] = {0}; + + command[0] = SI_MOTOR_POLARITY; + command[1] = enabled ? 1 : 0; + + LOGF_DEBUG("CMD <%02X> <%02X>", command[0], command[1]); + + if (isSimulation()) + rc = 1; + else + rc = hid_write(handle, command, 2); + + if (rc < 0) + { + LOGF_ERROR("setReversed: Error writing to device (%s)", hid_error(handle)); + return false; + } + + if (isSimulation()) + { + rc = 2; + response[0] = command[0]; + // Normal + response[1] = 0; + } + else + rc = hid_read_timeout(handle, response, 2, SI_TIMEOUT); + + if (rc < 0) + { + LOGF_ERROR("setReversed: Error reading from device (%s)", hid_error(handle)); + return false; + } + + LOGF_DEBUG("RES <%02X %02X>", response[0], response[1]); + + return true; +} + +bool SIEFS::isReversed() +{ + int rc = 0; + uint8_t command[1] = {0}; + uint8_t response[2] = {0}; + + command[0] = SI_MOTOR_POLARITY; + + LOGF_DEBUG("CMD <%02X>", command[0]); + + if (isSimulation()) + rc = 1; + else + rc = hid_write(handle, command, 1); + + if (rc < 0) + { + LOGF_ERROR("setReversed: Error writing to device (%s)", hid_error(handle)); + return false; + } + + if (isSimulation()) + { + rc = 2; + response[0] = command[0]; + // Normal + response[1] = 0; + } + else + rc = hid_read_timeout(handle, response, 2, SI_TIMEOUT); + + if (rc < 0) + { + LOGF_ERROR("setReversed: Error reading from device (%s)", hid_error(handle)); + return false; + } + + LOGF_DEBUG("RES <%02X %02X>", response[0], response[1]); + + return response[1] != 0; +} diff --git a/drivers/focuser/si_efs.h b/drivers/focuser/si_efs.h index e6a7bbad12..52990d81d7 100644 --- a/drivers/focuser/si_efs.h +++ b/drivers/focuser/si_efs.h @@ -38,7 +38,8 @@ class SIEFS : public INDI::Focuser SI_MAX_POS, SI_FAST_IN = 0x11, SI_FAST_OUT = 0x12, - SI_HALT = 0xFF + SI_HALT = 0xFF, + SI_MOTOR_POLARITY = 0x61 } SI_COMMANDS; @@ -66,6 +67,8 @@ class SIEFS : public INDI::Focuser virtual bool SyncFocuser(uint32_t ticks) override; virtual bool SetFocuserMaxPosition(uint32_t ticks) override; + virtual bool ReverseFocuser(bool enabled) override; + private: /** * @brief setPosition Set Position (Either Absolute or Maximum) @@ -91,6 +94,10 @@ class SIEFS : public INDI::Focuser bool setMaxPosition(uint32_t ticks); bool getMaxPosition(uint32_t *ticks); + // Polarity + bool isReversed(); + bool setReversed(bool enabled); + bool sendCommand(SI_COMMANDS targetCommand); bool getStatus(); diff --git a/drivers/focuser/steeldrive.cpp b/drivers/focuser/steeldrive.cpp index 5c1cdd3e11..56c7ab5415 100644 --- a/drivers/focuser/steeldrive.cpp +++ b/drivers/focuser/steeldrive.cpp @@ -97,7 +97,7 @@ bool SteelDrive::initProperties() IUFillNumberVector(&CustomSettingNP, CustomSettingN, 2, getDeviceName(), "Custom Settings", "", FOCUS_SETTINGS_TAB, IP_RW, 0, IPS_IDLE); - // Focuser Accleration + // Focuser Acceleration IUFillNumber(&AccelerationN[0], "Ramp", "", "%3.0f", 1500., 3000., 100., 2000.); IUFillNumberVector(&AccelerationNP, AccelerationN, 1, getDeviceName(), "FOCUS_ACCELERATION", "Acceleration", FOCUS_SETTINGS_TAB, IP_RW, 0, IPS_IDLE); diff --git a/drivers/focuser/steeldrive2.h b/drivers/focuser/steeldrive2.h index fb1b282942..a0a843dabc 100644 --- a/drivers/focuser/steeldrive2.h +++ b/drivers/focuser/steeldrive2.h @@ -82,7 +82,7 @@ class SteelDriveII : public INDI::Focuser /// Properties /////////////////////////////////////////////////////////////////////////////////// - // Focuser Informatin + // Focuser Information ITextVectorProperty InfoTP; IText InfoT[2] {}; enum @@ -164,6 +164,6 @@ class SteelDriveII : public INDI::Focuser static const char DRIVER_STOP_CHAR { 0x0A }; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {192}; }; diff --git a/drivers/focuser/tcfs.h b/drivers/focuser/tcfs.h index 8f83537458..b9eaf1e97c 100644 --- a/drivers/focuser/tcfs.h +++ b/drivers/focuser/tcfs.h @@ -72,7 +72,7 @@ class TCFS : public INDI::Focuser TCFS(); virtual ~TCFS() = default; - // Standard INDI interface fucntions + // Standard INDI interface functions virtual bool Handshake() override; virtual bool Disconnect() override; const char *getDefaultName() override; diff --git a/drivers/receiver/indi_rtlsdr.cpp b/drivers/receiver/indi_rtlsdr.cpp index ff57814127..9187316422 100644 --- a/drivers/receiver/indi_rtlsdr.cpp +++ b/drivers/receiver/indi_rtlsdr.cpp @@ -209,7 +209,7 @@ bool RTLSDR::initProperties() /******************************************************************************************** ** INDI is asking us to update the properties because there is a change in CONNECTION status -** This fucntion is called whenever the device is connected or disconnected. +** This function is called whenever the device is connected or disconnected. *********************************************************************************************/ bool RTLSDR::updateProperties() { @@ -218,7 +218,7 @@ bool RTLSDR::updateProperties() if (isConnected()) { - // Inital values + // Initial values setupParams(1000000, 1420000000, 10); // Start the timer diff --git a/drivers/receiver/receiver_simulator.cpp b/drivers/receiver/receiver_simulator.cpp index 3858b0635d..2998c6e2db 100644 --- a/drivers/receiver/receiver_simulator.cpp +++ b/drivers/receiver/receiver_simulator.cpp @@ -117,13 +117,13 @@ bool RadioSim::initProperties() /******************************************************************************************** ** INDI is asking us to update the properties because there is a change in CONNECTION status -** This fucntion is called whenever the device is connected or disconnected. +** This function is called whenever the device is connected or disconnected. *********************************************************************************************/ bool RadioSim::updateProperties() { if (isConnected()) { - // Inital values + // Initial values setupParams(1000000, 1420000000, 10000, 10); // Start the timer diff --git a/drivers/rotator/gemini.cpp b/drivers/rotator/gemini.cpp index 54f231afae..a695aaaa50 100644 --- a/drivers/rotator/gemini.cpp +++ b/drivers/rotator/gemini.cpp @@ -338,7 +338,7 @@ bool Gemini::Handshake() * ***********************************************************************************/ const char *Gemini::getDefaultName() { - // Has to be overide by child instance + // Has to be overridden by child instance return "Gemini Focusing Rotator"; } @@ -1229,7 +1229,7 @@ bool Gemini::getFocusConfig() FocuserHomeOnStartSP.s = IPS_OK; IDSetSwitch(&FocuserHomeOnStartSP, nullptr); - // Added By Philippe Besson the 28th of June for 'END' evalution + // Added By Philippe Besson the 28th of June for 'END' evaluation // END is reached memset(response, 0, sizeof(response)); if (isSimulation()) @@ -1248,7 +1248,7 @@ bool Gemini::getFocusConfig() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES (%s)", response); if (strcmp(response, "END")) @@ -1490,7 +1490,7 @@ bool Gemini::getRotatorStatus() RotatorStatusL[STATUS_HOMED].s = isHomed ? IPS_OK : IPS_IDLE; IDSetLight(&RotatorStatusLP, nullptr); - // Added By Philippe Besson the 28th of June for 'END' evalution + // Added By Philippe Besson the 28th of June for 'END' evaluation // END is reached memset(response, 0, sizeof(response)); if (isSimulation()) @@ -1509,7 +1509,7 @@ bool Gemini::getRotatorStatus() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES (%s)", response); if (strcmp(response, "END")) @@ -1801,7 +1801,7 @@ bool Gemini::getRotatorConfig() response[nbytes_read - 1] = '\0'; DEBUGF(DBG_FOCUS, "RES (%s)", response); - // Added By Philippe Besson the 28th of June for 'END' evalution + // Added By Philippe Besson the 28th of June for 'END' evaluation // END is reached memset(response, 0, sizeof(response)); if (isSimulation()) @@ -1820,7 +1820,7 @@ bool Gemini::getRotatorConfig() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES (%s)", response); if (strcmp(response, "END")) @@ -2133,7 +2133,7 @@ bool Gemini::getFocusStatus() FocuserStatusLP.s = IPS_OK; IDSetLight(&FocuserStatusLP, nullptr); - // Added By Philippe Besson the 28th of June for 'END' evalution + // Added By Philippe Besson the 28th of June for 'END' evaluation // END is reached memset(response, 0, sizeof(response)); if (isSimulation()) @@ -2152,7 +2152,7 @@ bool Gemini::getFocusStatus() { response[nbytes_read - 1] = '\0'; - // Display the response to be sure to have read the complet TTY Buffer. + // Display the response to be sure to have read the complete TTY Buffer. LOGF_DEBUG("RES (%s)", response); if (strcmp(response, "END")) diff --git a/drivers/rotator/integra.cpp b/drivers/rotator/integra.cpp index 7d98cdc7ba..c4533a0414 100644 --- a/drivers/rotator/integra.cpp +++ b/drivers/rotator/integra.cpp @@ -948,7 +948,7 @@ bool Integra::genericIntegraCommand(const char *name, const char *cmd, const cha // check begin of result string if (expectStart != nullptr) { - correctRes = strstr(res, expectStart); // the hw sometimes returns /r or /n at the beginning ot the response + correctRes = strstr(res, expectStart); // the hw sometimes returns /r or /n at the beginning of the response if (correctRes == nullptr) { LOGF_ERROR("%s error: invalid response (%s)", name, res); diff --git a/drivers/rotator/nframe.h b/drivers/rotator/nframe.h index 00728dd4c4..b4e9975f8d 100644 --- a/drivers/rotator/nframe.h +++ b/drivers/rotator/nframe.h @@ -120,7 +120,7 @@ class nFrameRotator : public INDI::Rotator 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. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {128}; // Operatives static constexpr const uint8_t DRIVER_OPERATIVES {2}; @@ -173,7 +173,7 @@ class nFrameRotator : public INDI::Rotator static const char NFRAME_STOP_CHAR { 0x23 }; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t NFRAME_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t NFRAME_LEN {64}; diff --git a/drivers/rotator/pegasus_falcon.cpp b/drivers/rotator/pegasus_falcon.cpp index aeab98cfa1..325f90197a 100644 --- a/drivers/rotator/pegasus_falcon.cpp +++ b/drivers/rotator/pegasus_falcon.cpp @@ -173,7 +173,7 @@ bool PegasusFalcon::ISNewSwitch(const char * dev, const char * name, ISState * s } ////////////////////////////////////////////////////////////////////// -/// move to degrees (Commmand "MD:nn.nn"; Response "MD:nn.nn") +/// move to degrees (Command "MD:nn.nn"; Response "MD:nn.nn") ////////////////////////////////////////////////////////////////////// IPState PegasusFalcon::MoveRotator(double angle) { diff --git a/drivers/rotator/pegasus_falcon.h b/drivers/rotator/pegasus_falcon.h index ea5bec97f7..be512b0c54 100644 --- a/drivers/rotator/pegasus_falcon.h +++ b/drivers/rotator/pegasus_falcon.h @@ -76,7 +76,7 @@ class PegasusFalcon : public INDI::Rotator * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ diff --git a/drivers/rotator/pyxis.cpp b/drivers/rotator/pyxis.cpp index 7405aea7fd..ab62d17957 100644 --- a/drivers/rotator/pyxis.cpp +++ b/drivers/rotator/pyxis.cpp @@ -472,7 +472,7 @@ IPState Pyxis::MoveRotator(double angle) if (targetPA > 359) targetPA = 0; - // Rotator will only rotation +-180 degress from home (0 degrees) so it make take + // Rotator will only rotation +-180 degrees from home (0 degrees) so it make take // the long way to avoid cable wrap if (current <= 180 && targetPA < 180) direction = (targetPA >= current ? 1 : -1) ; diff --git a/drivers/skeleton/focuser_driver.cpp b/drivers/skeleton/focuser_driver.cpp index 7501c308bf..0ab69d5970 100644 --- a/drivers/skeleton/focuser_driver.cpp +++ b/drivers/skeleton/focuser_driver.cpp @@ -119,7 +119,7 @@ bool FocuserDriver::updateProperties() bool FocuserDriver::Handshake() { - // This functin is ensure that we have communication with the focuser + // This function is ensure that we have communication with the focuser // Below we send it 0x6 byte and check for 'S' in the return. Change this // to be valid for your driver. It could be anything, you can simply put this below // return readPosition() diff --git a/drivers/skeleton/focuser_driver.h b/drivers/skeleton/focuser_driver.h index d27c6ff878..f7d24d39e7 100644 --- a/drivers/skeleton/focuser_driver.h +++ b/drivers/skeleton/focuser_driver.h @@ -42,7 +42,7 @@ class FocuserDriver : public INDI::Focuser bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override; - // If you define any Number properties, then you need to override ISNewNumber to repond to number property requests. + // If you define any Number properties, then you need to override ISNewNumber to respond to number property requests. //bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; protected: @@ -94,7 +94,7 @@ class FocuserDriver : public INDI::Focuser * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ @@ -137,6 +137,6 @@ class FocuserDriver : public INDI::Focuser static constexpr const uint8_t DRIVER_TEMPERATURE_FREQ {10}; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {64}; }; diff --git a/drivers/skeleton/mount_driver.cpp b/drivers/skeleton/mount_driver.cpp index d6354b06f7..df2d871811 100644 --- a/drivers/skeleton/mount_driver.cpp +++ b/drivers/skeleton/mount_driver.cpp @@ -139,7 +139,7 @@ bool MountDriver::updateProperties() bool MountDriver::Handshake() { - // This functin is ensure that we have communication with the mount + // This function is ensure that we have communication with the mount // Below we send it 0x6 byte and check for 'S' in the return. Change this // to be valid for your driver. It could be anything, you can simply put this below // return readScopeStatus() diff --git a/drivers/skeleton/mount_driver.h b/drivers/skeleton/mount_driver.h index 9b62de295e..e8266af7b3 100644 --- a/drivers/skeleton/mount_driver.h +++ b/drivers/skeleton/mount_driver.h @@ -26,9 +26,9 @@ * mount driver. Modify the driver to fit your needs. * * It supports the following features: - * + Sideral and Custom Tracking rates. + * + Sidereal and Custom Tracking rates. * + Goto & Sync - * + NWSE Hand controller direciton key slew. + * + NWSE Hand controller direction key slew. * + Tracking On/Off. * + Parking & Unparking with custom parking positions. * + Setting Time & Location. @@ -134,7 +134,7 @@ class MountDriver : public INDI::Telescope, public INDI::GuiderInterface * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ @@ -168,7 +168,7 @@ class MountDriver : public INDI::Telescope, public INDI::GuiderInterface 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. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {64}; }; diff --git a/drivers/spectrograph/CMakeLists.txt b/drivers/spectrograph/CMakeLists.txt index e50e52f5a0..6286e4a5f6 100644 --- a/drivers/spectrograph/CMakeLists.txt +++ b/drivers/spectrograph/CMakeLists.txt @@ -14,7 +14,7 @@ set( shelyak_usis_SRCS ) add_executable(shelyak_usis ${shelyak_usis_SRCS}) -target_link_libraries(shelyak_usis indidriver) +target_link_libraries(shelyak_usis indidriver ${JSONLIB}) install(TARGETS shelyak_usis RUNTIME DESTINATION bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/shelyak/shelyak_boards.json DESTINATION ${DATA_INSTALL_DIR}) diff --git a/drivers/spectrograph/shelyak/indi_shelyak_usis.cpp b/drivers/spectrograph/shelyak/indi_shelyak_usis.cpp index e42fbe39e4..309bfb0148 100644 --- a/drivers/spectrograph/shelyak/indi_shelyak_usis.cpp +++ b/drivers/spectrograph/shelyak/indi_shelyak_usis.cpp @@ -211,7 +211,7 @@ void ShelyakDriver::scanProperties( ) if ( sendCmd( &rsp, "GET;DEVICE_NAME;VALUE" ) ) { - // try to find dthe device definition in the .json + // try to find the device definition in the .json json device; if( !findBoard( rsp.parts[4], &device ) ) { diff --git a/drivers/spectrograph/shelyak/indi_shelyak_usis.h b/drivers/spectrograph/shelyak/indi_shelyak_usis.h index f819cccb21..e00f9bdf89 100644 --- a/drivers/spectrograph/shelyak/indi_shelyak_usis.h +++ b/drivers/spectrograph/shelyak/indi_shelyak_usis.h @@ -24,7 +24,12 @@ #include "defaultdevice.h" #include "connectionplugins/connectionserial.h" -#include "json.h" + +#ifdef _USE_SYSTEM_JSONLIB +#include +#else +#include +#endif using json = nlohmann::json; diff --git a/drivers/telescope/CMakeLists.txt b/drivers/telescope/CMakeLists.txt index 331a30d84e..9c2f9f234c 100644 --- a/drivers/telescope/CMakeLists.txt +++ b/drivers/telescope/CMakeLists.txt @@ -262,6 +262,6 @@ install(TARGETS indi_skywatcherAltAzMount RUNTIME DESTINATION bin) add_executable(indi_planewave_telescope planewave_mount.cpp) -target_link_libraries(indi_planewave_telescope indidriver) +target_link_libraries(indi_planewave_telescope indidriver ${HTTPLIB_LIBRARY}) install(TARGETS indi_planewave_telescope RUNTIME DESTINATION bin) diff --git a/drivers/telescope/astrotrac.cpp b/drivers/telescope/astrotrac.cpp index d332ac82ec..18c2217a68 100644 --- a/drivers/telescope/astrotrac.cpp +++ b/drivers/telescope/astrotrac.cpp @@ -593,10 +593,10 @@ double AstroTrac::calculateSlewTime(double distance) // Firstly throw away sign of distance - don't care about direction - and convert to arcsec distance = fabs(distance) * 3600.0; - // Now estimate how far mount travels during accelertion and deceleration period + // Now estimate how far mount travels during acceleration and deceleration period double accelerate_decelerate = MAX_SLEW_VELOCITY * MAX_SLEW_VELOCITY / AccelerationNP[AXIS_RA].getValue(); - // If distance less than this, then calulate using accleration forumlae: + // If distance less than this, then calculate using acceleration forumlae: if (distance < accelerate_decelerate) { return (2 * sqrt(distance / AccelerationNP[AXIS_RA].getValue())); diff --git a/drivers/telescope/astrotrac.h b/drivers/telescope/astrotrac.h index a31cfa25af..fdee2ed37e 100644 --- a/drivers/telescope/astrotrac.h +++ b/drivers/telescope/astrotrac.h @@ -140,7 +140,7 @@ class AstroTrac : * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ @@ -200,13 +200,13 @@ class AstroTrac : static const char DRIVER_STOP_CHAR { 0x3E }; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {64}; // Slew Modes static constexpr const uint8_t SLEW_MODES {10}; // Slew Speeds static const std::array SLEW_SPEEDS; - // Maximum Slew Velocity. This cannot be set now so it's considered contant until until it can be altered. + // Maximum Slew Velocity. This cannot be set now so it's considered constant until until it can be altered. // arcsec/sec static constexpr double MAX_SLEW_VELOCITY {10800.0}; // Target threshold in degrees between mechanical target and current coordinates diff --git a/drivers/telescope/celestrondriver.cpp b/drivers/telescope/celestrondriver.cpp index b766637e5f..8e986f84fa 100644 --- a/drivers/telescope/celestrondriver.cpp +++ b/drivers/telescope/celestrondriver.cpp @@ -354,7 +354,11 @@ bool CelestronDriver::get_version(char *version, size_t size) if (!send_command("V", 1, response, 3, true, false)) return false; - snprintf(version, size, "%d.%02d", static_cast(response[0]), static_cast(response[1])); + // Versions up to 2.2 have a single-digit minor version + if (static_cast(response[0]) > 2) + snprintf(version, size, "%d.%02d", static_cast(response[0]), static_cast(response[1])); + else + snprintf(version, size, "%d.%d", static_cast(response[0]), static_cast(response[1])); LOGF_INFO("Controller version: %s", version); return true; diff --git a/drivers/telescope/celestrongps.cpp b/drivers/telescope/celestrongps.cpp index dfd36b11ec..58a4241d62 100644 --- a/drivers/telescope/celestrongps.cpp +++ b/drivers/telescope/celestrongps.cpp @@ -1388,7 +1388,7 @@ void CelestronGPS::mountSim() return; } - // Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly + // Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly switch (TrackState) { case SCOPE_IDLE: @@ -1855,7 +1855,7 @@ void CelestronGPS::guideTimer(CELESTRON_DIRECTION dirn) { if (driver.get_pulse_status(dirn)) { - // curent move not finished, add some more time + // current move not finished, add some more time AddGuideTimer(dirn, 100); return; } diff --git a/drivers/telescope/ieqdriverbase.h b/drivers/telescope/ieqdriverbase.h index e2a35e209e..44ca084263 100644 --- a/drivers/telescope/ieqdriverbase.h +++ b/drivers/telescope/ieqdriverbase.h @@ -108,7 +108,7 @@ class Base **************************************************************************/ /** Get iEQ current status info */ bool getStatus(Info *info); - /** Initilizes communication with the mount and gets mount model */ + /** Initializes communication with the mount and gets mount model */ bool getModel(); /** Get mainboard and controller firmware only */ bool getMainFirmware(); @@ -152,7 +152,7 @@ class Base * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ diff --git a/drivers/telescope/ieqpro.cpp b/drivers/telescope/ieqpro.cpp index 7f7389f81a..6bdcade54e 100644 --- a/drivers/telescope/ieqpro.cpp +++ b/drivers/telescope/ieqpro.cpp @@ -930,7 +930,7 @@ bool IEQPro::saveConfigItems(FILE *fp) // ltv = tv; // da = SLEWRATE * dt; -// /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ +// /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ // switch (TrackState) // { // case SCOPE_IDLE: @@ -1020,7 +1020,7 @@ bool IEQPro::SetCurrentPark() bool IEQPro::SetDefaultPark() { - // By defualt azimuth 0 + // By default azimuth 0 SetAxis1Park(0); // Altitude = latitude of observer diff --git a/drivers/telescope/ieqprolegacy.cpp b/drivers/telescope/ieqprolegacy.cpp index 17755e524e..ad9d6a5198 100644 --- a/drivers/telescope/ieqprolegacy.cpp +++ b/drivers/telescope/ieqprolegacy.cpp @@ -817,7 +817,7 @@ void IEQProLegacy::mountSim() ltv = tv; da = SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_IDLE: @@ -911,7 +911,7 @@ bool IEQProLegacy::SetCurrentPark() bool IEQProLegacy::SetDefaultPark() { - // By defualt azimuth 0 + // By default azimuth 0 SetAxis1Park(0); // Altitude = latitude of observer diff --git a/drivers/telescope/ieqprolegacydriver.h b/drivers/telescope/ieqprolegacydriver.h index 926b8ebc9b..ee347bc720 100644 --- a/drivers/telescope/ieqprolegacydriver.h +++ b/drivers/telescope/ieqprolegacydriver.h @@ -95,7 +95,7 @@ bool check_ieqpro_connection(int fd); **************************************************************************/ /** Get iEQ current status info */ bool get_ieqpro_status(int fd, IEQInfo *info); -/** Get All firmware informatin in addition to mount model */ +/** Get All firmware information in addition to mount model */ bool get_ieqpro_firmware(int fd, FirmwareInfo *info); /** Get mainboard and controller firmware only */ bool get_ieqpro_main_firmware(int fd, FirmwareInfo *info); diff --git a/drivers/telescope/ioptronHC8406.cpp b/drivers/telescope/ioptronHC8406.cpp index facea8c01f..84045cd197 100644 --- a/drivers/telescope/ioptronHC8406.cpp +++ b/drivers/telescope/ioptronHC8406.cpp @@ -30,7 +30,7 @@ INFO :Gg# -003*18:03# longitud :Gt# +41*06:56# latitude :GL# 7:02:47.0# local time -:GS# 20:12: 3.3# Sideral Time +:GS# 20:12: 3.3# Sidereal Time :GR# 2:12:57.4# RA :GD# +90* 0: 0# DEC :GA# +41* 6:55# ALT @@ -48,10 +48,10 @@ COMMANDS This only works if the mount is not stopped (tracking) :RT0# --> Lunar :RT1# --> solar -:RT2# --> sideral +:RT2# --> sidereal :RT9# --> zero but not work!! -!!!There isn't a command to start/stop tracking !!! You have to do manualy +!!!There isn't a command to start/stop tracking !!! You have to do manually This speeds only are taken into account for protocol buttons, not for the HC Buttons :RG# --> Select guide speed for :Mn#,:Ms# .... @@ -68,7 +68,7 @@ V1.12 2011-08-12 UPGRADE INFO ON: http://www.ioptron.com/Articles.asp?ID=268 :RT9# -> stop tracking -:RT0# -> start tracking at sidera speed. Formerly only preselect sideral speed but +:RT0# -> start tracking at sidera speed. Formerly only preselect sidereal speed but not start the tracking itself :Me# @@ -359,7 +359,7 @@ void ioptronHC8406::getBasicData() void ioptronHC8406::ioptronHC8406Init() { //This mount doesn't report anything so we send some CMD - //just to get syncronize with the GUI at start time + //just to get synchronized with the GUI at start time LOG_WARN("Sending init CMDs. Unpark, Stop tracking"); UnPark(); TrackState = SCOPE_IDLE; @@ -755,7 +755,7 @@ bool ioptronHC8406::SetTrackEnabled(bool enabled) { if (enabled) { - LOG_WARN(" START TRACKING AT SIDERAL SPEED (:RT2#)"); + LOG_WARN(" START TRACKING AT SIDEREAL SPEED (:RT2#)"); return setioptronHC8406TrackMode(0); } else @@ -929,7 +929,7 @@ void ioptronHC8406::mountSim() ltv = tv; da = SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_TRACKING: diff --git a/drivers/telescope/ioptronv3.cpp b/drivers/telescope/ioptronv3.cpp index f965f1ca8c..b53487c55e 100644 --- a/drivers/telescope/ioptronv3.cpp +++ b/drivers/telescope/ioptronv3.cpp @@ -131,10 +131,10 @@ bool IOptronV3::initProperties() ISR_1OFMANY, 0, IPS_IDLE); /* Home */ - IUFillSwitch(&HomeS[IOP_FIND_HOME], "FindHome", "Find Home", ISS_OFF); - IUFillSwitch(&HomeS[IOP_SET_HOME], "SetCurrentAsHome", "Set current as Home", ISS_OFF); - IUFillSwitch(&HomeS[IOP_GOTO_HOME], "GoToHome", "Go to Home", ISS_OFF); - IUFillSwitchVector(&HomeSP, HomeS, 3, getDeviceName(), "HOME", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, + IUFillSwitch(&HomeS[IOP_FIND_HOME], "FIND", "Find", ISS_OFF); + IUFillSwitch(&HomeS[IOP_SET_HOME], "SET", "Set As Current", ISS_OFF); + IUFillSwitch(&HomeS[IOP_GOTO_HOME], "GO", "Go", ISS_OFF); + IUFillSwitchVector(&HomeSP, HomeS, 3, getDeviceName(), "TELESCOPE_HOME", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE); /* v3.0 Create PEC Training switches */ @@ -196,7 +196,7 @@ bool IOptronV3::initProperties() else serialConnection->setDefaultBaudRate(Connection::Serial::B_115200); - // Default WiFi connection parametes + // Default WiFi connection parameters tcpConnection->setDefaultHost("10.10.100.254"); tcpConnection->setDefaultPort(8899); @@ -1162,7 +1162,7 @@ void IOptronV3::mountSim() double currentSlewRate = Driver::IOP_SLEW_RATES[IUFindOnSwitchIndex(&SlewRateSP)] * TRACKRATE_SIDEREAL / 3600.0; da = currentSlewRate * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_IDLE: @@ -1253,7 +1253,7 @@ bool IOptronV3::SetCurrentPark() bool IOptronV3::SetDefaultPark() { - // By defualt azimuth 0 + // By default azimuth 0 SetAxis1Park(0); // Altitude = latitude of observer SetAxis2Park(LocationN[LOCATION_LATITUDE].value); diff --git a/drivers/telescope/ioptronv3driver.cpp b/drivers/telescope/ioptronv3driver.cpp index de6b4da568..eb7db4dd96 100644 --- a/drivers/telescope/ioptronv3driver.cpp +++ b/drivers/telescope/ioptronv3driver.cpp @@ -65,6 +65,10 @@ const std::map Driver::models = {"0063", "HAZ69-EC EQ"}, {"0064", "HAE69 AA"}, {"0065", "HAE69-EC AA"}, + {"0066", "HAE69C EQ"}, + {"0067", "HAE69C-EC EQ"}, + {"0068", "HAE69C AA"}, + {"0069", "HAE69C-EC AA"}, {"0070", "CEM70"}, {"0071", "CEM70-EC"}, {"0072", "CEM70-EC2"}, diff --git a/drivers/telescope/ioptronv3driver.h b/drivers/telescope/ioptronv3driver.h index 7b5b5a6a33..85efb3d429 100644 --- a/drivers/telescope/ioptronv3driver.h +++ b/drivers/telescope/ioptronv3driver.h @@ -108,7 +108,7 @@ class Driver **************************************************************************/ /** Get iEQ current status info */ bool getStatus(IOPInfo *info); - /** Get All firmware informatin in addition to mount model */ + /** Get All firmware information in addition to mount model */ bool getFirmwareInfo(FirmwareInfo *info); /** Get RA/DEC */ bool getCoords(double *ra, double *de, IOP_PIER_STATE *pierState, IOP_CW_STATE *cwState); diff --git a/drivers/telescope/lx200_10micron.cpp b/drivers/telescope/lx200_10micron.cpp index a9edb01578..263bf72173 100644 --- a/drivers/telescope/lx200_10micron.cpp +++ b/drivers/telescope/lx200_10micron.cpp @@ -670,7 +670,7 @@ bool LX200_10MICRON::SyncConfigBehaviour(bool cmcfg) // #:CMCFGn# // Configures the behaviour of the :CM# and :CMR# commands depending on the value // of n. If n=0, :the commands :CM# and :CMR# work in the default mode, i.e. they - // synchronize the position ot the mount with the coordinates of the currently selected + // synchronize the position to the mount with the coordinates of the currently selected // target by correcting the axis offset values. If n=1, the commands :CM# and :CMR# // work by using the synchronization position as an additional alignment star for refining // the alignment model. @@ -808,7 +808,7 @@ bool LX200_10MICRON::SetTLEfromDatabase(int tleN) bool LX200_10MICRON::CalculateSatTrajectory(std::string start_pass_isodatetime, std::string end_pass_isodatetime) { // #:TLEPJD,min# - // Precalulates the first transit of the satellite with the currently loaded orbital elements, + // Precalculates the first transit of the satellite with the currently loaded orbital elements, // starting from Julian Date JD and for a period of min minutes, where min is from 1 to 1440. // Two-line elements have to be loaded with the :TLEL command. // Returns: diff --git a/drivers/telescope/lx200_OnStep.cpp b/drivers/telescope/lx200_OnStep.cpp index 20bb2c4478..49cef4b988 100644 --- a/drivers/telescope/lx200_OnStep.cpp +++ b/drivers/telescope/lx200_OnStep.cpp @@ -50,7 +50,7 @@ LX200_OnStep::LX200_OnStep() : LX200Generic(), WI(this), RotatorInterface(this) currentCatalog = LX200_STAR_C; currentSubCatalog = 0; - setVersion(1, 20); // don't forget to update libindi/drivers.xml + setVersion(1, 22); // don't forget to update libindi/drivers.xml setLX200Capability(LX200_HAS_TRACKING_FREQ | LX200_HAS_SITES | LX200_HAS_ALIGNMENT_TYPE | LX200_HAS_PULSE_GUIDING | LX200_HAS_PRECISE_TRACKING_FREQ); @@ -62,7 +62,7 @@ LX200_OnStep::LX200_OnStep() : LX200Generic(), WI(this), RotatorInterface(this) // 4 stands for the number of Slewrate Buttons as defined in Inditelescope.cpp //setLX200Capability(LX200_HAS_FOCUS | LX200_HAS_TRACKING_FREQ | LX200_HAS_ALIGNMENT_TYPE | LX200_HAS_SITES | LX200_HAS_PULSE_GUIDING); // - // Get generic capabilities but discard the followng: + // Get generic capabilities but discard the following: // LX200_HAS_FOCUS @@ -331,13 +331,12 @@ bool LX200_OnStep::initProperties() IUFillSwitch(&OSNAlignStarsS[6], "7", "7 Stars", ISS_OFF); IUFillSwitch(&OSNAlignStarsS[7], "8", "8 Stars", ISS_OFF); IUFillSwitch(&OSNAlignStarsS[8], "9", "9 Stars", ISS_OFF); - IUFillSwitchVector(&OSNAlignStarsSP, OSNAlignStarsS, 9, getDeviceName(), "AlignStars", "Align using some stars, Alpha only", + IUFillSwitchVector(&OSNAlignStarsSP, OSNAlignStarsS, 9, getDeviceName(), "AlignStars", "Select # of stars", ALIGN_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE); IUFillSwitch(&OSNAlignS[0], "0", "Start Align", ISS_OFF); IUFillSwitch(&OSNAlignS[1], "1", "Issue Align", ISS_OFF); - IUFillSwitch(&OSNAlignS[2], "3", "Write Align", ISS_OFF); - IUFillSwitchVector(&OSNAlignSP, OSNAlignS, 2, getDeviceName(), "NewAlignStar", "Align using up to 6 stars, Alpha only", + IUFillSwitchVector(&OSNAlignSP, OSNAlignS, 2, getDeviceName(), "NewAlignStar", "Align using up to 9 stars", ALIGN_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE); IUFillSwitch(&OSNAlignWriteS[0], "0", "Write Align to NVRAM/Flash", ISS_OFF); @@ -356,7 +355,7 @@ bool LX200_OnStep::initProperties() IUFillText(&OSNAlignT[5], "5", "Max Stars", "Not Updated"); IUFillText(&OSNAlignT[6], "6", "Current Star", "Not Updated"); IUFillText(&OSNAlignT[7], "7", "# of Align Stars", "Not Updated"); - IUFillTextVector(&OSNAlignTP, OSNAlignT, 8, getDeviceName(), "NAlign Process", "", ALIGN_TAB, IP_RO, 0, IPS_IDLE); + IUFillTextVector(&OSNAlignTP, OSNAlignT, 8, getDeviceName(), "Align Process", "", ALIGN_TAB, IP_RO, 0, IPS_IDLE); IUFillText(&OSNAlignErrT[0], "0", "EQ Polar Error Alt", "Available once Aligned"); IUFillText(&OSNAlignErrT[1], "1", "EQ Polar Error Az", "Available once Aligned"); @@ -366,7 +365,7 @@ bool LX200_OnStep::initProperties() // IUFillText(&OSNAlignErrT[5], "5", "Max Stars", "Not Updated"); // IUFillText(&OSNAlignErrT[6], "6", "Current Star", "Not Updated"); // IUFillText(&OSNAlignErrT[7], "7", "# of Align Stars", "Not Updated"); - IUFillTextVector(&OSNAlignErrTP, OSNAlignErrT, 2, getDeviceName(), "ErrAlign Process", "", ALIGN_TAB, IP_RO, 0, IPS_IDLE); + IUFillTextVector(&OSNAlignErrTP, OSNAlignErrT, 2, getDeviceName(), "Align OnStep results", "", ALIGN_TAB, IP_RO, 0, IPS_IDLE); // =============== INFO_TAB @@ -1869,6 +1868,7 @@ bool LX200_OnStep::ISNewSwitch(const char *dev, const char *name, ISState *state if (!strcmp(name, OSNAlignPolarRealignSP.name)) { char cmd[CMD_MAX_LEN] = {0}; + char response[RB_MAX_LEN]; if (IUUpdateSwitch(&OSNAlignPolarRealignSP, states, names, n) < 0) return false; @@ -1886,24 +1886,38 @@ bool LX200_OnStep::ISNewSwitch(const char *dev, const char *name, ISState *state UpdateAlignStatus(); return true; } - if (OSNAlignPolarRealignS[1].s == ISS_ON) //Command + if (OSNAlignPolarRealignS[1].s == ISS_ON) { OSNAlignPolarRealignS[1].s = ISS_OFF; // int returncode=sendOnStepCommand(" snprintf(cmd, 5, ":MP#"); - sendOnStepCommandBlind(cmd); - if (!sendOnStepCommandBlind(":MP#")) - { - IDSetSwitch(&OSNAlignPolarRealignSP, "Command for Refine Polar Alignment successful"); + // Returns: + // 0=goto is possible + // 1=below the horizon limit + // 2=above overhead limit + // 3=controller in standby + // 4=mount is parked + // 5=goto in progress + // 6=outside limits + // 7=hardware fault + // 8=already in motion + // 9=unspecified error + + int res = getCommandSingleCharResponse(PortFD, response, cmd); //0 = 0 Success 1..9 failure, no # on reply + if(res > 0 && response[0]=='0') + { + LOG_INFO("Command for Refine Polar Alignment Successful"); UpdateAlignStatus(); OSNAlignPolarRealignSP.s = IPS_OK; + IDSetSwitch(&OSNAlignPolarRealignSP, nullptr); return true; - } + } else - { - IDSetSwitch(&OSNAlignPolarRealignSP, "Command for Refine Polar Alignment FAILED"); + { + LOGF_ERROR("Command for Refine Polar Alignment Failed, error=%s", response[0]); UpdateAlignStatus(); OSNAlignPolarRealignSP.s = IPS_ALERT; + IDSetSwitch(&OSNAlignPolarRealignSP, nullptr); return false; } } @@ -2172,7 +2186,7 @@ bool LX200_OnStep::ReadScopeStatus() #endif int error_or_fail = getCommandSingleCharErrorOrLongResponse(PortFD, OSStat, - ":GU#"); // :GU# returns a string containg controller status + ":GU#"); // :GU# returns a string containing controller status if (error_or_fail > 1) // check if successful read (strcmp(OSStat, OldOSStat) != 0) //if status changed { //If this fails, simply return; @@ -2661,7 +2675,7 @@ bool LX200_OnStep::ReadScopeStatus() { //TODO: Check and recode :Gu# paths int error_or_fail = getCommandSingleCharErrorOrLongResponse(PortFD, OSStat, - ":Gu#"); // :Gu# returns a string containg controller status that's bitpacked + ":Gu#"); // :Gu# returns a string containing controller status that's bitpacked if (strcmp(OSStat, OldOSStat) != 0) //if status changed { //Ignored for now. @@ -4199,7 +4213,7 @@ int LX200_OnStep::OSUpdateRotator() OSRotator1 = false; return 0; //Return 0, as this is not a communication error } - if (error_or_fail < 1) //This does not neccessarily mean + if (error_or_fail < 1) //This does not necessarily mean { LOG_WARN("Error talking to rotator, might be timeout (especially on network)"); return -1; @@ -4606,7 +4620,7 @@ IPState LX200_OnStep::AlignStartGeometric (int stars) { //See here https://groups.io/g/onstep/message/3624 char cmd[CMD_MAX_LEN] = {0}; - + LOG_INFO("Sending Command to Start Alignment"); IUSaveText(&OSNAlignT[0], "Align STARTED"); IUSaveText(&OSNAlignT[1], "GOTO a star, center it"); @@ -4616,7 +4630,7 @@ IPState LX200_OnStep::AlignStartGeometric (int stars) // Check for max number of stars and gracefully fall back to max, if more are requested. char read_buffer[RB_MAX_LEN] = {0}; int error_or_fail = getCommandSingleCharErrorOrLongResponse(PortFD, read_buffer, ":A?#"); - if(error_or_fail != 4 || read_buffer[0] < '0' || read_buffer[0] > '9' || read_buffer[1] < '0' || read_buffer[1] > '9' + if(error_or_fail != 4 || read_buffer[0] < '0' || read_buffer[0] > '9' || read_buffer[1] < '0' || read_buffer[1] > ':' || read_buffer[2] < '0' || read_buffer[2] > '9') { LOGF_INFO("Getting Alignment Status: response Error, response = %s>", read_buffer); @@ -4662,7 +4676,7 @@ bool LX200_OnStep::UpdateAlignStatus () // :A?# Align status // Returns: mno# // where m is the maximum number of alignment stars - // n is the current alignment star (0 otherwise) + // n is the current alignment star (0 otherwise) or ':' in case 9 stars selected // o is the last required alignment star when an alignment is in progress (0 otherwise) char msg[40] = {0}; @@ -4671,7 +4685,7 @@ bool LX200_OnStep::UpdateAlignStatus () char read_buffer[RB_MAX_LEN] = {0}; int error_or_fail = getCommandSingleCharErrorOrLongResponse(PortFD, read_buffer, ":A?#"); - if(error_or_fail != 4 || read_buffer[0] < '0' || read_buffer[0] > '9' || read_buffer[1] < '0' || read_buffer[1] > '9' + if(error_or_fail != 4 || read_buffer[0] < '0' || read_buffer[0] > '9' || read_buffer[1] < '0' || read_buffer[1] > ':' || read_buffer[2] < '0' || read_buffer[2] > '9') { LOGF_INFO("Getting Alignment Status: response Error, response = %s>", read_buffer); @@ -4683,20 +4697,27 @@ bool LX200_OnStep::UpdateAlignStatus () snprintf(stars, sizeof(stars), "%d", max_stars); IUSaveText(&OSNAlignT[5], stars); snprintf(stars, sizeof(stars), "%d", current_star); + if (read_buffer[1] > '9') + { + IUSaveText(&OSNAlignT[6], ":"); + } + else + { IUSaveText(&OSNAlignT[6], stars); + } snprintf(stars, sizeof(stars), "%d", align_stars); IUSaveText(&OSNAlignT[7], stars); LOGF_DEBUG("Align: max_stars: %i current star: %u, align_stars %u", max_stars, current_star, align_stars); if (current_star <= align_stars) { - snprintf(msg, sizeof(msg), "%s Manual Align: Star %d/%d", read_buffer, current_star, align_stars ); + snprintf(msg, sizeof(msg), "%s Alignment: Star %d/%d", read_buffer, current_star, align_stars ); IUSaveText(&OSNAlignT[4], msg); } if (current_star > align_stars && max_stars > 1) { LOGF_DEBUG("Align: current star: %u, align_stars %u", int(current_star), int(align_stars)); - snprintf(msg, sizeof(msg), "Manual Align: Completed"); + snprintf(msg, sizeof(msg), "Align: Completed"); AlignDone(); IUSaveText(&OSNAlignT[4], msg); UpdateAlignErr(); @@ -4707,7 +4728,7 @@ bool LX200_OnStep::UpdateAlignStatus () bool LX200_OnStep::UpdateAlignErr() { - // :GXnn# Get OnStep value + // :GX0n# Get OnStep value // Returns: value // 00 ax1Cor @@ -4745,7 +4766,7 @@ bool LX200_OnStep::UpdateAlignErr() LOGF_INFO("Polar Align Error Status response Error, response = %s>", read_buffer); return false; } - error_or_fail = getCommandDoubleResponse(PortFD, &azmCor, read_buffer, ":GX02#"); + error_or_fail = getCommandDoubleResponse(PortFD, &azmCor, read_buffer, ":GX03#"); if (error_or_fail < 2) { LOGF_INFO("Polar Align Error Status response Error, response = %s>", read_buffer); @@ -4784,21 +4805,30 @@ IPState LX200_OnStep::AlignWrite() { //See here https://groups.io/g/onstep/message/3624 char cmd[CMD_MAX_LEN] = {0}; + char response[RB_MAX_LEN]; + LOG_INFO("Sending Command to Finish Alignment and write"); strncpy(cmd, ":AW#", sizeof(cmd)); - IUSaveText(&OSNAlignT[0], "Align FINISHED"); - IUSaveText(&OSNAlignT[1], "------"); - IUSaveText(&OSNAlignT[2], "And Written to EEPROM"); - IUSaveText(&OSNAlignT[3], "------"); - IDSetText(&OSNAlignTP, nullptr); - if (sendOnStepCommandBlind(cmd)) - { - return IPS_OK; - } - IUSaveText(&OSNAlignT[0], "Align WRITE FAILED"); - IDSetText(&OSNAlignTP, nullptr); - return IPS_ALERT; - + int res = getCommandSingleCharResponse(PortFD, response, cmd); //1 success , no # on reply + if(res > 0 && response[0]=='1') + { + LOG_INFO("Align Write Successful"); + UpdateAlignStatus(); + IUSaveText(&OSNAlignT[0], "Align FINISHED"); + IUSaveText(&OSNAlignT[1], "------"); + IUSaveText(&OSNAlignT[2], "And Written to EEPROM"); + IUSaveText(&OSNAlignT[3], "------"); + IDSetText(&OSNAlignTP, nullptr); + return IPS_OK; + } + else + { + LOGF_ERROR("Align Write Failed: error=%s", response); + UpdateAlignStatus(); + IUSaveText(&OSNAlignT[0], "Align WRITE FAILED"); + IDSetText(&OSNAlignTP, nullptr); + return IPS_ALERT; + } } #ifdef ONSTEP_NOTDONE @@ -5407,15 +5437,14 @@ void LX200_OnStep::PrintTrackState() return; } -bool LX200_OnStep::setUTCOffset(double - offset) //azwing fix after change in lx200driver.cpp and fix to have UTC hh:00, hh:30, hh:45 +bool LX200_OnStep::setUTCOffset(double offset) { bool result = true; char temp_string[RB_MAX_LEN]; int utc_hour, utc_min; // strange thing offset is rounded up to first decimal so that .75 is .8 utc_hour = int(offset) * -1; - utc_min = abs((offset - int(offset)) * 60); // negtive offsets require this abs() + utc_min = abs((offset - int(offset)) * 60); // negative offsets require this abs() if (utc_min > 30) utc_min = 45; snprintf(temp_string, sizeof(temp_string), ":SG%03d:%02d#", utc_hour, utc_min); result = (setStandardProcedure(PortFD, temp_string) == 0); diff --git a/drivers/telescope/lx200_OnStep.h b/drivers/telescope/lx200_OnStep.h index 846160871d..4345bffc48 100644 --- a/drivers/telescope/lx200_OnStep.h +++ b/drivers/telescope/lx200_OnStep.h @@ -25,9 +25,13 @@ =========================================== Version not yet updated/No INDI release: + Version 1.22 + - fixed #:AW#" and ":MP#" commands by using getCommandSingleCharResponse instead of sendOnStepCommandBlind + Version 1.21 + - fixed Onstep returning '9:9' when 9 star alignment is achieved thanks to Howard Dutton Version 1.20 - fixed wrong messages due to different return with OnStepX - - fixed Focuser Temerature not shown on Ekos + - fixed Focuser Temperature not shown on Ekos - fixed Weather settings (P/T/Hr) when no sensor present - minor typos Version 1.19 @@ -35,7 +39,7 @@ - fixed Autoflip Off update - fixed Elevation Limits update (was not read from OnStep) and format set to integer and gage for setup - fixed minutes passed meridian not showing actual values - - fixed missing slewrates defineProperty and deleteProperty causing redefinitions of overides + - fixed missing slewrates defineProperty and deleteProperty causing redefinitions of overrides - todo focuser stops working after some time ??? could not yet reproduce - fixed poll and update slew rates - todo poll and update maximum slew speed SmartWebServer=>Settings @@ -75,7 +79,7 @@ Version 1.10: (finalized: INDI 1.9.1) - Weather support for setting temperature/humidity/pressure, values will be overridden in OnStep by any sensor values. - Ability to swap primary focuser. - - High precision on location, and not overridding GPS even when marked for Mount > KStars. + - High precision on location, and not overriding GPS even when marked for Mount > KStars. - Added Rotator & De-Rotator Support - TMC_SPI status reported (RAW) on the Status Tab. (ST = Standstill, Ox = open load A/B, Gx = grounded A/B, OT = Overtemp Shutdown, PW = Overtemp Prewarning) - Manage OnStep Auxiliary Feature Names in Output Tab @@ -115,7 +119,7 @@ - James lan Focuser Code - James lan PEC - James Lan Alignment - - Azwing set all com variable legth to RB_MAX_LEN otherwise crash due to overflow + - Azwing set all com variable length to RB_MAX_LEN otherwise crash due to overflow - Azwing set local variable size to RB_MAX_LEN otherwise erased by overflow preventing Align and other stuf to work - James Lan Align Tab implementation - Azwing Removed Alignment in main tab @@ -417,7 +421,7 @@ class LX200_OnStep : public LX200Generic, public INDI::WeatherInterface, public ISwitchVectorProperty OSNAlignStarsSP; ISwitch OSNAlignStarsS[9]; ISwitchVectorProperty OSNAlignSP; - ISwitch OSNAlignS[4]; + ISwitch OSNAlignS[2]; ISwitchVectorProperty OSNAlignWriteSP; ISwitch OSNAlignWriteS[1]; ISwitchVectorProperty OSNAlignPolarRealignSP; diff --git a/drivers/telescope/lx200_TeenAstro.cpp b/drivers/telescope/lx200_TeenAstro.cpp index 7a9ac7e3a2..2e4dae7ebf 100644 --- a/drivers/telescope/lx200_TeenAstro.cpp +++ b/drivers/telescope/lx200_TeenAstro.cpp @@ -58,7 +58,7 @@ extern std::mutex lx200CommsLock; */ LX200_TeenAstro::LX200_TeenAstro() { - setVersion(1, 3); // don't forget to update drivers.xml + setVersion(1, 4); // don't forget to update drivers.xml DBG_SCOPE = INDI::Logger::getInstance().addDebugLevel("Scope Verbose", "SCOPE"); @@ -274,7 +274,7 @@ bool LX200_TeenAstro::ReadScopeStatus() } // update mount status - getCommandString(PortFD, OSStat, statusCommand); // returns a string containg controller status + getCommandString(PortFD, OSStat, statusCommand); // returns a string containing controller status if (OSStat[15] != '0') { updateMountStatus(OSStat[15]); // error @@ -1152,25 +1152,65 @@ bool LX200_TeenAstro::SetGuideRate(float guideRate) IPState LX200_TeenAstro::GuideNorth(uint32_t ms) { SendPulseCmd(LX200_NORTH, ms); - return IPS_OK; + if(MovementNSSP.s == IPS_BUSY) + return IPS_ALERT; + + if (GuideNSTID) + { + IERmTimer(GuideNSTID); + GuideNSTID = 0; + } + + GuideNSTID = IEAddTimer(static_cast(ms), guideTimeoutHelperNS, this); + return IPS_BUSY; } IPState LX200_TeenAstro::GuideSouth(uint32_t ms) { SendPulseCmd(LX200_SOUTH, ms); - return IPS_OK; + if(MovementNSSP.s == IPS_BUSY) + return IPS_ALERT; + + if (GuideNSTID) + { + IERmTimer(GuideNSTID); + GuideNSTID = 0; + } + + GuideNSTID = IEAddTimer(static_cast(ms), guideTimeoutHelperNS, this); + return IPS_BUSY; } IPState LX200_TeenAstro::GuideEast(uint32_t ms) { SendPulseCmd(LX200_EAST, ms); - return IPS_OK; + if(MovementWESP.s == IPS_BUSY) + return IPS_ALERT; + + if (GuideWETID) + { + IERmTimer(GuideWETID); + GuideWETID = 0; + } + + GuideWETID = IEAddTimer(static_cast(ms), guideTimeoutHelperWE, this); + return IPS_BUSY; } IPState LX200_TeenAstro::GuideWest(uint32_t ms) { SendPulseCmd(LX200_WEST, ms); - return IPS_OK; + if(MovementWESP.s == IPS_BUSY) + return IPS_ALERT; + + if (GuideWETID) + { + IERmTimer(GuideWETID); + GuideWETID = 0; + } + + GuideWETID = IEAddTimer(static_cast(ms), guideTimeoutHelperWE, this); + return IPS_BUSY; } void LX200_TeenAstro::SendPulseCmd(int8_t direction, uint32_t duration_msec) @@ -1265,7 +1305,7 @@ void LX200_TeenAstro::mountSim() ltv = tv; da = SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_TRACKING: @@ -1371,5 +1411,30 @@ void LX200_TeenAstro::sendCommand(const char *cmd) INDI_UNUSED(rc); } +void LX200_TeenAstro::guideTimeoutHelperNS(void * p) +{ + static_cast(p)->guideTimeoutNS(); +} + +void LX200_TeenAstro::guideTimeoutHelperWE(void * p) +{ + static_cast(p)->guideTimeoutWE(); +} +void LX200_TeenAstro::guideTimeoutNS() +{ + GuideNSNP.np[0].value = 0; + GuideNSNP.np[1].value = 0; + GuideNSNP.s = IPS_IDLE; + GuideNSTID = 0; + IDSetNumber(&GuideNSNP, nullptr); +} +void LX200_TeenAstro::guideTimeoutWE() +{ + GuideWENP.np[0].value = 0; + GuideWENP.np[1].value = 0; + GuideWENP.s = IPS_IDLE; + GuideWETID = 0; + IDSetNumber(&GuideWENP, nullptr); +} diff --git a/drivers/telescope/lx200_TeenAstro.h b/drivers/telescope/lx200_TeenAstro.h index ffc01f060e..6474fec7ac 100644 --- a/drivers/telescope/lx200_TeenAstro.h +++ b/drivers/telescope/lx200_TeenAstro.h @@ -108,6 +108,12 @@ class LX200_TeenAstro : public INDI::Telescope, public INDI::GuiderInterface bool sendScopeTime(); bool sendScopeLocation(); + void guideTimeoutNS(); + void guideTimeoutWE(); + + static void guideTimeoutHelperNS(void * p); + static void guideTimeoutHelperWE(void * p); + // User interface INumber SlewAccuracyN[2]; @@ -152,4 +158,7 @@ class LX200_TeenAstro : public INDI::Telescope, public INDI::GuiderInterface const char *statusCommand; // :GU# for version 1.1, :GXI# for 1.2 and later const char *guideSpeedCommand; // :SXR0 + int GuideNSTID { -1 }; + int GuideWETID { -1 }; + }; diff --git a/drivers/telescope/lx200_pegasus_nyx101.cpp b/drivers/telescope/lx200_pegasus_nyx101.cpp index 3c246815ac..c07d08132c 100644 --- a/drivers/telescope/lx200_pegasus_nyx101.cpp +++ b/drivers/telescope/lx200_pegasus_nyx101.cpp @@ -52,7 +52,7 @@ LX200NYX101::LX200NYX101() TELESCOPE_HAS_TIME | TELESCOPE_HAS_LOCATION | TELESCOPE_HAS_TRACK_MODE, - SLEW_MODES); + SLEW_MODES); } bool LX200NYX101::initProperties() @@ -73,84 +73,112 @@ bool LX200NYX101::initProperties() if (mountType == Equatorial) SetTelescopeCapability(GetTelescopeCapability() | TELESCOPE_HAS_PIER_SIDE, SLEW_MODES); + // Overwrite TRACK_CUSTOM, with TRACK_KING + IUFillSwitch(&TrackModeS[TRACK_KING], "TRACK_KING", "King", ISS_OFF); + + // Elevation Limits + ElevationLimitNP[OVERHEAD].fill("ELEVATION_OVERHEAD", "Overhead", "%g", 60, 90, 1, 90); + ElevationLimitNP[HORIZON].fill("ELEVATION_HORIZON", "Horizon", "%g", -30, 0, 1, 0); + ElevationLimitNP.fill(getDeviceName(), "ELEVATION_LIMIT", "Elevation Limit", MAIN_CONTROL_TAB, IP_RW, 0, + IPS_IDLE); + + // Meridian + MeridianLimitNP[0].fill("VALUE", "Degrees (+/- 120)", "%.f", -120, 120, 1, 0); + MeridianLimitNP.fill(getDeviceName(), "MERIDIAN_LIMIT", "Limit", MAIN_CONTROL_TAB, IP_RW, 60, IPS_IDLE); + + // Flip + FlipSP[0].fill("Flip", "Flip", ISS_OFF); + FlipSP.fill(getDeviceName(), "FLIP", "Pier Side", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); + + // Refraction + RefractSP[REFRACT_ON].fill("REFRACTION_ON", "On", ISS_OFF); + RefractSP[REFRACT_OFF].fill("REFRACTION_OFF", "Off", ISS_OFF); + RefractSP.fill(getDeviceName(), "REFRACTION", + "Refraction", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); + + // Safety Limits + SafetyLimitSP[SET_SAFETY_LIMIT].fill("SET_SAFETY_LIMIT", "Set", ISS_OFF); + SafetyLimitSP[CLEAR_SAFETY_LIMIT].fill("CLEAR_SAFETY_LIMIT", "Clear", ISS_OFF); + SafetyLimitSP.fill(getDeviceName(), "SAFETY_LIMIT", + "Custom Limits", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); // Guide Rate int guideRate = 1; IUGetConfigOnSwitchIndex(getDeviceName(), "GUIDE_RATE", &guideRate); - GuideRateSP[0].fill("0.25","0.25", guideRate == 0 ? ISS_ON : ISS_OFF); - GuideRateSP[1].fill("0.50","0.50", guideRate == 1 ? ISS_ON : ISS_OFF); - GuideRateSP[2].fill("1.00","1.00", guideRate == 2 ? ISS_ON : ISS_OFF); + GuideRateSP[0].fill("0.25", "0.25", guideRate == 0 ? ISS_ON : ISS_OFF); + GuideRateSP[1].fill("0.50", "0.50", guideRate == 1 ? ISS_ON : ISS_OFF); + GuideRateSP[2].fill("1.00", "1.00", guideRate == 2 ? ISS_ON : ISS_OFF); GuideRateSP.fill(getDeviceName(), "GUIDE_RATE", "Guide Rate", SETTINGS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); //Go Home - HomeSP[0].fill("Home", "Go", ISS_OFF); - HomeSP.fill(getDeviceName(), "HOME_GO", "Home go", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); + HomeSP[0].fill("GO", "Go", ISS_OFF); + HomeSP.fill(getDeviceName(), "TELESCOPE_HOME", "Home go", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); //Reset Home ResetHomeSP[0].fill("Home", "Reset", ISS_OFF); ResetHomeSP.fill(getDeviceName(), "HOME_RESET", "Home Reset", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); verboseReport = false; - VerboseReportSP[0].fill("On","On", ISS_OFF); - VerboseReportSP[1].fill("Off","Off", ISS_ON); + VerboseReportSP[0].fill("On", "On", ISS_OFF); + VerboseReportSP[1].fill("Off", "Off", ISS_ON); VerboseReportSP.fill(getDeviceName(), "REPORT_VERBOSE", "Verbose", STATUS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); - Report[0].fill("Report","GU","-"); + Report[0].fill("Report", "GU", "-"); Report.fill(getDeviceName(), "Report", "Report", STATUS_TAB, IP_RO, 60, IPS_IDLE); - IsTracking[0].fill("IsTracking","n","-"); - IsTracking.fill(getDeviceName(),"IsTracking","IsTracking",STATUS_TAB, IP_RO, 60, IPS_IDLE); +#ifdef DEBUG_NYX + DebugCommandTP[0].fill("Command", "", ""); + DebugCommandTP.fill(getDeviceName(), "DebugCommand", "", MAIN_CONTROL_TAB, IP_RW, 0, + IPS_IDLE); +#endif - IsSlewCompleted[0].fill("IsSlewCompleted","N","-"); - IsSlewCompleted.fill(getDeviceName(),"IsSlewCompleted","IsSlewCompleted",STATUS_TAB, IP_RO, 60, IPS_IDLE); + IsTracking[0].fill("IsTracking", "n", "-"); + IsTracking.fill(getDeviceName(), "IsTracking", "IsTracking", STATUS_TAB, IP_RO, 60, IPS_IDLE); - IsParked[0].fill("IsParked","p/P","-"); - IsParked.fill(getDeviceName(),"IsParked","IsParked",STATUS_TAB, IP_RO, 60, IPS_IDLE); + IsSlewCompleted[0].fill("IsSlewCompleted", "N", "-"); + IsSlewCompleted.fill(getDeviceName(), "IsSlewCompleted", "IsSlewCompleted", STATUS_TAB, IP_RO, 60, IPS_IDLE); - IsParkginInProgress[0].fill("IsParkginInProgress","I","-"); - IsParkginInProgress.fill(getDeviceName(),"IsParkginInProgress","IsParkginInProgress",STATUS_TAB, IP_RO, 60, IPS_IDLE); + IsParked[0].fill("IsParked", "p/P", "-"); + IsParked.fill(getDeviceName(), "IsParked", "IsParked", STATUS_TAB, IP_RO, 60, IPS_IDLE); - IsAtHomePosition[0].fill("IsAtHomePosition","H","-"); - IsAtHomePosition.fill(getDeviceName(),"IsAtHomePosition","IsAtHomePosition",STATUS_TAB, IP_RO, 60, IPS_IDLE); + IsParkginInProgress[0].fill("IsParkginInProgress", "I", "-"); + IsParkginInProgress.fill(getDeviceName(), "IsParkginInProgress", "IsParkginInProgress", STATUS_TAB, IP_RO, 60, IPS_IDLE); - TrackSidereal[0].fill("TrackSidereal","","-"); - TrackSidereal.fill(getDeviceName(),"TrackSidereal","TrackSidereal",STATUS_TAB, IP_RO, 60, IPS_IDLE); + IsAtHomePosition[0].fill("IsAtHomePosition", "H", "-"); + IsAtHomePosition.fill(getDeviceName(), "IsAtHomePosition", "IsAtHomePosition", STATUS_TAB, IP_RO, 60, IPS_IDLE); - TrackLunar[0].fill("TrackLunar","(","-"); - TrackLunar.fill(getDeviceName(),"TrackLunar","TrackLunar",STATUS_TAB, IP_RO, 60, IPS_IDLE); + MountAltAz[0].fill("MountAltAz", "A", "-"); + MountAltAz.fill(getDeviceName(), "MountAltAz", "MountAltAz", STATUS_TAB, IP_RO, 60, IPS_IDLE); - TrackSolar[0].fill("TrackSolar","O","-"); - TrackSolar.fill(getDeviceName(),"TrackSolar","TrackSolar",STATUS_TAB, IP_RO, 60, IPS_IDLE); + MountEquatorial[0].fill("MountEquatorial", "E", "-"); + MountEquatorial.fill(getDeviceName(), "MountEquatorial", "MountEquatorial", STATUS_TAB, IP_RO, 60, IPS_IDLE); - MountAltAz[0].fill("MountAltAz","A","-"); - MountAltAz.fill(getDeviceName(),"MountAltAz","MountAltAz",STATUS_TAB, IP_RO, 60, IPS_IDLE); + PierNone[0].fill("PierNone", "", "-"); + PierNone.fill(getDeviceName(), "PierNone", "PierNone", STATUS_TAB, IP_RO, 60, IPS_IDLE); - MountEquatorial[0].fill("MountEquatorial","E","-"); - MountEquatorial.fill(getDeviceName(),"MountEquatorial","MountEquatorial",STATUS_TAB, IP_RO, 60, IPS_IDLE); + PierEast[0].fill("PierEast", "T", "-"); + PierEast.fill(getDeviceName(), "PierEast", "PierEast", STATUS_TAB, IP_RO, 60, IPS_IDLE); - PierNone[0].fill("PierNone","","-"); - PierNone.fill(getDeviceName(),"PierNone","PierNone",STATUS_TAB, IP_RO, 60, IPS_IDLE); + PierWest[0].fill("PierWest", "W", "-"); + PierWest.fill(getDeviceName(), "PierWest", "PierWest", STATUS_TAB, IP_RO, 60, IPS_IDLE); - PierEast[0].fill("PierEast","T","-"); - PierEast.fill(getDeviceName(),"PierEast","PierEast",STATUS_TAB, IP_RO, 60, IPS_IDLE); + DoesRefractionComp[0].fill("DoesRefractionComp", "r", "-"); + DoesRefractionComp.fill(getDeviceName(), "DoesRefractionComp", "DoesRefractionComp", STATUS_TAB, IP_RO, 60, IPS_IDLE); - PierWest[0].fill("PierWest","W","-"); - PierWest.fill(getDeviceName(),"PierWest","PierWest",STATUS_TAB, IP_RO, 60, IPS_IDLE); + WaitingAtHome[0].fill("WaitingAtHome", "w", "-"); + WaitingAtHome.fill(getDeviceName(), "WaitingAtHome", "WaitingAtHome", STATUS_TAB, IP_RO, 60, IPS_IDLE); - DoesRefractionComp[0].fill("DoesRefractionComp","r","-"); - DoesRefractionComp.fill(getDeviceName(),"DoesRefractionComp","DoesRefractionComp",STATUS_TAB, IP_RO, 60, IPS_IDLE); + IsHomePaused[0].fill("IsHomePaused", "u", "-"); + IsHomePaused.fill(getDeviceName(), "IsHomePaused", "IsHomePaused", STATUS_TAB, IP_RO, 60, IPS_IDLE); - WaitingAtHome[0].fill("WaitingAtHome","w","-"); - WaitingAtHome.fill(getDeviceName(),"WaitingAtHome","WaitingAtHome",STATUS_TAB, IP_RO, 60, IPS_IDLE); + ParkFailed[0].fill("ParkFailed", "F", "-"); + ParkFailed.fill(getDeviceName(), "ParkFailed", "ParkFailed", STATUS_TAB, IP_RO, 60, IPS_IDLE); - IsHomePaused[0].fill("IsHomePaused","u","-"); - IsHomePaused.fill(getDeviceName(),"IsHomePaused","IsHomePaused",STATUS_TAB, IP_RO, 60, IPS_IDLE); - - ParkFailed[0].fill("ParkFailed","F","-"); - ParkFailed.fill(getDeviceName(),"ParkFailed","ParkFailed",STATUS_TAB, IP_RO, 60, IPS_IDLE); - - SlewingHome[0].fill("SlewingHome","h","-"); - SlewingHome.fill(getDeviceName(),"SlewingHome","SlewingHome",STATUS_TAB, IP_RO, 60, IPS_IDLE); + SlewingHome[0].fill("SlewingHome", "h", "-"); + SlewingHome.fill(getDeviceName(), "SlewingHome", "SlewingHome", STATUS_TAB, IP_RO, 60, IPS_IDLE); + // Reboot + RebootSP[0].fill("Reboot", "Reboot", ISS_OFF); + RebootSP.fill(getDeviceName(), "REBOOT", "Reboot", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); // Slew Rates strncpy(SlewRateS[0].label, "2x", MAXINDILABEL); @@ -180,7 +208,7 @@ bool LX200NYX101::updateProperties() char status[DRIVER_LEN] = {0}; if (sendCommand(":GU#", status)) { - if(strchr(status,'P')) + if(strchr(status, 'P')) SetParked(true); else SetParked(false); @@ -204,20 +232,44 @@ bool LX200NYX101::updateProperties() GuideRateSP.apply(); } + if(sendCommand(":Go#", status)) + { + std::string c = status; + ElevationLimitNP[OVERHEAD].value = std::stoi(c); + } + + if(sendCommand(":Gh#", status)) + { + std::string c = status; + ElevationLimitNP[HORIZON].value = std::stoi(c); + } + + if(sendCommand(":GXE9#", status)) + { + std::string c = status; + MeridianLimitNP[0].setValue(std::stoi(c)); + } + defineProperty(MountTypeSP); defineProperty(GuideRateSP); defineProperty(HomeSP); defineProperty(ResetHomeSP); defineProperty(Report); + defineProperty(FlipSP); + defineProperty(MeridianLimitNP); + defineProperty(ElevationLimitNP); + defineProperty(RefractSP); + defineProperty(SafetyLimitSP); +#ifdef DEBUG_NYX + defineProperty(DebugCommandTP); +#endif + defineProperty(RebootSP); defineProperty(VerboseReportSP); defineProperty(IsTracking); defineProperty(IsSlewCompleted); defineProperty(IsParked); defineProperty(IsParkginInProgress); defineProperty(IsAtHomePosition); - defineProperty(TrackSidereal); - defineProperty(TrackLunar); - defineProperty(TrackSolar); defineProperty(MountAltAz); defineProperty(MountEquatorial); defineProperty(PierNone); @@ -234,17 +286,23 @@ bool LX200NYX101::updateProperties() deleteProperty(MountTypeSP); deleteProperty(GuideRateSP); deleteProperty(HomeSP); + deleteProperty(MeridianLimitNP); + deleteProperty(FlipSP); + deleteProperty(ElevationLimitNP); + deleteProperty(SafetyLimitSP); deleteProperty(ResetHomeSP); deleteProperty(Report); +#ifdef DEBUG_NYX + deleteProperty(DebugCommandTP); +#endif + deleteProperty(RebootSP); deleteProperty(VerboseReportSP); + deleteProperty(RefractSP); deleteProperty(IsTracking); deleteProperty(IsSlewCompleted); deleteProperty(IsParked); deleteProperty(IsParkginInProgress); deleteProperty(IsAtHomePosition); - deleteProperty(TrackSidereal); - deleteProperty(TrackLunar); - deleteProperty(TrackSolar); deleteProperty(MountAltAz); deleteProperty(MountEquatorial); deleteProperty(PierNone); @@ -311,13 +369,13 @@ bool LX200NYX101::ReadScopeStatus() //bool _IsAtHomePosition = false; SetPropertyText(IsAtHomePosition, IPS_BUSY); - TelescopeTrackMode _TrackingMode = TRACK_SIDEREAL; + NYXTelescopeTrackMode _TrackingMode = TRACK_SIDEREAL; //MountType _MountType = Equatorial; TelescopePierSide _PierSide = PIER_UNKNOWN; - //bool _DoesRefractionComp = false; + bool _DoesRefractionComp = false; SetPropertyText(DoesRefractionComp, IPS_BUSY); //bool _WaitingAtHome = false; @@ -332,10 +390,7 @@ bool LX200NYX101::ReadScopeStatus() //bool _SlewingHome = false; SetPropertyText(SlewingHome, IPS_BUSY); - - - - char status[DRIVER_LEN] = {0}; + char status[DRIVER_LEN] = {0}; if(sendCommand(":GU#", status)) { Report[0].text = status; @@ -345,104 +400,104 @@ bool LX200NYX101::ReadScopeStatus() { switch (status[index++]) { - case 'n': - _IsTracking = false; - SetPropertyText(IsTracking, IPS_BUSY); - continue; - case 'N': - _IsSlewCompleted = true; - SetPropertyText(IsSlewCompleted, IPS_OK); - continue; - case 'p': - _IsParked = false; - SetPropertyText(IsParked, IPS_BUSY); - continue; - case 'P': - _IsParked = true; - SetPropertyText(IsParked, IPS_OK); - continue; - case 'I': - //_IsParkginInProgress = true; - SetPropertyText(IsParkginInProgress, IPS_OK); - continue; - case 'H': - //_IsAtHomePosition = true; - SetPropertyText(IsAtHomePosition, IPS_OK); - continue; - case '(': - _TrackingMode = TRACK_LUNAR; - continue; - case 'O': - _TrackingMode = TRACK_SOLAR; - continue; - case 'k': - //Not Supported by TelescopeTrackMode - continue; - case 'A': - //_MountType = AltAz; - SetPropertyText(MountAltAz, IPS_OK); - SetPropertyText(MountEquatorial, IPS_BUSY); - continue; - case 'E': - //_MountType = Equatorial; - SetPropertyText(MountEquatorial, IPS_OK); - SetPropertyText(MountAltAz, IPS_BUSY); - continue; - case 'T': - _PierSide = PIER_EAST; - continue; - case 'W': - _PierSide = PIER_WEST; - continue; - case 'r': - //_DoesRefractionComp = true; - SetPropertyText(DoesRefractionComp, IPS_OK); - continue; - case 'w': - //_WaitingAtHome = true; - SetPropertyText(WaitingAtHome, IPS_OK); - continue; - case 'u': - //_IsHomePaused = true; - SetPropertyText(IsHomePaused, IPS_OK); - continue; - case 'F': - //_ParkFailed = true; - SetPropertyText(ParkFailed, IPS_OK); - continue; - case 'h': - //_SlewingHome = true; - SetPropertyText(SlewingHome, IPS_OK); - continue; - case '#': - break; - default: - continue; + case 'n': + _IsTracking = false; + SetPropertyText(IsTracking, IPS_BUSY); + continue; + case 'N': + _IsSlewCompleted = true; + SetPropertyText(IsSlewCompleted, IPS_OK); + continue; + case 'p': + _IsParked = false; + SetPropertyText(IsParked, IPS_BUSY); + continue; + case 'P': + _IsParked = true; + SetPropertyText(IsParked, IPS_OK); + continue; + case 'I': + //_IsParkginInProgress = true; + SetPropertyText(IsParkginInProgress, IPS_OK); + continue; + case 'H': + //_IsAtHomePosition = true; + SetPropertyText(IsAtHomePosition, IPS_OK); + continue; + case '(': + _TrackingMode = TRACK_LUNAR; + continue; + case 'O': + _TrackingMode = TRACK_SOLAR; + continue; + case 'k': + _TrackingMode = TRACK_KING; + continue; + case 'A': + //_MountType = AltAz; + SetPropertyText(MountAltAz, IPS_OK); + SetPropertyText(MountEquatorial, IPS_BUSY); + continue; + case 'E': + //_MountType = Equatorial; + SetPropertyText(MountEquatorial, IPS_OK); + SetPropertyText(MountAltAz, IPS_BUSY); + continue; + case 'T': + _PierSide = PIER_EAST; + continue; + case 'W': + _PierSide = PIER_WEST; + continue; + case 'r': + _DoesRefractionComp = true; + SetPropertyText(DoesRefractionComp, IPS_OK); + continue; + case 'w': + //_WaitingAtHome = true; + SetPropertyText(WaitingAtHome, IPS_OK); + continue; + case 'u': + //_IsHomePaused = true; + SetPropertyText(IsHomePaused, IPS_OK); + continue; + case 'F': + //_ParkFailed = true; + SetPropertyText(ParkFailed, IPS_OK); + continue; + case 'h': + //_SlewingHome = true; + SetPropertyText(SlewingHome, IPS_OK); + continue; + case '#': + break; + default: + continue; } break; } } - - switch(_TrackingMode) + if(_DoesRefractionComp ) { - case INDI::Telescope::TRACK_SIDEREAL: - SetPropertyText(TrackSidereal, IPS_OK); - SetPropertyText(TrackLunar, IPS_BUSY); - SetPropertyText(TrackSolar, IPS_BUSY); - break; - case INDI::Telescope::TRACK_LUNAR: - SetPropertyText(TrackLunar, IPS_OK); - SetPropertyText(TrackSidereal, IPS_BUSY); - SetPropertyText(TrackSolar, IPS_BUSY); - break; - case INDI::Telescope::TRACK_SOLAR: - SetPropertyText(TrackSolar, IPS_OK); - SetPropertyText(TrackSidereal, IPS_BUSY); - SetPropertyText(TrackLunar, IPS_BUSY); - break; - case INDI::Telescope::TRACK_CUSTOM: - break; + RefractSP[REFRACT_ON].setState(ISS_ON); + RefractSP[REFRACT_OFF].setState(ISS_OFF); + RefractSP.setState(IPS_OK); + RefractSP.apply(); + } + else + { + RefractSP[REFRACT_ON].setState(ISS_OFF); + RefractSP[REFRACT_OFF].setState(ISS_ON); + RefractSP.setState(IPS_OK); + RefractSP.apply(); } + TrackModeS[TRACK_SIDEREAL].s = ISS_OFF; + TrackModeS[TRACK_LUNAR].s = ISS_OFF; + TrackModeS[TRACK_SOLAR].s = ISS_OFF; + TrackModeS[TRACK_KING].s = ISS_OFF; + TrackModeS[_TrackingMode].s = ISS_ON; + TrackModeSP.s = IPS_OK; + IDSetSwitch(&TrackModeSP, nullptr); switch(_PierSide) { @@ -512,6 +567,55 @@ bool LX200NYX101::ReadScopeStatus() bool LX200NYX101::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) { + if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) + { + if (MeridianLimitNP.isNameMatch(name)) + { + MeridianLimitNP.update(values, names, n); + if (!isSimulation()) + { + std::string command = ":SXE9," + std::to_string(MeridianLimitNP[0].getValue()) + "#";; + sendCommand(command.c_str()); + command = ":SXEA," + std::to_string(MeridianLimitNP[0].getValue()) + "#";; + sendCommand(command.c_str()); + if (MeridianLimitNP.getState() == IPS_OK) + { + LOGF_INFO("Meridian!: ", MeridianLimitNP[0].getValue()); + + } + } + else + { + MeridianLimitNP.setState(IPS_OK); + } + + MeridianLimitNP.apply(); + return true; + } + + if (ElevationLimitNP.isNameMatch(name)) + { + if(ElevationLimitNP.update(values, names, n)) + { + for(int i = 0; i < n; ++i) + { + if(ElevationLimitNP[OVERHEAD].isNameMatch(names[i])) + { + std::string command = ":So" + std::to_string(static_cast(ElevationLimitNP[OVERHEAD].getValue())) + "#";; + sendCommand(command.c_str()); + } + else if(ElevationLimitNP[HORIZON].isNameMatch(names[i])) + { + std::string command = ":Sh" + std::to_string(static_cast(ElevationLimitNP[HORIZON].getValue())) + "#";; + sendCommand(command.c_str()); + } + } + ElevationLimitNP.apply(); + return true; + } + } + } + return LX200Generic::ISNewNumber(dev, name, values, names, n); } @@ -565,6 +669,32 @@ bool LX200NYX101::ISNewSwitch(const char *dev, const char *name, ISState *states HomeSP.apply(); return true; } + else if(FlipSP.isNameMatch(name)) + { + FlipSP.update(states, names, n); + IPState state = IPS_OK; + if (isConnected()) + { + FlipSP[0].setState(ISS_OFF); + sendCommand(":MN#"); + } + FlipSP.setState(state); + FlipSP.apply(); + return true; + } + else if(RebootSP.isNameMatch(name)) + { + RebootSP.update(states, names, n); + IPState state = IPS_OK; + if (isConnected()) + { + RebootSP[0].setState(ISS_OFF); + sendCommand(":ERESET#"); + } + RebootSP.setState(state); + RebootSP.apply(); + return true; + } else if(ResetHomeSP.isNameMatch(name)) { ResetHomeSP.update(states, names, n); @@ -578,6 +708,41 @@ bool LX200NYX101::ISNewSwitch(const char *dev, const char *name, ISState *states ResetHomeSP.apply(); return true; } + else if(SafetyLimitSP.isNameMatch(name)) + { + SafetyLimitSP.update(states, names, n); + auto index = SafetyLimitSP.findOnSwitchIndex(); + switch(index) + { + case SET_SAFETY_LIMIT: + sendCommand(":Sc1#"); + sendCommand(":Sc#"); + break; + case CLEAR_SAFETY_LIMIT: + sendCommand(":Sc0#"); + sendCommand(":Sc#"); + break; + } + SafetyLimitSP.apply(); + return true; + } + else if(RefractSP.isNameMatch(name)) + { + RefractSP.update(states, names, n); + auto index = RefractSP.findOnSwitchIndex(); + + switch(index) + { + case REFRACT_ON: + sendCommand(":Tr#"); + break; + case REFRACT_OFF: + sendCommand(":Tn#"); + break; + } + RefractSP.apply(); + return true; + } else if(VerboseReportSP.isNameMatch(name)) { VerboseReportSP.update(states, names, n); @@ -594,9 +759,6 @@ bool LX200NYX101::ISNewSwitch(const char *dev, const char *name, ISState *states SetPropertyText(IsParked, IPS_IDLE); SetPropertyText(IsParkginInProgress, IPS_IDLE); SetPropertyText(IsAtHomePosition, IPS_IDLE); - SetPropertyText(TrackSidereal, IPS_IDLE); - SetPropertyText(TrackLunar, IPS_IDLE); - SetPropertyText(TrackSolar, IPS_IDLE); SetPropertyText(MountAltAz, IPS_IDLE); SetPropertyText(MountEquatorial, IPS_IDLE); SetPropertyText(PierNone, IPS_IDLE); @@ -619,41 +781,66 @@ bool LX200NYX101::ISNewSwitch(const char *dev, const char *name, ISState *states return LX200Generic::ISNewSwitch(dev, name, states, names, n); } +#ifdef DEBUG_NYX +bool LX200NYX101::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) +{ + if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) + { + if (DebugCommandTP.isNameMatch(name)) + { + DebugCommandTP.update(texts, names, n); + for(int i = 0; i < n; i++) + { + if(DebugCommandTP[0].isNameMatch(names[i])) + { + char status[DRIVER_LEN] = {0}; + sendCommand(texts[i]); + i = n; + } + } + return true; + } + } + return LX200Generic::ISNewText(dev, name, texts, names, n); + +} +#endif + bool LX200NYX101::SetSlewRate(int index) { double value = 0.0; switch(index) { - case 0: - value = 0.01; - break; - case 1: - value = 0.03; - break; - case 2: - value = 0.07; - break; - case 3: - value = 0.27; - break; - case 4: - value = 0.50; - break; - case 5: - value = 0.65; - break; - case 6: - value = 0.80; - break; - case 7: - value = 1; - break; - case 8: - value = 2.5; - break; - case 9: - value = 5; - break; + case 0: + value = 0.01; + break; + case 1: + value = 0.03; + break; + case 2: + value = 0.07; + break; + case 3: + value = 0.27; + break; + case 4: + value = 0.50; + break; + case 5: + value = 0.65; + break; + case 6: + value = 0.80; + break; + case 7: + value = 1; + break; + case 8: + value = 2.5; + break; + case 9: + value = 5; + break; }; char decCommand[DRIVER_LEN] = {0}; @@ -672,6 +859,26 @@ bool LX200NYX101::setGuideRate(int rate) return sendCommand(command); } +bool LX200NYX101::SetTrackMode(uint8_t mode) +{ + switch(mode) + { + case TRACK_SIDEREAL: + return sendCommand(":TQ#"); + break; + case TRACK_SOLAR: + return sendCommand(":TS#"); + break; + case TRACK_LUNAR: + return sendCommand(":TL#"); + break; + case TRACK_KING: + return sendCommand(":TK#"); + break; + } + return false; +} + bool LX200NYX101::setMountType(int type) { return sendCommand((type == Equatorial) ? ":SXEM,1#" : "::SXEM,3#"); diff --git a/drivers/telescope/lx200_pegasus_nyx101.h b/drivers/telescope/lx200_pegasus_nyx101.h index a09a9e51a7..9325e3e846 100644 --- a/drivers/telescope/lx200_pegasus_nyx101.h +++ b/drivers/telescope/lx200_pegasus_nyx101.h @@ -24,6 +24,8 @@ #pragma once #include "lx200generic.h" +//#define DEBUG_NYX + class LX200NYX101 : public LX200Generic { @@ -33,7 +35,12 @@ class LX200NYX101 : public LX200Generic virtual bool initProperties() 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; +#ifdef DEBUG_NYX + virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override; + INDI::PropertyText DebugCommandTP {1}; +#endif + protected: virtual bool ReadScopeStatus() override; virtual const char *getDefaultName() override; @@ -43,6 +50,7 @@ class LX200NYX101 : public LX200Generic virtual bool setUTCOffset(double offset) override; virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override; virtual bool SetTrackEnabled(bool enabled) override; + virtual bool SetTrackMode(uint8_t mode) override; virtual bool SetSlewRate(int index) override; private: @@ -51,12 +59,39 @@ class LX200NYX101 : public LX200Generic static const char DRIVER_STOP_CHAR { 0x23 }; static constexpr const uint8_t DRIVER_TIMEOUT {3}; + enum RefractionState + { + REFRACT_ON, + REFRACT_OFF + }; + + enum SafetyLimits + { + SET_SAFETY_LIMIT, + CLEAR_SAFETY_LIMIT + }; + + enum NYXTelescopeTrackMode + { + TRACK_SIDEREAL, + TRACK_SOLAR, + TRACK_LUNAR, + TRACK_KING + }; + INDI::PropertySwitch MountTypeSP {2}; enum MountType { AltAz, Equatorial }; + + enum ElevationNumber + { + OVERHEAD, + HORIZON + }; + INDI::PropertySwitch GuideRateSP {3}; INDI::PropertySwitch HomeSP {1}; INDI::PropertySwitch ResetHomeSP {1}; @@ -67,9 +102,6 @@ class LX200NYX101 : public LX200Generic INDI::PropertyText IsParked {1}; INDI::PropertyText IsParkginInProgress {1}; INDI::PropertyText IsAtHomePosition {1}; - INDI::PropertyText TrackSidereal {1}; - INDI::PropertyText TrackLunar {1}; - INDI::PropertyText TrackSolar {1}; INDI::PropertyText MountAltAz {1}; INDI::PropertyText MountEquatorial {1}; INDI::PropertyText PierNone {1}; @@ -80,7 +112,13 @@ class LX200NYX101 : public LX200Generic INDI::PropertyText IsHomePaused {1}; INDI::PropertyText ParkFailed {1}; INDI::PropertyText SlewingHome {1}; - + INDI::PropertySwitch FlipSP {1}; + INDI::PropertySwitch RebootSP {1}; + INDI::PropertySwitch RefractSP {2}; + INDI::PropertyNumber ElevationLimitNP {2}; + INDI::PropertyNumber MeridianLimitNP {1}; + INDI::PropertySwitch SafetyLimitSP {2}; + 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); diff --git a/drivers/telescope/lx200am5.cpp b/drivers/telescope/lx200am5.cpp index bd9420c5d9..1f5df2044a 100644 --- a/drivers/telescope/lx200am5.cpp +++ b/drivers/telescope/lx200am5.cpp @@ -93,7 +93,7 @@ bool LX200AM5::initProperties() // Home/Zero position HomeSP[0].fill("GO", "Go", ISS_OFF); - HomeSP.fill(getDeviceName(), "GO_HOME", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); + HomeSP.fill(getDeviceName(), "TELESCOPE_HOME", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); // Guide Rate GuideRateNP[0].fill("RATE", "Rate", "%.2f", 0.1, 0.9, 0.1, 0.5); @@ -466,6 +466,7 @@ bool LX200AM5::Park() bool LX200AM5::UnPark() { TrackState = SCOPE_IDLE; + SetParked(false); return true; } diff --git a/drivers/telescope/lx200am5.h b/drivers/telescope/lx200am5.h index 87494b4a45..a83df5d189 100644 --- a/drivers/telescope/lx200am5.h +++ b/drivers/telescope/lx200am5.h @@ -70,7 +70,7 @@ class LX200AM5 : public LX200Generic * after the command is successfully sent. * @param cmd_len if -1, it is assumed that the @a cmd is a null-terminated string. Otherwise, it would write @a cmd_len bytes from * the @a cmd buffer. - * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimeter DRIVER_STOP_CHAR + * @param res_len if -1 and if @a res is not nullptr, the function will read until it detects the default delimiter DRIVER_STOP_CHAR * up to DRIVER_LEN length. Otherwise, the function will read @a res_len from the device and store it in @a res. * @return True if successful, false otherwise. */ @@ -134,7 +134,7 @@ class LX200AM5 : public LX200Generic 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. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {64}; // Slew Modes static constexpr const uint8_t SLEW_MODES {10}; diff --git a/drivers/telescope/lx200ap_v2.cpp b/drivers/telescope/lx200ap_v2.cpp index a81c879948..8bebe5bc42 100644 --- a/drivers/telescope/lx200ap_v2.cpp +++ b/drivers/telescope/lx200ap_v2.cpp @@ -65,7 +65,7 @@ enum APPECRecordingState // maximum guide pulse request to send to controller #define MAX_LX200AP_PULSE_LEN 999 -// The workaround for long pulses does't work! +// The workaround for long pulses doesn't work! // #define DONT_SIMULATE_LONG_PULSES true // This didn't work. The driver simply doesn't send pulse // commands longer than 999ms since CP3 controllers don't support that. @@ -129,8 +129,8 @@ bool LX200AstroPhysicsV2::initProperties() initRateLabels(); // Home button for clutch aware mounts with encoders. - IUFillSwitch(&HomeAndReSyncS[0], "Home and ReSync", "Home and ReSync", ISS_OFF); - IUFillSwitchVector(&HomeAndReSyncSP, HomeAndReSyncS, 1, getDeviceName(), "HOME_AND_RESYNC", + IUFillSwitch(&HomeAndReSyncS[0], "GO", "Home and ReSync", ISS_OFF); + IUFillSwitchVector(&HomeAndReSyncSP, HomeAndReSyncS, 1, getDeviceName(), "TELESCOPE_HOME", "HomeAndReSync", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); // Manual-set-mount-to-parked button for recovering from issues. @@ -996,7 +996,7 @@ bool LX200AstroPhysicsV2::ReadScopeStatus() apInitializationChecked ? "Y" : "N", apIsInitialized ? "Y" : "N", apTimeInitialized ? "Y" : "N", apLocationInitialized ? "Y" : "N"); - // hope this return doen't delay the time & location. If it does return true? + // hope this return doesn't delay the time & location. If it does return true? return false; } double lng = LocationN[LOCATION_LONGITUDE].value; @@ -1069,7 +1069,7 @@ bool LX200AstroPhysicsV2::ReadScopeStatus() LOGF_DEBUG("Slewing... currentRA: %.3f dx: %g currentDE: %.3f dy: %g", currentRA, dx, currentDEC, dy); - // Note, RA won't hit 0 if it's not tracking, becuase the RA changes when still. + // Note, RA won't hit 0 if it's not tracking, because the RA changes when still. // Dec might, though. // 0 might work now that I "fixed" slewing...perhaps not when tracking is off. if (dx < 1e-3 && dy < 1e-3) @@ -1532,7 +1532,7 @@ bool LX200AstroPhysicsV2::isAPReady() { bool isAPParked = apStatusParked(statusString); - // A-P came up unitialized, but we can now fix. + // A-P came up uninitialized, but we can now fix. if (APUnParkMount(PortFD) != TTY_OK) // Try again if we had a comm failure. commWorked = APUnParkMount(PortFD) == TTY_OK; diff --git a/drivers/telescope/lx200apdriver.cpp b/drivers/telescope/lx200apdriver.cpp index 8b82bae3b0..5b7a31315d 100644 --- a/drivers/telescope/lx200apdriver.cpp +++ b/drivers/telescope/lx200apdriver.cpp @@ -773,7 +773,7 @@ int selectAPV2CenterRate(int fd, int centerIndex, APRateTableState rateTable) // 'C'=Custom RA Tracking Rate (read specific value with :Rr# command) // C: Dec Tracking Status '9'=No Motion (to mimic RA Tracking), 'C'=Custom DEC Tracking Rate // (read specific value with :Rd# command) -// D: Slewing Satus (GOTO Slews) 'S'=Slewing, '0'=Not slewing +// D: Slewing Status (GOTO Slews) 'S'=Slewing, '0'=Not slewing // E: Moving RA Axis 'E'=Moving East, 'W'=Moving West, '0'=Not Moving // (via a Move command/Slew/ST4 Port signal) // F: Moving Dec Axis 'N'=Moving North (counter-clockwise), 'S'=Moving South (clockwise), '0'=Not Moving @@ -840,7 +840,7 @@ int getApStatusStringInternal(int fd, char *statusString, bool complain) int getApStatusString(int fd, char *statusString) { - // I seem to get intermittant failures. + // I seem to get intermittent failures. // Try again on these after a 50ms delay, and the 250ms delay. if (getApStatusStringInternal(fd, statusString, false) != TTY_OK) { diff --git a/drivers/telescope/lx200basic.cpp b/drivers/telescope/lx200basic.cpp index c62c84764c..13172ae88b 100644 --- a/drivers/telescope/lx200basic.cpp +++ b/drivers/telescope/lx200basic.cpp @@ -350,7 +350,7 @@ void LX200Basic::mountSim() ltv = tv; da = SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_TRACKING: diff --git a/drivers/telescope/lx200classic.cpp b/drivers/telescope/lx200classic.cpp index 987d3d9842..75b391dcd9 100644 --- a/drivers/telescope/lx200classic.cpp +++ b/drivers/telescope/lx200classic.cpp @@ -522,7 +522,7 @@ bool LX200Classic::ReadScopeStatus() { //allow scope to make internal state change to settled on target. //otherwise changing to landmode slews the scope to same - //coordinates intepreted in landmode. + //coordinates interpreted in landmode. //Between isSlewComplete() and the beep there is nearly 3 seconds! settling = 3; //n iterations of default 1000ms } diff --git a/drivers/telescope/lx200driver.cpp b/drivers/telescope/lx200driver.cpp index 6d26e6b903..8dad342f39 100644 --- a/drivers/telescope/lx200driver.cpp +++ b/drivers/telescope/lx200driver.cpp @@ -663,7 +663,7 @@ int getTrackFreq(int fd, double *value) // :GT# // Get tracking rate // Returns: TT.T# - // Current Track Frequency expressed in hertz assuming a synchonous motor design where a 60.0 Hz motor clock + // Current Track Frequency expressed in hertz assuming a synchronous motor design where a 60.0 Hz motor clock // would produce 1 revolution of the telescope in 24 hours. if ((error_type = tty_write_string(fd, ":GT#", &nbytes_write)) != TTY_OK) return error_type; @@ -1131,7 +1131,7 @@ int setCalenderDate(int fd, int dd, int mm, int yy, bool addSpace) return error_type; error_type = tty_nread_section(fd, read_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); - // Read the next section whih has 24 blanks and then a # + // Read the next section which has 24 blanks and then a # // Can't just use the tcflush to clear the stream because it doesn't seem to work correctly on sockets tty_nread_section(fd, dummy_buffer, RB_MAX_LEN, '#', LX200_TIMEOUT, &nbytes_read); @@ -2041,7 +2041,7 @@ int checkLX200EquatorialFormat(int fd) // 10Micron Mount Command Protocol software version 2.14.11 2016.11 // :U# // Toggle between low and high precision modes. This controls the format of some values - // that are returned by the mount. In extened LX200 emulation mode, switches always to + // that are returned by the mount. In extended LX200 emulation mode, switches always to // high precision (does not toggle). // Low precision: RA returned as HH:MM.T (hours, minutes and tenths of minutes), // Dec/Az/Alt returned as sDD*MM (sign, degrees, arcminutes). diff --git a/drivers/telescope/lx200driver.h b/drivers/telescope/lx200driver.h index 0d1d225d13..a2272513ec 100644 --- a/drivers/telescope/lx200driver.h +++ b/drivers/telescope/lx200driver.h @@ -145,7 +145,7 @@ enum TFreq #define setFocuserSpeed(fd, x) setCommandInt(fd, x, ":F") #define setSlewSpeed(fd, x) setCommandInt(fd, x, ":Sw") -/* GPS Specefic */ +/* GPS Specific */ #define turnGPSOn(fd) write(fd, ":g+#", 4) #define turnGPSOff(fd) write(fd, ":g-#", 4) #define alignGPSScope(fd) write(fd, ":Aa#", 4) @@ -175,7 +175,7 @@ enum TFreq #define initTelescope(fd) write(fd, ":I#", 3) /************************************************************************** - Basic I/O - OBSELETE + Basic I/O - OBSOLETE **************************************************************************/ /*int openPort(const char *portID); int portRead(char *buf, int nbytes, int timeout); @@ -212,7 +212,7 @@ int getSiteLongitude(int fd, int *ddd, int *mm, double *ssf); int getSiteLatitudeAlt(int fd, int *dd, int *mm, double *ssf, const char *cmd); /* Get site Longitude */ int getSiteLongitudeAlt(int fd, int *ddd, int *mm, double *ssf, const char *cmd); -/* Get Calender data */ +/* Get Calendar data */ int getCalendarDate(int fd, char *date); /* Get site Name */ int getSiteName(int fd, char *siteName, int siteNum); @@ -245,7 +245,7 @@ int setAlignmentMode(int fd, unsigned int alignMode); int setObjectRA(int fd, double ra, bool addSpace = false); /* set Object DEC */ int setObjectDEC(int fd, double dec, bool addSpace = false); -/* Set Calender date */ +/* Set Calendar date */ int setCalenderDate(int fd, int dd, int mm, int yy, bool addSpace = false); /* Set UTC offset */ int setUTCOffset(int fd, double hours); diff --git a/drivers/telescope/lx200fs2.cpp b/drivers/telescope/lx200fs2.cpp index 55c95b0d8d..177e7bced2 100644 --- a/drivers/telescope/lx200fs2.cpp +++ b/drivers/telescope/lx200fs2.cpp @@ -359,7 +359,7 @@ bool LX200FS2::SetCurrentPark() bool LX200FS2::SetDefaultPark() { - // By defualt azimuth 0 + // By default azimuth 0 SetAxis1Park(0); // Altitude = latitude of observer diff --git a/drivers/telescope/lx200generic.cpp b/drivers/telescope/lx200generic.cpp index 40e6ecdfc2..f3785448cc 100644 --- a/drivers/telescope/lx200generic.cpp +++ b/drivers/telescope/lx200generic.cpp @@ -52,7 +52,7 @@ Updated driver to use INDI::Telescope (JM) /* There is _one_ binary for all LX200 drivers, but each binary is renamed ** to its device name (i.e. lx200gps, lx200_16..etc). The main function will - ** fetch from std args the binary name and ISInit will create the apporpiate + ** fetch from std args the binary name and ISInit will create the appropriate ** device afterwards. If the binary name does not match any known devices, ** we simply create a generic device. */ diff --git a/drivers/telescope/lx200gotonova.cpp b/drivers/telescope/lx200gotonova.cpp index a0d3c39656..987597a7b6 100644 --- a/drivers/telescope/lx200gotonova.cpp +++ b/drivers/telescope/lx200gotonova.cpp @@ -777,7 +777,7 @@ void LX200GotoNova::mountSim() ltv = tv; da = SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_TRACKING: diff --git a/drivers/telescope/lx200pulsar2.cpp b/drivers/telescope/lx200pulsar2.cpp index 75400a0075..bd3681903e 100644 --- a/drivers/telescope/lx200pulsar2.cpp +++ b/drivers/telescope/lx200pulsar2.cpp @@ -700,7 +700,7 @@ bool setHomePosition(const int fd, double hp_alt, double hp_az) double safe_hp_alt = std::min(std::max(0.0, hp_alt), 90.0); // There are odd limits for azimuth because the controller rounds // strangely, and defaults to a 180-degree value if it sees a number - // as out-of-bounds. The min value here (0.0004) will be intepreted + // as out-of-bounds. The min value here (0.0004) will be interpreted // as zero, max (359.9994) as 360. double safe_hp_az = std::min(std::max(0.0004, hp_az), 359.9994); sprintf(cmd, "#:YSX%+08.4lf,%08.4lf#", safe_hp_alt, safe_hp_az); diff --git a/drivers/telescope/lx200telescope.cpp b/drivers/telescope/lx200telescope.cpp index e8e79f6ce3..c7a1139bd5 100644 --- a/drivers/telescope/lx200telescope.cpp +++ b/drivers/telescope/lx200telescope.cpp @@ -1076,7 +1076,7 @@ void LX200Telescope::mountSim() ltv = tv; da = LX200_GENERIC_SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { diff --git a/drivers/telescope/lx200telescope.h b/drivers/telescope/lx200telescope.h index 91776ddda8..0ab70a5223 100644 --- a/drivers/telescope/lx200telescope.h +++ b/drivers/telescope/lx200telescope.h @@ -121,7 +121,7 @@ class LX200Telescope : public INDI::Telescope, public INDI::GuiderInterface, pub // Initial function to get data after connection is successful virtual void getBasicData(); - // Get local calender date (NOT UTC) from mount. Expected format is YYYY-MM-DD + // Get local calendar date (NOT UTC) from mount. Expected format is YYYY-MM-DD virtual bool getLocalDate(char *dateString); virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years); diff --git a/drivers/telescope/lx200zeq25.cpp b/drivers/telescope/lx200zeq25.cpp index 39cee4ba1d..1c1a1d7619 100644 --- a/drivers/telescope/lx200zeq25.cpp +++ b/drivers/telescope/lx200zeq25.cpp @@ -72,8 +72,8 @@ bool LX200ZEQ25::initProperties() // 64x is the default SlewRateS[4].s = ISS_ON; - IUFillSwitch(&HomeS[0], "Home", "", ISS_OFF); - IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "Home", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, + IUFillSwitch(&HomeS[0], "GO", "Go", ISS_OFF); + IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "TELESCOPE_HOME", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE); /* How fast do we guide compared to sidereal rate */ @@ -1226,7 +1226,7 @@ void LX200ZEQ25::mountSim() ltv = tv; da = SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_TRACKING: diff --git a/drivers/telescope/magellan1.h b/drivers/telescope/magellan1.h index 05f2bd6511..ee4eae230c 100644 --- a/drivers/telescope/magellan1.h +++ b/drivers/telescope/magellan1.h @@ -24,7 +24,7 @@ #include "indidevapi.h" /* - The device name below eventhough we have a Magellan I + The device name below even though we have a Magellan I should remain set to a KStars registered telescope so It allows the service to be stopped */ diff --git a/drivers/telescope/magellandriver.h b/drivers/telescope/magellandriver.h index 518a1d7a05..6c50f15a3b 100644 --- a/drivers/telescope/magellandriver.h +++ b/drivers/telescope/magellandriver.h @@ -67,7 +67,7 @@ int check_magellan_connection(int fd); /* Get Double from Sexagisemal */ int getCommandSexa(int fd, double *value, const char *cmd); -/* Get Calender data */ +/* Get Calendar data */ int getCalendarDate(int fd, char *date); #ifdef __cplusplus diff --git a/drivers/telescope/paramount.cpp b/drivers/telescope/paramount.cpp index b11f8a390a..bc5019e721 100644 --- a/drivers/telescope/paramount.cpp +++ b/drivers/telescope/paramount.cpp @@ -132,7 +132,7 @@ bool Paramount::initProperties() // Homing IUFillSwitch(&HomeS[0], "GO", "Go", ISS_OFF); - IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "TELESCOPE_HOME", "Homing", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, + IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "TELESCOPE_HOME", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); // Tracking Mode AddTrackMode("TRACK_SIDEREAL", "Sidereal", true); @@ -224,7 +224,7 @@ bool Paramount::updateProperties() * * |No error. Error = 0. * -* This is true everwhere except for the Handshake(), which just returns "1" on success. +* This is true everywhere except for the Handshake(), which just returns "1" on success. * * In order to know when the response is complete, we append the # character in * Javascript commands and read from the port until the # character is reached. @@ -886,7 +886,7 @@ void Paramount::mountSim() return; } - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_IDLE: diff --git a/drivers/telescope/planewave_mount.cpp b/drivers/telescope/planewave_mount.cpp index e2cea26f4a..57eae39655 100644 --- a/drivers/telescope/planewave_mount.cpp +++ b/drivers/telescope/planewave_mount.cpp @@ -22,7 +22,7 @@ #include "planewave_mount.h" #include "indicom.h" -#include "httplib.h" +#include #include "connectionplugins/connectiontcp.h" #include #include diff --git a/drivers/telescope/planewave_mount.h b/drivers/telescope/planewave_mount.h index 38f8cc7f90..22cd53793e 100644 --- a/drivers/telescope/planewave_mount.h +++ b/drivers/telescope/planewave_mount.h @@ -104,6 +104,6 @@ class PlaneWave : public INDI::Telescope static const char DRIVER_STOP_CHAR { 0xA }; // Wait up to a maximum of 3 seconds for serial input static constexpr const uint8_t DRIVER_TIMEOUT {3}; - // Maximum buffer for sending/receving. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {128}; }; diff --git a/drivers/telescope/pmc8.cpp b/drivers/telescope/pmc8.cpp index acce1d5f56..594613ee25 100644 --- a/drivers/telescope/pmc8.cpp +++ b/drivers/telescope/pmc8.cpp @@ -313,7 +313,7 @@ void PMC8::getStartupData() LOG_INFO("Be prepared to intervene if something unexpected occurs."); #if 0 - // FIXEME - Need to handle southern hemisphere for DEC? + // FIXME - Need to handle southern hemisphere for DEC? double HA = ln_get_apparent_sidereal_time(ln_get_julian_from_sys()); double DEC = CurrentDEC; @@ -1392,7 +1392,7 @@ void PMC8::mountSim() ltv = tv; da = SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_IDLE: diff --git a/drivers/telescope/pmc8driver.cpp b/drivers/telescope/pmc8driver.cpp index 2c4cf1d64b..1fcf1d53a3 100644 --- a/drivers/telescope/pmc8driver.cpp +++ b/drivers/telescope/pmc8driver.cpp @@ -1653,7 +1653,7 @@ bool convert_motor_to_radec(int racounts, int deccounts, double &ra_value, doubl else dec_value = 90 + motor_angle; } - // Sourthern Hemisphere + // Southern Hemisphere else { if (motor_angle >= 0) diff --git a/drivers/telescope/pmc8driver.h b/drivers/telescope/pmc8driver.h index 1d79fbfe0b..50d23199f6 100755 --- a/drivers/telescope/pmc8driver.h +++ b/drivers/telescope/pmc8driver.h @@ -113,7 +113,7 @@ bool get_pmc8_reconnect_flag(); **************************************************************************/ /** Get PMC8 current status info */ bool get_pmc8_status(int fd, PMC8Info *info); -/** Get All firmware informatin in addition to mount model */ +/** Get All firmware information in addition to mount model */ bool get_pmc8_firmware(int fd, FirmwareInfo *info); /** Get RA/DEC */ bool get_pmc8_coords(int fd, double &ra, double &dec); diff --git a/drivers/telescope/rainbow.cpp b/drivers/telescope/rainbow.cpp index 871375e267..bd73afea2d 100644 --- a/drivers/telescope/rainbow.cpp +++ b/drivers/telescope/rainbow.cpp @@ -66,8 +66,8 @@ bool Rainbow::initProperties() SetParkDataType(PARK_AZ_ALT); // Homing - IUFillSwitch(&HomeS[0], "HOME", "Go Home", ISS_OFF); - IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "HOME", "Homing", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, + IUFillSwitch(&HomeS[0], "GO", "Go", ISS_OFF); + IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "TELESCOPE_HOME", "Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); // Star Alignment on Sync diff --git a/drivers/telescope/rainbow.h b/drivers/telescope/rainbow.h index 8f5b070a1a..1c7f214a18 100644 --- a/drivers/telescope/rainbow.h +++ b/drivers/telescope/rainbow.h @@ -208,6 +208,6 @@ class Rainbow : public INDI::Telescope, public INDI::GuiderInterface 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. + // Maximum buffer for sending/receiving. static constexpr const uint8_t DRIVER_LEN {64}; }; diff --git a/drivers/telescope/scopesim_helper.cpp b/drivers/telescope/scopesim_helper.cpp index 092250c036..b0fef8bb77 100644 --- a/drivers/telescope/scopesim_helper.cpp +++ b/drivers/telescope/scopesim_helper.cpp @@ -283,7 +283,7 @@ void Alignment::apparentHaDecToMount(Angle apparentHa, Angle apparentDec, Angle* LOGF_EXTRA1("a2M haDec %f, %f Azm Alt %f, %f", apparentHa.Degrees(), apparentDec.Degrees(), primary->Degrees(), secondary->Degrees() ); } - // ignore diurnal abberations and refractions to get observed ha, dec + // ignore diurnal aberrations and refractions to get observed ha, dec // apply telescope pointing to get instrument Angle instrumentHa, instrumentDec; observedToInstrument(apparentHa, apparentDec, &instrumentHa, &instrumentDec); diff --git a/drivers/telescope/scopesim_helper.h b/drivers/telescope/scopesim_helper.h index 64f3f8c29d..2a3242729f 100644 --- a/drivers/telescope/scopesim_helper.h +++ b/drivers/telescope/scopesim_helper.h @@ -394,7 +394,7 @@ class Axis /// Observed Place These are the mount coordinates for a perfect mount, positions are observedHa and observedDec /// apply telescope pointing corrections /// Instrument Place these are the mount coordinates for the mount with corrections, values are instrumentHa and instrumentDec -/// for a GEM convert to axis cooordinates ( this isn't in the paper). +/// for a GEM convert to axis coordinates ( this isn't in the paper). /// Mount Place these give primary (ha) and secondary (dec) positions /// /// At present AltAz mounts are not implemented @@ -583,7 +583,7 @@ class Vector Vector(double l, double m, double n); /// - /// \brief Vector creats a vector from two angles (Ra, Dec), (Ha, Dec), (Azimuth, Altitude) + /// \brief Vector creates a vector from two angles (Ra, Dec), (Ha, Dec), (Azimuth, Altitude) /// \param primary /// \param secondary /// diff --git a/drivers/telescope/skywatcherAPI.h b/drivers/telescope/skywatcherAPI.h index a5f0c8c5b4..a6cd2e1ad7 100644 --- a/drivers/telescope/skywatcherAPI.h +++ b/drivers/telescope/skywatcherAPI.h @@ -318,7 +318,7 @@ class SkywatcherAPI /// \return false failure bool SlowStop(AXISID Axis); - /// \brief Start the axis slewing in the prevously selected mode + /// \brief Start the axis slewing in the previously selected mode /// \param[in] Axis - The axis to use. /// \return false failure bool StartAxisMotion(AXISID Axis); diff --git a/drivers/telescope/synscandriver.cpp b/drivers/telescope/synscandriver.cpp index 3ecb6e6782..1e50e9210c 100644 --- a/drivers/telescope/synscandriver.cpp +++ b/drivers/telescope/synscandriver.cpp @@ -266,7 +266,7 @@ bool SynscanDriver::ISNewNumber(const char * dev, const char * name, double valu return true; } - // Horizonal Coords + // Horizontal Coords if (!strcmp(name, HorizontalCoordsNP.name)) { if (isParked()) @@ -1298,7 +1298,7 @@ void SynscanDriver::mountSim() double currentSlewRate = SIM_SLEW_RATE[IUFindOnSwitchIndex(&SlewRateSP)] * TRACKRATE_SIDEREAL / 3600.0; da = currentSlewRate * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_IDLE: @@ -1442,7 +1442,7 @@ IPState SynscanDriver::GuideEast(uint32_t ms) // So if we SID_RATE + 0.5 * SID_RATE for example, that's 150% of sidereal rate // but for east we'd be going a lot faster since the stars are moving toward the west - // in sideral rate. Just standing still we would SID_RATE moving across. So for east + // in sidereal rate. Just standing still we would SID_RATE moving across. So for east // we just go GuideRate * SID_RATE without adding any more values. //m_CustomGuideRA = TRACKRATE_SIDEREAL + GuideRateN[AXIS_RA].value * TRACKRATE_SIDEREAL; m_CustomGuideRA = GuideRateN[AXIS_RA].value * TRACKRATE_SIDEREAL; diff --git a/drivers/telescope/synscandriver.h b/drivers/telescope/synscandriver.h index 5ae9798862..177b2c6a53 100644 --- a/drivers/telescope/synscandriver.h +++ b/drivers/telescope/synscandriver.h @@ -79,9 +79,9 @@ class SynscanDriver : public INDI::Telescope, public INDI::GuiderInterface * @brief sendCommand Send a string command to mount. * @param cmd Command to be sent * @param cmd_len length of command in bytes. If not specified it is treated as null-terminating string - * @param res If not nullptr, the function will read until it detects the default delimeter ('#') up to SYN_RES length. + * @param res If not nullptr, the function will read until it detects the default delimiter ('#') up to SYN_RES length. * if nullptr, no read back is done and the function returns true. - * @param res_len length of buffer to read. If not specified, the buffer will be read until the delimeter is met. + * @param res_len length of buffer to read. If not specified, the buffer will be read until the delimiter is met. * if specified, only res_len bytes are ready. * @return True if successful, false otherwise. */ @@ -184,7 +184,7 @@ class SynscanDriver : public INDI::Telescope, public INDI::GuiderInterface static const uint8_t SYN_RES = 64; // Timeout static const uint8_t SYN_TIMEOUT = 3; - // Delimeter + // Delimiter static const char SYN_DEL = {'#'}; // Mount Information Tab static constexpr const char * MOUNT_TAB = "Mount Information"; diff --git a/drivers/telescope/synscandriverlegacy.cpp b/drivers/telescope/synscandriverlegacy.cpp index c76a934219..4dcd4584e6 100644 --- a/drivers/telescope/synscandriverlegacy.cpp +++ b/drivers/telescope/synscandriverlegacy.cpp @@ -1530,7 +1530,7 @@ void SynscanLegacyDriver::MountSim() double currentSlewRate = SLEW_RATE[IUFindOnSwitchIndex(&SlewRateSP)] * TRACKRATE_SIDEREAL / 3600.0; da = currentSlewRate * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { case SCOPE_IDLE: diff --git a/drivers/telescope/telescope_simulator.cpp b/drivers/telescope/telescope_simulator.cpp index e4422674f4..e4a5900f0d 100644 --- a/drivers/telescope/telescope_simulator.cpp +++ b/drivers/telescope/telescope_simulator.cpp @@ -47,7 +47,7 @@ ScopeSim::ScopeSim() /* initialize random seed: */ srand(static_cast(time(nullptr))); - // initalise axis positions, for GEM pointing at pole, counterweight down + // initialise axis positions, for GEM pointing at pole, counterweight down axisPrimary.setDegrees(90.0); axisPrimary.TrackRate(Axis::SIDEREAL); axisSecondary.setDegrees(90.0); @@ -568,7 +568,7 @@ bool ScopeSim::SetCurrentPark() bool ScopeSim::SetDefaultPark() { - // mount points to East (couter weights down) at the horizon + // mount points to East (counterweights down) at the horizon // works for both hemispheres SetAxis1Park(-6.); SetAxis2Park(0.); diff --git a/drivers/telescope/telescope_simulator.h b/drivers/telescope/telescope_simulator.h index 9cd5be7542..65fa9333f3 100644 --- a/drivers/telescope/telescope_simulator.h +++ b/drivers/telescope/telescope_simulator.h @@ -28,9 +28,9 @@ * @brief The ScopeSim class provides a simple mount simulator of an equatorial mount. * * It supports the following features: - * + Sideral and Custom Tracking rates. + * + Sidereal and Custom Tracking rates. * + Goto & Sync - * + NWSE Hand controller direciton key slew. + * + NWSE Hand controller direction key slew. * + Tracking On/Off. * + Parking & Unparking with custom parking positions. * + Setting Time & Location. diff --git a/drivers/telescope/temmadriver.cpp b/drivers/telescope/temmadriver.cpp index 7c9a2ffd89..5eee7f3bdd 100644 --- a/drivers/telescope/temmadriver.cpp +++ b/drivers/telescope/temmadriver.cpp @@ -193,7 +193,7 @@ bool TemmaMount::updateProperties() defineProperty(&GuideNSNP); defineProperty(&GuideWENP); - // Load location so that it could trigger mount initiailization + // Load location so that it could trigger mount initialization loadConfig(true, "GEOGRAPHIC_COORD"); } @@ -489,9 +489,9 @@ bool TemmaMount::Sync(double ra, double dec) targetDEC = dec; /* sync involves jumping thru considerable hoops - first we have to set local sideral time + first we have to set local sidereal time then we have to send a Z - then we set local sideral time again + then we set local sidereal time again and finally we send the co-ordinates we are syncing on */ LOG_DEBUG("Sending LST --> Z --> LST before Sync."); @@ -539,7 +539,7 @@ bool TemmaMount::Goto(double ra, double dec) targetDEC = dec; /* goto involves hoops, but, not as many as a sync - first set sideral time + first set sidereal time then issue the goto command */ if (MotorStatus == false) @@ -992,7 +992,7 @@ INDI::IEquatorialCoordinates TemmaMount::SkyToTelescope(double ra, double dec) // to using raw co-ordinates from the mount if (TransformCelestialToTelescope(ra, dec, 0.0, TDV)) { - /* Initial attemp, using RA/DEC co-ordinates talking to alignment system + /* Initial attempt, using RA/DEC co-ordinates talking to alignment system EquatorialCoordinatesFromTelescopeDirectionVector(TDV,eq); RightAscension=eq.ra*24.0/360; Declination=eq.dec; @@ -1292,7 +1292,7 @@ void TemmaMount::mountSim() ltv = tv; da = TEMMA_SLEWRATE * dt; - /* Process per current state. We check the state of EQUATORIAL_COORDS and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */ switch (TrackState) { diff --git a/drivers/video/v4l2driver.cpp b/drivers/video/v4l2driver.cpp index c13500ff58..e87230460b 100644 --- a/drivers/video/v4l2driver.cpp +++ b/drivers/video/v4l2driver.cpp @@ -333,7 +333,7 @@ bool V4L2_Driver::updateProperties() std::string infoDeviceLabel = std::string(info->deviceLabel); std::transform(infoDeviceLabel.begin(), infoDeviceLabel.end(), infoDeviceLabel.begin(), ::tolower); - // Case insensitive comparision + // Case insensitive comparison if (infoDeviceName == deviceName || infoDeviceLabel == deviceName) break; ++info; @@ -852,7 +852,7 @@ bool V4L2_Driver::ISNewNumber(const char * dev, const char * name, double values LOGF_WARN("Unable to adjust %s (ctrl_id = 0x%X)", ImageAdjustNP.np[i].label, ctrl_id); } - /* Some controls may have been ajusted by the driver */ + /* Some controls may have been adjusted by the driver */ /* a read is mandatory as VIDIOC_S_CTRL is write only and does not return the actual new value */ v4l_base->getControl(ctrl_id, &(ImageAdjustNP.np[i].value), errmsg); @@ -1739,7 +1739,7 @@ bool V4L2_Driver::Connect() return false; } - /* Sucess! */ + /* Success! */ LOGF_INFO("%s is online.", getDeviceName()); // If port not stored in config already then save it. diff --git a/drivers/video/v4l2driver.h b/drivers/video/v4l2driver.h index d2a2ede28c..1b4917e09c 100644 --- a/drivers/video/v4l2driver.h +++ b/drivers/video/v4l2driver.h @@ -157,7 +157,7 @@ class V4L2_Driver : public INDI::CCD INumber *AbsExposureN; ISwitchVectorProperty *ManualExposureSP; - /* Initilization functions */ + /* Initialization functions */ //virtual void connectCamera(); virtual void getBasicData(); bool getPixelFormat(uint32_t v4l2format, INDI_PIXEL_FORMAT &pixelFormat, uint8_t &pixelDepth); diff --git a/drivers/weather/CMakeLists.txt b/drivers/weather/CMakeLists.txt index a2e659ec96..f887a09095 100644 --- a/drivers/weather/CMakeLists.txt +++ b/drivers/weather/CMakeLists.txt @@ -27,7 +27,7 @@ install(TARGETS indi_watcher_weather RUNTIME DESTINATION bin) SET(weathersafetyproxy_SRC weather_safety_proxy.cpp) add_executable(indi_weather_safety_proxy ${weathersafetyproxy_SRC}) -target_link_libraries(indi_weather_safety_proxy indidriver ${CURL}) +target_link_libraries(indi_weather_safety_proxy indidriver ${CURL} ${JSONLIB}) install(TARGETS indi_weather_safety_proxy RUNTIME DESTINATION bin) # ########## MBox Driver ############### @@ -63,5 +63,5 @@ IF(UNITY_BUILD) ENDIF() add_executable(indi_openweathermap_weather ${OpenWeatherMap_SRC}) -target_link_libraries(indi_openweathermap_weather indidriver ${CURL}) +target_link_libraries(indi_openweathermap_weather indidriver ${CURL} ${JSONLIB}) install(TARGETS indi_openweathermap_weather RUNTIME DESTINATION bin) diff --git a/drivers/weather/mbox.cpp b/drivers/weather/mbox.cpp index 2ad7956b1e..b832d5f653 100644 --- a/drivers/weather/mbox.cpp +++ b/drivers/weather/mbox.cpp @@ -220,7 +220,7 @@ MBox::AckResponse MBox::ack() return ACK_ERROR; } - // Read again if we only recieved a newline character + // Read again if we only received a newline character if (response[0] == '\n') { if ((rc = tty_read_section(PortFD, response, 0xA, MBOX_TIMEOUT, &nbytes_read)) != TTY_OK) diff --git a/drivers/weather/openweathermap.cpp b/drivers/weather/openweathermap.cpp index 1a7455a2a6..c275c2af64 100644 --- a/drivers/weather/openweathermap.cpp +++ b/drivers/weather/openweathermap.cpp @@ -26,7 +26,12 @@ #include "openweathermap.h" -#include "json.h" +#ifdef _USE_SYSTEM_JSONLIB +#include +#else +#include +#endif + #include "locale_compat.h" #include diff --git a/drivers/weather/vantage.cpp b/drivers/weather/vantage.cpp index cc7e459fbc..a39b14bea8 100644 --- a/drivers/weather/vantage.cpp +++ b/drivers/weather/vantage.cpp @@ -296,7 +296,7 @@ bool Vantage::wakeup() if ((rc = tty_write(PortFD, command, 1, &nbytes_written)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR("Wakup error: %s.", errstr); + LOGF_ERROR("Wakeup error: %s.", errstr); return false; } diff --git a/drivers/weather/weather_safety_proxy.cpp b/drivers/weather/weather_safety_proxy.cpp index 45bff43736..19536d38e1 100644 --- a/drivers/weather/weather_safety_proxy.cpp +++ b/drivers/weather/weather_safety_proxy.cpp @@ -28,7 +28,12 @@ #include #include -#include "json.h" +#ifdef _USE_SYSTEM_JSONLIB +#include +#else +#include +#endif + #include "weather_safety_proxy.h" using json = nlohmann::json; diff --git a/examples/README b/examples/README index b992fd9858..23e14d1158 100644 --- a/examples/README +++ b/examples/README @@ -58,7 +58,7 @@ $ indiserver -v -p 8000 ./tutorial_four Now Tutorial Four shall run and load the Skeleton file. Usually skeleton files for drivers are stored under /usr/share/indi/ and end with _sk.xml ------------------------------------------------------------------------------------------ -For the inter-driver communications tutorial where it shows have a dome driver and a rain detector driver share information between each other, type the folliwng: +For the inter-driver communications tutorial where it shows have a dome driver and a rain detector driver share information between each other, type the following: $ indiserver -v -p 8000 ./tutorial_dome ./tutorial_rain diff --git a/examples/tutorial_eight/simple_receiver.cpp b/examples/tutorial_eight/simple_receiver.cpp index dd891e95ad..63a6989e0d 100644 --- a/examples/tutorial_eight/simple_receiver.cpp +++ b/examples/tutorial_eight/simple_receiver.cpp @@ -81,7 +81,7 @@ bool SimpleReceiver::initProperties() /******************************************************************************************** ** INDI is asking us to update the properties because there is a change in CONNECTION status -** This fucntion is called whenever the device is connected or disconnected. +** This function is called whenever the device is connected or disconnected. *********************************************************************************************/ bool SimpleReceiver::updateProperties() { @@ -232,7 +232,7 @@ void SimpleReceiver::TimerHit() /* If target temperature is higher, then increase current Receiver temperature */ if (currentReceiverTemperature < TemperatureRequest) currentReceiverTemperature++; - /* If target temperature is lower, then decrese current Receiver temperature */ + /* If target temperature is lower, then decrease current Receiver temperature */ else if (currentReceiverTemperature > TemperatureRequest) currentReceiverTemperature--; /* If they're equal, stop updating */ diff --git a/examples/tutorial_five/dome.cpp b/examples/tutorial_five/dome.cpp index 4a885d3702..73e254d38a 100644 --- a/examples/tutorial_five/dome.cpp +++ b/examples/tutorial_five/dome.cpp @@ -113,7 +113,7 @@ bool Dome::initProperties() /******************************************************************************************** ** INDI is asking us to update the properties because there is a change in CONNECTION status -** This fucntion is called whenever the device is connected or disconnected. +** This function is called whenever the device is connected or disconnected. *********************************************************************************************/ bool Dome::updateProperties() { diff --git a/examples/tutorial_five/raindetector.cpp b/examples/tutorial_five/raindetector.cpp index f4ae97a7c6..7a2e5b08f0 100644 --- a/examples/tutorial_five/raindetector.cpp +++ b/examples/tutorial_five/raindetector.cpp @@ -84,7 +84,7 @@ bool RainDetector::initProperties() /******************************************************************************************** ** INDI is asking us to update the properties because there is a change in CONNECTION status -** This fucntion is called whenever the device is connected or disconnected. +** This function is called whenever the device is connected or disconnected. *********************************************************************************************/ bool RainDetector::updateProperties() { diff --git a/examples/tutorial_six/tutorial_client.cpp b/examples/tutorial_six/tutorial_client.cpp index 7c2430bfed..c9fa9cf7b4 100644 --- a/examples/tutorial_six/tutorial_client.cpp +++ b/examples/tutorial_six/tutorial_client.cpp @@ -91,7 +91,7 @@ MyClient::MyClient() // call lambda function if property changed property.onUpdate([property, this]() { - IDLog("Receving new CCD Temperature: %g C\n", property[0].getValue()); + IDLog("Receiving new CCD Temperature: %g C\n", property[0].getValue()); if (property[0].getValue() == -20) { IDLog("CCD temperature reached desired value!\n"); diff --git a/examples/tutorial_three/simpleccd.cpp b/examples/tutorial_three/simpleccd.cpp index 372bb474d2..fcbf0eb3cf 100644 --- a/examples/tutorial_three/simpleccd.cpp +++ b/examples/tutorial_three/simpleccd.cpp @@ -80,7 +80,7 @@ bool SimpleCCD::initProperties() /******************************************************************************************** ** INDI is asking us to update the properties because there is a change in CONNECTION status -** This fucntion is called whenever the device is connected or disconnected. +** This function is called whenever the device is connected or disconnected. *********************************************************************************************/ bool SimpleCCD::updateProperties() { @@ -201,7 +201,7 @@ void SimpleCCD::TimerHit() /* If target temperature is higher, then increase current CCD temperature */ if (currentCCDTemperature < TemperatureRequest) currentCCDTemperature++; - /* If target temperature is lower, then decrese current CCD temperature */ + /* If target temperature is lower, then decrease current CCD temperature */ else if (currentCCDTemperature > TemperatureRequest) currentCCDTemperature--; /* If they're equal, stop updating */ diff --git a/examples/tutorial_two/simplescope.cpp b/examples/tutorial_two/simplescope.cpp index d9a6b6b6f7..f7dd39f26a 100644 --- a/examples/tutorial_two/simplescope.cpp +++ b/examples/tutorial_two/simplescope.cpp @@ -42,7 +42,7 @@ bool SimpleScope::initProperties() // ALWAYS call initProperties() of parent first INDI::Telescope::initProperties(); - // Add Debug control so end user can turn debugging/loggin on and off + // Add Debug control so end user can turn debugging/logging on and off addDebugControl(); // Enable simulation mode so that serial connection in INDI::Telescope does not try @@ -60,7 +60,7 @@ bool SimpleScope::initProperties() ***************************************************************************************/ bool SimpleScope::Handshake() { - // When communicating with a real mount, we check here if commands are receieved + // When communicating with a real mount, we check here if commands are received // and acknolowedged by the mount. For SimpleScope, we simply return true. return true; } @@ -133,11 +133,11 @@ bool SimpleScope::ReadScopeStatus() da_ra = SLEW_RATE * dt; da_dec = SLEW_RATE * dt; - /* Process per current state. We check the state of EQUATORIAL_EOD_COORDS_REQUEST and act acoordingly */ + /* Process per current state. We check the state of EQUATORIAL_EOD_COORDS_REQUEST and act accordingly */ switch (TrackState) { case SCOPE_SLEWING: - // Wait until we are "locked" into positon for both RA & DEC axis + // Wait until we are "locked" into position for both RA & DEC axis nlocked = 0; // Calculate diff in RA @@ -172,7 +172,7 @@ bool SimpleScope::ReadScopeStatus() else currentDEC -= da_dec; - // Let's check if we recahed position for both RA/DEC + // Let's check if we reached position for both RA/DEC if (nlocked == 2) { // Let's set state to TRACKING diff --git a/indiserver/indiserver.cpp b/indiserver/indiserver.cpp index 12420ee37d..c888b59508 100644 --- a/indiserver/indiserver.cpp +++ b/indiserver/indiserver.cpp @@ -451,7 +451,7 @@ class Msg friend class SerializedMsgWithSharedBuffer; friend class SerializedMsgWithoutSharedBuffer; private: - // Present for sure until message queing is doned. Prune asap then + // Present for sure until message queueing is doned. Prune asap then XMLEle * xmlContent; // Present until message was queued. @@ -476,7 +476,7 @@ class Msg void releaseSharedBuffers(const std::set &keep); // Remove resources that can be removed. - // Will be called when queuingDone is true and for every change of staus from convertionToXXX + // Will be called when queuingDone is true and for every change of status from convertionToXXX void prune(); void releaseSerialization(SerializedMsg * form); @@ -1949,7 +1949,7 @@ void DvrInfo::onMessage(XMLEle * root, std::list &sharedBuffers) /* send to interested chained servers upstream */ // FIXME: no use of root here ClInfo::q2Servers(this, mp, root); - /* Send to snooped drivers if they exist so that they can echo back the snooped propertly immediately */ + /* Send to snooped drivers if they exist so that they can echo back the snooped property immediately */ // FIXME: no use of root here q2RDrivers(dev, mp, root); @@ -2109,7 +2109,7 @@ void DvrInfo::q2RDrivers(const std::string &dev, Msg *mp, XMLEle *root) continue; /* Only send message to each *unique* remote driver at a particular host:port - * Since it will be propogated to all other devices there */ + * Since it will be propagated to all other devices there */ if (dev.empty() && isRemote) { if (remoteAdvertised.find(remoteUid) != remoteAdvertised.end()) @@ -2294,7 +2294,7 @@ void ClInfo::q2Servers(DvrInfo *me, Msg *mp, XMLEle *root) auto cp = clients[cpId]; if (cp == nullptr) continue; - // Only send the message to the upstream server that is connected specfically to the device in driver dp + // Only send the message to the upstream server that is connected specifically to the device in driver dp switch (cp->allprops) { // 0 --> not all props are requested. Check for specific combination @@ -3107,7 +3107,7 @@ Msg::Msg(MsgQueue * from, XMLEle * ele): sharedBuffers() Msg::~Msg() { - // Assume convertionToSharedBlob and convertionToInlineBlob were already droped + // Assume convertionToSharedBlob and convertionToInlineBlob were already dropped assert(convertionToSharedBuffer == nullptr); assert(convertionToInline == nullptr); @@ -3158,7 +3158,7 @@ void Msg::releaseSharedBuffers(const std::set &keep) void Msg::prune() { - // Collect ressources required. + // Collect resources required. SerializationRequirement req; if (convertionToSharedBuffer) { @@ -3464,7 +3464,7 @@ void SerializedMsgWithoutSharedBuffer::generateContent() { async_pushChunck(MsgChunck(model + modelOffset, cdataOffset - modelOffset)); } - // Skip the dummy cdata completly + // Skip the dummy cdata completely modelOffset = cdataOffset + 1; // Perform inplace base64 @@ -3477,7 +3477,7 @@ void SerializedMsgWithoutSharedBuffer::generateContent() unsigned long buffSze = sizes[i]; const unsigned char* src = (const unsigned char*)blobs[i]; - // split here in smaller chuncks for faster startup + // split here in smaller chunks for faster startup // This allow starting write before the whole blob is converted while(buffSze > 0) { diff --git a/integs/ProcessController.cpp b/integs/ProcessController.cpp index 4f9f05eee7..ff1cfd1213 100644 --- a/integs/ProcessController.cpp +++ b/integs/ProcessController.cpp @@ -162,7 +162,7 @@ void ProcessController::expectExitCode(int e) { throw std::runtime_error(cmd + " got signal " + strsignal(WTERMSIG(status))); } // Not sure this is possible at all - throw std::runtime_error(cmd + " exited abnormaly"); + throw std::runtime_error(cmd + " exited abnormally"); } int actual = WEXITSTATUS(status); if (actual != e) { diff --git a/integs/ServerMock.h b/integs/ServerMock.h index a315262b97..466a518bda 100644 --- a/integs/ServerMock.h +++ b/integs/ServerMock.h @@ -25,7 +25,7 @@ class IndiClientMock; /** - * Instanciate a fake indi server + * Instantiate a fake indi server */ class ServerMock { diff --git a/integs/TestClientQueries.cpp b/integs/TestClientQueries.cpp index f7b20f5f42..aa8b14efa4 100644 --- a/integs/TestClientQueries.cpp +++ b/integs/TestClientQueries.cpp @@ -47,7 +47,7 @@ static void driverSendsProps(DriverMock &fakeDriver) static void clientReceivesProps(IndiClientMock &indiClient) { - fprintf(stderr, "Client reveives properties\n"); + fprintf(stderr, "Client receives properties\n"); for(int i = 0; i < PROP_COUNT; ++i) { indiClient.cnx.expectXml("mutex); pthread_cond_broadcast(&dev->condition); @@ -885,7 +885,7 @@ hid_device *HID_API_EXPORT hid_open_path(const char *path) int is_output = (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_OUT; int is_input = (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN; - /* Decide whether to use it for intput or output. */ + /* Decide whether to use it for input or output. */ if (dev->input_endpoint == 0 && is_interrupt && is_input) { /* Use this endpoint for INPUT */ @@ -941,7 +941,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t if (dev->output_endpoint <= 0) { - /* No interrput out endpoint. Use the Control Endpoint */ + /* No interrupt out endpoint. Use the Control Endpoint */ res = libusb_control_transfer(dev->device_handle, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_OUT, 0x09 /*HID Set_Report*/, (2 /*HID output*/ << 8) | report_number, dev->interface, diff --git a/libs/hid/hid_mac.c b/libs/hid/hid_mac.c index d30a44bde3..e752334ce1 100644 --- a/libs/hid/hid_mac.c +++ b/libs/hid/hid_mac.c @@ -671,7 +671,7 @@ static void *read_thread(void *param) /* Now that the read thread is stopping, Wake any threads which are waiting on data (in hid_read_timeout()). Do this under a mutex to make sure that a thread which is about to go to sleep waiting on - the condition acutally will go to sleep before the condition is + the condition actually will go to sleep before the condition is signaled. */ pthread_mutex_lock(&dev->mutex); pthread_cond_broadcast(&dev->condition); @@ -829,7 +829,7 @@ static int cond_wait(const hid_device *dev, pthread_cond_t *cond, pthread_mutex_ return res; /* A res of 0 means we may have been signaled or it may - be a spurious wakeup. Check to see that there's acutally + be a spurious wakeup. Check to see that there's actually data in the queue before returning, and if not, go back to sleep. See the pthread_cond_timedwait() man page for details. */ @@ -851,7 +851,7 @@ static int cond_timedwait(const hid_device *dev, pthread_cond_t *cond, pthread_m return res; /* A res of 0 means we may have been signaled or it may - be a spurious wakeup. Check to see that there's acutally + be a spurious wakeup. Check to see that there's actually data in the queue before returning, and if not, go back to sleep. See the pthread_cond_timedwait() man page for details. */ diff --git a/libs/hid/hid_win.c b/libs/hid/hid_win.c index 25fa6a466f..0d214444c5 100644 --- a/libs/hid/hid_win.c +++ b/libs/hid/hid_win.c @@ -154,7 +154,7 @@ static hid_device *new_hid_device() dev->read_pending = FALSE; dev->read_buf = NULL; memset(&dev->ol, 0, sizeof(dev->ol)); - dev->ol.hEvent = CreateEvent(NULL, FALSE, FALSE /*inital state f=nonsignaled*/, NULL); + dev->ol.hEvent = CreateEvent(NULL, FALSE, FALSE /*initial state f=nonsignaled*/, NULL); return dev; } diff --git a/libs/hid/hidtest.cpp b/libs/hid/hidtest.cpp index c6480ba6e8..fe110329aa 100644 --- a/libs/hid/hidtest.cpp +++ b/libs/hid/hidtest.cpp @@ -38,7 +38,7 @@ int main(int argc, char* argv[]) hid_device *handle; int i; -#ifdef WIN32 +#ifdef _WIN32 UNREFERENCED_PARAMETER(argc); UNREFERENCED_PARAMETER(argv); #endif @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) // Set the hid_read() function to be non-blocking. hid_set_nonblocking(handle, 1); - // Try to read from the device. There shoud be no + // Try to read from the device. There should be no // data here, but execution should not block. res = hid_read(handle, buf, 17); @@ -178,7 +178,7 @@ int main(int argc, char* argv[]) printf("waiting...\n"); if (res < 0) printf("Unable to read()\n"); -#ifdef WIN32 +#ifdef _WIN32 Sleep(500); #else usleep(500 * 1000); @@ -196,7 +196,7 @@ int main(int argc, char* argv[]) /* Free static HIDAPI objects. */ hid_exit(); -#ifdef WIN32 +#ifdef _WIN32 system("pause"); #endif diff --git a/libs/httplib-LICENSE b/libs/httplib/httplib-LICENSE similarity index 100% rename from libs/httplib-LICENSE rename to libs/httplib/httplib-LICENSE diff --git a/libs/httplib.h b/libs/httplib/httplib.h similarity index 100% rename from libs/httplib.h rename to libs/httplib/httplib.h diff --git a/libs/indiabstractclient/abstractbaseclient.cpp b/libs/indiabstractclient/abstractbaseclient.cpp index f8699a7b0d..004c65cef2 100644 --- a/libs/indiabstractclient/abstractbaseclient.cpp +++ b/libs/indiabstractclient/abstractbaseclient.cpp @@ -32,7 +32,7 @@ #if defined(_MSC_VER) #define snprintf _snprintf #pragma warning(push) -///@todo Introduce plattform indipendent safe functions as macros to fix this +///@todo Introduce platform independent safe functions as macros to fix this #pragma warning(disable : 4996) #endif diff --git a/libs/indiabstractclient/abstractbaseclient.h b/libs/indiabstractclient/abstractbaseclient.h index 3f03ed1fe7..1ce8a72a73 100644 --- a/libs/indiabstractclient/abstractbaseclient.h +++ b/libs/indiabstractclient/abstractbaseclient.h @@ -58,7 +58,7 @@ class AbstractBaseClient : public INDI::BaseMediator public: /** @brief Connect to INDI server. * @returns True if the connection is successful, false otherwise. - * @note This function blocks until connection is either successull or unsuccessful. + * @note This function blocks until connection is either successfull or unsuccessful. */ virtual bool connectServer() = 0; diff --git a/libs/indibase/connectionplugins/connectioninterface.h b/libs/indibase/connectionplugins/connectioninterface.h index 31bac80a5f..27f0112609 100644 --- a/libs/indibase/connectionplugins/connectioninterface.h +++ b/libs/indibase/connectionplugins/connectioninterface.h @@ -115,7 +115,7 @@ class Interface virtual bool saveConfigItems(FILE *fp); /** - * @brief registerHandshake Register a handshake function to be called once the intial connection to the device is established. + * @brief registerHandshake Register a handshake function to be called once the initial connection to the device is established. * @param callback Handshake function callback * @see INDI::Telescope */ diff --git a/libs/indibase/connectionplugins/connectiontcp.h b/libs/indibase/connectionplugins/connectiontcp.h index ad4e7d08c1..321e2d7525 100644 --- a/libs/indibase/connectionplugins/connectiontcp.h +++ b/libs/indibase/connectionplugins/connectiontcp.h @@ -30,7 +30,7 @@ namespace Connection { /** * @brief The TCP class manages connection with devices over the network via TCP/IP. - * Upon successfull connection, reads & writes from and to the device are performed via the returned file descriptor + * Upon successful connection, reads & writes from and to the device are performed via the returned file descriptor * using standard UNIX read/write functions. */ diff --git a/libs/indibase/connectionplugins/ttybase.cpp b/libs/indibase/connectionplugins/ttybase.cpp index b57ceadfc4..e6247782bd 100644 --- a/libs/indibase/connectionplugins/ttybase.cpp +++ b/libs/indibase/connectionplugins/ttybase.cpp @@ -66,7 +66,7 @@ #if defined(_MSC_VER) #define snprintf _snprintf #pragma warning(push) -///@todo Introduce plattform indipendent safe functions as macros to fix this +///@todo Introduce platform independent safe functions as macros to fix this #pragma warning(disable : 4996) #endif diff --git a/libs/indibase/connectionplugins/ttybase.h b/libs/indibase/connectionplugins/ttybase.h index 654fee8e21..28fe36a6fb 100644 --- a/libs/indibase/connectionplugins/ttybase.h +++ b/libs/indibase/connectionplugins/ttybase.h @@ -70,7 +70,7 @@ class TTYBase /** \brief read buffer from terminal with a delimiter \param fd file descriptor - \param buf pointer to store data. Must be initilized and big enough to hold data. + \param buf pointer to store data. Must be initialized and big enough to hold data. \param stop_char if the function encounters \e stop_char then it stops reading and returns the buffer. \param nsize size of buf. If stop character is not encountered before nsize, the function aborts. \param timeout number of seconds to wait for terminal before a timeout error is issued. diff --git a/libs/indibase/defaultdevice.cpp b/libs/indibase/defaultdevice.cpp index d4bedea041..6b723e0d09 100644 --- a/libs/indibase/defaultdevice.cpp +++ b/libs/indibase/defaultdevice.cpp @@ -451,7 +451,7 @@ bool DefaultDevice::loadDefaultConfig() if (pResult) LOG_INFO("Default configuration loaded."); else - LOGF_INFO("Error loading default configuraiton. %s", errmsg); + LOGF_INFO("Error loading default configuration. %s", errmsg); return pResult; } @@ -806,7 +806,7 @@ int DefaultDevice::SetTimer(uint32_t ms) } // Remove main timer. ID is not used. -// Kept for backward compatiblity +// Kept for backward compatibility void DefaultDevice::RemoveTimer(int id) { INDI_UNUSED(id); @@ -816,7 +816,7 @@ void DefaultDevice::RemoveTimer(int id) } // This is just a placeholder -// This function should be overriden by child classes if they use timers +// This function should be overridden by child classes if they use timers // So we should never get here void DefaultDevice::TimerHit() { diff --git a/libs/indibase/defaultdevice.h b/libs/indibase/defaultdevice.h index 753eca83df..138f3cb6cf 100644 --- a/libs/indibase/defaultdevice.h +++ b/libs/indibase/defaultdevice.h @@ -204,7 +204,7 @@ class DefaultDevice : public ParentDevice * @brief deleteProperty Delete a property and unregister it. It will also be deleted from all clients. * @param property Property to be deleted. * @return True if successful, false otherwise. - * @note This is a convience function that internally calls deleteProperty with the property name. + * @note This is a convenience function that internally calls deleteProperty with the property name. */ bool deleteProperty(INDI::Property &property); @@ -316,7 +316,7 @@ class DefaultDevice : public ParentDevice * You may send an ORed list of DeviceInterface values. * @param value ORed list of DeviceInterface values. * @warning This only updates the internal driver interface property and does not send it to the - * client. To synchronize the client, use syncDriverInfo funciton. + * client. To synchronize the client, use syncDriverInfo function. */ void setDriverInterface(uint16_t value); @@ -329,7 +329,7 @@ class DefaultDevice : public ParentDevice protected: /** - * @brief setDynamicPropertiesBehavior controls handling of dynamic properties. Dyanmic properties + * @brief setDynamicPropertiesBehavior controls handling of dynamic properties. Dynamic properties * are those generated from an external skeleton XML file. By default all properties, including * dynamic properties, are defined to the client in ISGetProperties(). Furthermore, when * űdeleteProperty(properyName) is called, the dynamic property is deleted by default, and can only @@ -451,8 +451,8 @@ class DefaultDevice : public ParentDevice bool isSimulation() const; /** - * \brief Initilize properties initial state and value. The child class must implement this function. - * \return True if initilization is successful, false otherwise. + * \brief Initialize properties initial state and value. The child class must implement this function. + * \return True if initialization is successful, false otherwise. */ virtual bool initProperties(); diff --git a/libs/indibase/indiccd.cpp b/libs/indibase/indiccd.cpp index 3a9e8ca620..83b3e073a4 100644 --- a/libs/indibase/indiccd.cpp +++ b/libs/indibase/indiccd.cpp @@ -991,7 +991,7 @@ bool CCD::ISNewText(const char * dev, const char * name, char * texts[], char * else { FITSHeaderTP.setState(IPS_OK); - // Specical keyword + // Special keyword if (name == "INDI_CLEAR") { m_CustomFITSKeywords.clear(); @@ -1024,6 +1024,8 @@ bool CCD::ISNewText(const char * dev, const char * name, char * texts[], char * else { // String + // Escape the value since backslashes are reserved / + std::replace(value.begin(), value.end(), '/', '\\'); FITSRecord record(name.c_str(), value.c_str(), comment.c_str()); m_CustomFITSKeywords[name.c_str()] = record; } @@ -1032,6 +1034,7 @@ bool CCD::ISNewText(const char * dev, const char * name, char * texts[], char * catch (std::exception &e) { // String + std::replace(value.begin(), value.end(), '/', '\\'); FITSRecord record(name.c_str(), value.c_str(), comment.c_str()); m_CustomFITSKeywords[name.c_str()] = record; } @@ -1738,7 +1741,7 @@ bool CCD::ISNewSwitch(const char * dev, const char * name, ISState * states, cha } CaptureFormatSP.apply(); - if (m_ConfigCaptureFormatName != CaptureFormatSP.findOnSwitch()->getName()) + if (previousIndex >= 0 && m_ConfigCaptureFormatName != CaptureFormatSP.findOnSwitch()->getName()) { m_ConfigCaptureFormatName = CaptureFormatSP.findOnSwitch()->getName(); saveConfig(true, CaptureFormatSP.getName()); @@ -1944,17 +1947,18 @@ void CCD::addFITSKeywords(CCDChip * targetChip, std::vector &fitsKey double effectiveFocalLength = std::numeric_limits::quiet_NaN(); double effectiveAperture = std::numeric_limits::quiet_NaN(); - AutoCNumeric locale; fitsKeywords.push_back({"ROWORDER", "TOP-DOWN", "Row Order"}); - fitsKeywords.push_back({"INSTRUME", getDeviceName(), "CCD Name"}); + fitsKeywords.push_back({"INSTRUME", getDeviceName(), "Camera Name"}); // Telescope - if (strlen(ActiveDeviceT[ACTIVE_TELESCOPE].text) > 0) + // Only add keyword if not already exists in custom keywords + if (m_CustomFITSKeywords.count("TELESCOP") == 0 && strlen(ActiveDeviceT[ACTIVE_TELESCOPE].text) > 0) { fitsKeywords.push_back({"TELESCOP", ActiveDeviceT[0].text, "Telescope name"}); } + // Which scope is in effect // Prefer Scope Info over snooped property which should be deprecated. effectiveFocalLength = ScopeInfoNP[FocalLength].getValue() > 0 ? ScopeInfoNP[FocalLength].getValue() : snoopedFocalLength; diff --git a/libs/indibase/indiccd.h b/libs/indibase/indiccd.h index 56dc86c721..a257d8be42 100644 --- a/libs/indibase/indiccd.h +++ b/libs/indibase/indiccd.h @@ -91,7 +91,7 @@ class XISFWrapper; * It requires the client to explicitly support websockets. It is not recommended to use this * approach unless for the most demanding and FPS sensitive tasks. * - * INDI::CCD and INDI::StreamManager both upload frames asynchrounously in a worker thread. + * INDI::CCD and INDI::StreamManager both upload frames asynchronously in a worker thread. * The CCD Buffer data is protected by the ccdBufferLock mutex. When reading the camera data * and writing to the buffer, it must be first locked by the mutex. After the write is complete * release the lock. For example: @@ -103,7 +103,7 @@ class XISFWrapper; * ExposureComplete(); * \endcode * - * Similiary, before calling Streamer->newFrame, the buffer needs to be protected in a similiar fashion using + * Similarly, before calling Streamer->newFrame, the buffer needs to be protected in a similar fashion using * the same ccdBufferLock mutex. * * \example CCD Simulator @@ -305,7 +305,7 @@ class CCD : public DefaultDevice, GuiderInterface virtual bool StartExposure(float duration); /** - * \brief Uploads target Chip exposed buffer as FITS to the client. Dervied classes should class + * \brief Uploads target Chip exposed buffer as FITS to the client. Derived classes should class * this function when an exposure is complete. * @param targetChip chip that contains upload image data * \note This function is not implemented in CCD, it must be implemented in the child class @@ -414,7 +414,7 @@ class CCD : public DefaultDevice, GuiderInterface virtual bool UpdateGuiderFrameType(CCDChip::CCD_FRAME fType); /** - * \brief Setup CCD paramters for primary CCD. Child classes call this function to update + * \brief Setup CCD parameters for primary CCD. Child classes call this function to update * CCD parameters * \param x Frame X coordinates in pixels. * \param y Frame Y coordinates in pixels. @@ -425,7 +425,7 @@ class CCD : public DefaultDevice, GuiderInterface virtual void SetCCDParams(int x, int y, int bpp, float xf, float yf); /** - * \brief Setup CCD paramters for guide head CCD. Child classes call this function to update + * \brief Setup CCD parameters for guide head CCD. Child classes call this function to update * CCD parameters * \param x Frame X coordinates in pixels. * \param y Frame Y coordinates in pixels. diff --git a/libs/indibase/indiccdchip.cpp b/libs/indibase/indiccdchip.cpp index d2315f1b50..033e672c36 100644 --- a/libs/indibase/indiccdchip.cpp +++ b/libs/indibase/indiccdchip.cpp @@ -17,6 +17,7 @@ *******************************************************************************/ #include "indiccdchip.h" #include "indidevapi.h" +#include "sharedblob.h" #include "locale_compat.h" #include diff --git a/libs/indibase/indiccdchip.h b/libs/indibase/indiccdchip.h index 13cd248dce..6f8e199fc7 100644 --- a/libs/indibase/indiccdchip.h +++ b/libs/indibase/indiccdchip.h @@ -304,7 +304,7 @@ class CCDChip /** * @brief setPixelSize Set CCD Chip pixel size - * @param x Horziontal pixel size in microns. + * @param x Horizontal pixel size in microns. * @param y Vertical pixel size in microns. */ void setPixelSize(double x, double y); @@ -380,7 +380,7 @@ class CCDChip void setNAxis(int value); /** - * @brief setImageExtension Set image exntension + * @brief setImageExtension Set image extension * @param ext extension (fits, jpeg, raw..etc) */ void setImageExtension(const char *ext); diff --git a/libs/indibase/indicontroller.h b/libs/indibase/indicontroller.h index 1b177edf78..1326a7dff0 100644 --- a/libs/indibase/indicontroller.h +++ b/libs/indibase/indicontroller.h @@ -47,7 +47,7 @@ namespace INDI * ISNewXXX functions from the same standard functions in your driver. * * The class communicates with INDI joystick driver which in turn enumerates the game pad and provides - * three types of constrcuts: + * three types of constructs: *