From ac22c6c119ca955f8de769ddbde2d10368218a12 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Thu, 5 Oct 2023 20:29:40 +0300 Subject: [PATCH 01/44] Add option to toggle between dome and rolloff types --- drivers/dome/dome_script.cpp | 196 +++++++++++++++++++++++++---------- drivers/dome/dome_script.h | 18 +++- 2 files changed, 155 insertions(+), 59 deletions(-) diff --git a/drivers/dome/dome_script.cpp b/drivers/dome/dome_script.cpp index 4494d0d1f6..cadf47249a 100644 --- a/drivers/dome/dome_script.cpp +++ b/drivers/dome/dome_script.cpp @@ -50,12 +50,11 @@ 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() @@ -63,61 +62,109 @@ 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) + SetDomeCapability(DOME_CAN_PARK | DOME_CAN_ABORT | DOME_CAN_ABS_MOVE | DOME_HAS_SHUTTER); + else + 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 +190,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 +227,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 +254,9 @@ bool DomeScript::updateProperties() return true; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// void DomeScript::TimerHit() { if (!isConnected()) @@ -228,6 +281,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 +300,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 +310,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 +340,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 +368,9 @@ bool DomeScript::Connect() return status; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// bool DomeScript::Disconnect() { bool status = RunScript(SCRIPT_DISCONNECT, nullptr); @@ -320,6 +385,9 @@ bool DomeScript::Disconnect() return status; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::Park() { bool status = RunScript(SCRIPT_PARK, nullptr); @@ -331,6 +399,9 @@ IPState DomeScript::Park() return IPS_ALERT; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::UnPark() { bool status = RunScript(SCRIPT_UNPARK, nullptr); @@ -342,6 +413,9 @@ IPState DomeScript::UnPark() return IPS_ALERT; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::ControlShutter(ShutterOperation operation) { if (RunScript(operation == SHUTTER_OPEN ? SCRIPT_OPEN : SCRIPT_CLOSE, nullptr)) @@ -352,6 +426,9 @@ IPState DomeScript::ControlShutter(ShutterOperation operation) return IPS_ALERT; } +//////////////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////////////// IPState DomeScript::MoveAbs(double az) { char _az[16]; @@ -366,35 +443,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 }; }; From ef37011d03ff158ea9f689ddd25bd95da15ae0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Soja?= Date: Fri, 6 Oct 2023 09:38:07 +0200 Subject: [PATCH 02/44] Fix PyIndi build fail - revert code formatting changes (#1948) --- libs/indidevice/indibase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/indidevice/indibase.h b/libs/indidevice/indibase.h index 97f0af6e49..e19627471a 100644 --- a/libs/indidevice/indibase.h +++ b/libs/indidevice/indibase.h @@ -7,7 +7,7 @@ #ifdef SWIG // api version for swig -% include "indiapi.h" +%include "indiapi.h" #endif #define MAXRBUF 2048 From b3878584006ef27ad6912dee326629c32ff2a499 Mon Sep 17 00:00:00 2001 From: Mattia Verga Date: Fri, 6 Oct 2023 09:39:01 +0200 Subject: [PATCH 03/44] Option to use system provided httplib (#1946) --- CMakeLists.txt | 24 +++++++++++++++++++++++- drivers/telescope/planewave_mount.cpp | 2 +- libs/{ => httplib}/httplib-LICENSE | 0 libs/{ => httplib}/httplib.h | 0 4 files changed, 24 insertions(+), 2 deletions(-) rename libs/{ => httplib}/httplib-LICENSE (100%) rename libs/{ => httplib}/httplib.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4e12c1f31..5a7c2f69fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,9 @@ 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) + if(UNIX AND NOT APPLE) OPTION(INDI_SHARED_MEMORY "Build INDI with support for UNIX protocol with shared memory" ON) else() @@ -165,6 +168,20 @@ 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) + # ################################################################################################### # # Component : INDI Core @@ -381,11 +398,16 @@ endif() 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) 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/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/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 From 7eb84626f3410e7c413d0cb40c1d75da2ff2540d Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Mon, 9 Oct 2023 18:31:50 +0300 Subject: [PATCH 04/44] Set park type per dome type --- drivers/dome/dome_script.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/dome/dome_script.cpp b/drivers/dome/dome_script.cpp index cadf47249a..55b893ac9f 100644 --- a/drivers/dome/dome_script.cpp +++ b/drivers/dome/dome_script.cpp @@ -60,7 +60,6 @@ const char *DomeScript::getDefaultName() bool DomeScript::initProperties() { INDI::Dome::initProperties(); - SetParkDataType(PARK_AZ); #if defined(__APPLE__) ScriptsTP[SCRIPT_FOLDER].fill("SCRIPT_FOLDER", "Folder", "/usr/local/share/indi/scripts"); #else @@ -88,9 +87,15 @@ bool DomeScript::initProperties() 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; From bff9ddf067b9d34e1fbe1368da7da83eaa89d991 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Wed, 4 Oct 2023 12:36:48 +0300 Subject: [PATCH 05/44] Do not turn cooler on if target temperature is higher than current --- drivers/ccd/ccd_simulator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/ccd/ccd_simulator.cpp b/drivers/ccd/ccd_simulator.cpp index 385f878a96..556ccc2ecf 100644 --- a/drivers/ccd/ccd_simulator.cpp +++ b/drivers/ccd/ccd_simulator.cpp @@ -311,9 +311,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; } From 7f9f9645f22d0f9cc3b0a7afb62166a1e0aae147 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Tue, 10 Oct 2023 09:09:20 +0300 Subject: [PATCH 06/44] Fix issue with temperature update. Fixes #1951 --- drivers/focuser/esatto.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/focuser/esatto.cpp b/drivers/focuser/esatto.cpp index 7d088b259c..1cdb4e0a64 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,9 +321,13 @@ void Esatto::TimerHit() if (m_TemperatureCounter++ == TEMPERATURE_FREQUENCY) { - auto lastValue = TemperatureNP[0].value; + auto externalTemperature = TemperatureNP[TEMPERATURE_EXTERNAL].value; + auto motorTemperature = TemperatureNP[TEMPERATURE_MOTOR].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(externalTemperature - TemperatureNP[TEMPERATURE_EXTERNAL].value) >= 0.1 || + std::abs(motorTemperature - TemperatureNP[TEMPERATURE_MOTOR].value) >= 0.1 )) TemperatureNP.apply(); auto current12V = VoltageNP[VOLTAGE_12V].getValue(); From 63757a06e82110e94f5a848eac870b33bd3567eb Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Tue, 10 Oct 2023 09:18:34 +0300 Subject: [PATCH 07/44] Remove old package name. Fixes #1949 --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index da92e6b52e..520ecc20eb 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 \ From d670b6acf642e1e6db2b194a704de961314ddf6f Mon Sep 17 00:00:00 2001 From: Ladislav Heller Date: Tue, 10 Oct 2023 11:10:33 +0200 Subject: [PATCH 08/44] Windows/Cygwin support (#1950) --- README.Cygwin | 74 ++++++++++++++++++++++++++++++++++ libs/dsp/dsp.h | 5 ++- libs/eventloop/eventloop.c | 4 ++ libs/indibase/indidrivermain.c | 4 ++ libs/indicore/indidevapi.h | 3 ++ libs/indicore/shm_open_anon.c | 5 +++ 6 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 README.Cygwin 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/libs/dsp/dsp.h b/libs/dsp/dsp.h index 82a8fc4c14..bc8c98c8c4 100644 --- a/libs/dsp/dsp.h +++ b/libs/dsp/dsp.h @@ -31,7 +31,7 @@ extern "C" { #endif #endif -#ifdef __linux__ +#if defined(__linux__) || defined(_WIN32) || defined(__CYGWIN__) #include #else #define __bswap_16(a) __builtin_bswap16(a) @@ -48,6 +48,9 @@ extern "C" { #include #include #include +#ifndef M_PI + #define M_PI 3.14159265358979323846 +#endif /** * \defgroup DSP Digital Signal Processing API diff --git a/libs/eventloop/eventloop.c b/libs/eventloop/eventloop.c index 0ac87a5b19..e1fb60517e 100644 --- a/libs/eventloop/eventloop.c +++ b/libs/eventloop/eventloop.c @@ -41,6 +41,10 @@ #include #include +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#endif + #include "eventloop.h" /* info about one registered callback. diff --git a/libs/indibase/indidrivermain.c b/libs/indibase/indidrivermain.c index dc9d5507b3..20e3b00e7e 100644 --- a/libs/indibase/indidrivermain.c +++ b/libs/indibase/indidrivermain.c @@ -47,6 +47,10 @@ #include #include +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#endif + #define MAXRBUF 2048 static void usage(void); diff --git a/libs/indicore/indidevapi.h b/libs/indicore/indidevapi.h index 34580c73ae..17f60b33a5 100644 --- a/libs/indicore/indidevapi.h +++ b/libs/indicore/indidevapi.h @@ -93,6 +93,9 @@ * */ +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#endif #include "indiapi.h" #include "lilxml.h" diff --git a/libs/indicore/shm_open_anon.c b/libs/indicore/shm_open_anon.c index a56980af93..fd96ac6941 100644 --- a/libs/indicore/shm_open_anon.c +++ b/libs/indicore/shm_open_anon.c @@ -112,8 +112,13 @@ shm_open_anon(void) r = (unsigned long)tv.tv_sec + (unsigned long)tv.tv_nsec; for (fill = start; fill < limit; r /= 8) *fill++ = '0' + (r % 8); +#if defined(_WIN32) || defined(__CYGWIN__) + fd = shm_open( + name, O_RDWR | O_CREAT | O_EXCL, 0600); +#else fd = shm_open( name, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW, 0600); +#endif if (fd != -1) return shm_unlink_or_close(name, fd); if (errno != EEXIST) From b01e720469c8d8287ecdc94997f64d500ff190fa Mon Sep 17 00:00:00 2001 From: Sonny Cavazos <43073912+sonny486@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:21:41 -0500 Subject: [PATCH 09/44] Update ioptronv3driver.cpp (#1952) --- drivers/telescope/ioptronv3driver.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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"}, From 408b89251cc8b39e42d442778040d7bad2f32c7b Mon Sep 17 00:00:00 2001 From: James Amendolagine Date: Thu, 19 Oct 2023 01:03:53 -0700 Subject: [PATCH 10/44] Handling tracking mode in the pegasus driver, and enable King mode. (#1954) --- drivers/telescope/lx200_pegasus_nyx101.cpp | 71 ++++++++++------------ drivers/telescope/lx200_pegasus_nyx101.h | 12 +++- 2 files changed, 40 insertions(+), 43 deletions(-) diff --git a/drivers/telescope/lx200_pegasus_nyx101.cpp b/drivers/telescope/lx200_pegasus_nyx101.cpp index 3c246815ac..2014b2bf1e 100644 --- a/drivers/telescope/lx200_pegasus_nyx101.cpp +++ b/drivers/telescope/lx200_pegasus_nyx101.cpp @@ -73,6 +73,9 @@ 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); + // Guide Rate int guideRate = 1; IUGetConfigOnSwitchIndex(getDeviceName(), "GUIDE_RATE", &guideRate); @@ -112,15 +115,6 @@ bool LX200NYX101::initProperties() IsAtHomePosition[0].fill("IsAtHomePosition","H","-"); IsAtHomePosition.fill(getDeviceName(),"IsAtHomePosition","IsAtHomePosition",STATUS_TAB, IP_RO, 60, IPS_IDLE); - TrackSidereal[0].fill("TrackSidereal","","-"); - TrackSidereal.fill(getDeviceName(),"TrackSidereal","TrackSidereal",STATUS_TAB, IP_RO, 60, IPS_IDLE); - - TrackLunar[0].fill("TrackLunar","(","-"); - TrackLunar.fill(getDeviceName(),"TrackLunar","TrackLunar",STATUS_TAB, IP_RO, 60, IPS_IDLE); - - TrackSolar[0].fill("TrackSolar","O","-"); - TrackSolar.fill(getDeviceName(),"TrackSolar","TrackSolar",STATUS_TAB, IP_RO, 60, IPS_IDLE); - MountAltAz[0].fill("MountAltAz","A","-"); MountAltAz.fill(getDeviceName(),"MountAltAz","MountAltAz",STATUS_TAB, IP_RO, 60, IPS_IDLE); @@ -215,9 +209,6 @@ bool LX200NYX101::updateProperties() defineProperty(IsParked); defineProperty(IsParkginInProgress); defineProperty(IsAtHomePosition); - defineProperty(TrackSidereal); - defineProperty(TrackLunar); - defineProperty(TrackSolar); defineProperty(MountAltAz); defineProperty(MountEquatorial); defineProperty(PierNone); @@ -242,9 +233,6 @@ bool LX200NYX101::updateProperties() deleteProperty(IsParked); deleteProperty(IsParkginInProgress); deleteProperty(IsAtHomePosition); - deleteProperty(TrackSidereal); - deleteProperty(TrackLunar); - deleteProperty(TrackSolar); deleteProperty(MountAltAz); deleteProperty(MountEquatorial); deleteProperty(PierNone); @@ -311,7 +299,7 @@ bool LX200NYX101::ReadScopeStatus() //bool _IsAtHomePosition = false; SetPropertyText(IsAtHomePosition, IPS_BUSY); - TelescopeTrackMode _TrackingMode = TRACK_SIDEREAL; + NYXTelescopeTrackMode _TrackingMode = TRACK_SIDEREAL; //MountType _MountType = Equatorial; @@ -376,7 +364,7 @@ bool LX200NYX101::ReadScopeStatus() _TrackingMode = TRACK_SOLAR; continue; case 'k': - //Not Supported by TelescopeTrackMode + _TrackingMode = TRACK_KING; continue; case 'A': //_MountType = AltAz; @@ -423,26 +411,13 @@ bool LX200NYX101::ReadScopeStatus() } } - switch(_TrackingMode) - { - 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; - } + 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) { @@ -594,9 +569,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); @@ -672,6 +644,25 @@ 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..35ad1de324 100644 --- a/drivers/telescope/lx200_pegasus_nyx101.h +++ b/drivers/telescope/lx200_pegasus_nyx101.h @@ -43,6 +43,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,6 +52,14 @@ class LX200NYX101 : public LX200Generic static const char DRIVER_STOP_CHAR { 0x23 }; static constexpr const uint8_t DRIVER_TIMEOUT {3}; + enum NYXTelescopeTrackMode + { + TRACK_SIDEREAL, + TRACK_SOLAR, + TRACK_LUNAR, + TRACK_KING + }; + INDI::PropertySwitch MountTypeSP {2}; enum MountType { @@ -67,9 +76,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}; From 58ae68b8107ed471560fb952c3676e354ba3a99b Mon Sep 17 00:00:00 2001 From: Alain Date: Mon, 23 Oct 2023 21:04:11 +0200 Subject: [PATCH 11/44] Fixed 9 Stars Align (#1956) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allowing Meridian Flip Limits East and West -180 .. 180 * setup version * defaut Meridian Value to -20 West / +20 East * Fixed setUTCOffset to Onstep formt :SG[sHH]# * fix after change in lx200driver.cpp and fix to have UTC hh:00, hh:30, hh:45 * fix negtives UTC Offsets * fixed UTC uninitialized structure tahnks Norikyu * OnStep 1.17 minor fix * Onstep * Onstep * Implemented Focuser Temperature Compensation * Fixed Focuser T° Compensation * removed unused properties causing undefined defNumberVector * Fixed minor bugs and typo * fix minor bugs and typo * minor fixes * fixes OnStepX :Ft# and :GX98# * fixed Focuser Temperature in Ekos * fixed FOCUS_TEMPERATURE Property name * Weather and Focus T° fixes * version 1.20 * clean up version 1.20 * fixed 9 stars align --- drivers.xml | 2 +- drivers/telescope/lx200_OnStep.cpp | 15 +++++++++++---- drivers/telescope/lx200_OnStep.h | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers.xml b/drivers.xml index ec01c13879..8d1f8bc1c6 100644 --- a/drivers.xml +++ b/drivers.xml @@ -33,7 +33,7 @@ indi_lx200_OnStep - 1.20 + 1.21 indi_lx200_OpenAstroTech diff --git a/drivers/telescope/lx200_OnStep.cpp b/drivers/telescope/lx200_OnStep.cpp index 20bb2c4478..681f099440 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, 21); // 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); @@ -4616,7 +4616,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 +4662,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 +4671,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,7 +4683,14 @@ 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); diff --git a/drivers/telescope/lx200_OnStep.h b/drivers/telescope/lx200_OnStep.h index 846160871d..08a2981b21 100644 --- a/drivers/telescope/lx200_OnStep.h +++ b/drivers/telescope/lx200_OnStep.h @@ -25,6 +25,8 @@ =========================================== Version not yet updated/No INDI release: + 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 From 1a85d8117e0c7af72b094775d54c7b89dd351219 Mon Sep 17 00:00:00 2001 From: Alain Date: Fri, 27 Oct 2023 12:35:47 +0200 Subject: [PATCH 12/44] On step work (#1958) --- drivers.xml | 2 +- drivers/telescope/lx200_OnStep.cpp | 90 +++++++++++++++++++----------- drivers/telescope/lx200_OnStep.h | 4 +- 3 files changed, 60 insertions(+), 36 deletions(-) diff --git a/drivers.xml b/drivers.xml index 8d1f8bc1c6..5e27eb13cc 100644 --- a/drivers.xml +++ b/drivers.xml @@ -33,7 +33,7 @@ indi_lx200_OnStep - 1.21 + 1.22 indi_lx200_OpenAstroTech diff --git a/drivers/telescope/lx200_OnStep.cpp b/drivers/telescope/lx200_OnStep.cpp index 681f099440..cc9814b6be 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, 21); // 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); @@ -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 Successfull"); 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; } } @@ -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"); @@ -4697,13 +4711,13 @@ bool LX200_OnStep::UpdateAlignStatus () 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(); @@ -4714,7 +4728,7 @@ bool LX200_OnStep::UpdateAlignStatus () bool LX200_OnStep::UpdateAlignErr() { - // :GXnn# Get OnStep value + // :GX0n# Get OnStep value // Returns: value // 00 ax1Cor @@ -4752,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); @@ -4791,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 Successfull"); + 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 @@ -5414,8 +5437,7 @@ 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]; diff --git a/drivers/telescope/lx200_OnStep.h b/drivers/telescope/lx200_OnStep.h index 08a2981b21..8aa7ec20c7 100644 --- a/drivers/telescope/lx200_OnStep.h +++ b/drivers/telescope/lx200_OnStep.h @@ -25,6 +25,8 @@ =========================================== 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 @@ -419,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; From 16fef45f2cdf96ff97e6a54444f6f5d7234abbda Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Sat, 28 Oct 2023 11:55:03 +0300 Subject: [PATCH 13/44] Escape backslashes in custom FITS values. Do not add TELESCOP keyword if already exists in custom headers --- libs/indibase/indiccd.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/indibase/indiccd.cpp b/libs/indibase/indiccd.cpp index 3a9e8ca620..92c2f093aa 100644 --- a/libs/indibase/indiccd.cpp +++ b/libs/indibase/indiccd.cpp @@ -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; } @@ -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; From d7c3b1b9352fcb23cfe192dc3fd23bb59922e7ff Mon Sep 17 00:00:00 2001 From: James Amendolagine Date: Thu, 2 Nov 2023 09:44:45 -0700 Subject: [PATCH 14/44] Added several missing commands: (#1957) --- drivers/telescope/lx200_pegasus_nyx101.cpp | 226 ++++++++++++++++++++- drivers/telescope/lx200_pegasus_nyx101.h | 34 +++- 2 files changed, 251 insertions(+), 9 deletions(-) diff --git a/drivers/telescope/lx200_pegasus_nyx101.cpp b/drivers/telescope/lx200_pegasus_nyx101.cpp index 2014b2bf1e..24656d735e 100644 --- a/drivers/telescope/lx200_pegasus_nyx101.cpp +++ b/drivers/telescope/lx200_pegasus_nyx101.cpp @@ -75,7 +75,32 @@ bool LX200NYX101::initProperties() // 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); @@ -100,6 +125,12 @@ bool LX200NYX101::initProperties() Report[0].fill("Report","GU","-"); Report.fill(getDeviceName(), "Report", "Report", 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 + IsTracking[0].fill("IsTracking","n","-"); IsTracking.fill(getDeviceName(),"IsTracking","IsTracking",STATUS_TAB, IP_RO, 60, IPS_IDLE); @@ -145,7 +176,10 @@ bool LX200NYX101::initProperties() 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); strncpy(SlewRateS[1].label, "8x", MAXINDILABEL); @@ -198,11 +232,38 @@ 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); @@ -225,9 +286,18 @@ 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); @@ -305,7 +375,7 @@ bool LX200NYX101::ReadScopeStatus() TelescopePierSide _PierSide = PIER_UNKNOWN; - //bool _DoesRefractionComp = false; + bool _DoesRefractionComp = false; SetPropertyText(DoesRefractionComp, IPS_BUSY); //bool _WaitingAtHome = false; @@ -320,9 +390,6 @@ bool LX200NYX101::ReadScopeStatus() //bool _SlewingHome = false; SetPropertyText(SlewingHome, IPS_BUSY); - - - char status[DRIVER_LEN] = {0}; if(sendCommand(":GU#", status)) { @@ -383,7 +450,7 @@ bool LX200NYX101::ReadScopeStatus() _PierSide = PIER_WEST; continue; case 'r': - //_DoesRefractionComp = true; + _DoesRefractionComp = true; SetPropertyText(DoesRefractionComp, IPS_OK); continue; case 'w': @@ -410,7 +477,17 @@ bool LX200NYX101::ReadScopeStatus() break; } } - + if(_DoesRefractionComp ){ + 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; @@ -487,6 +564,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(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); } @@ -540,6 +666,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); @@ -553,6 +705,39 @@ 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); @@ -591,6 +776,31 @@ 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 Date: Wed, 8 Nov 2023 07:59:17 +0300 Subject: [PATCH 15/44] Fix issue with reporting updated measurements due to creep in from cumulative threshold --- drivers/focuser/esatto.cpp | 18 ++++++++++-------- drivers/focuser/esatto.h | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/focuser/esatto.cpp b/drivers/focuser/esatto.cpp index 1cdb4e0a64..4c787656ad 100644 --- a/drivers/focuser/esatto.cpp +++ b/drivers/focuser/esatto.cpp @@ -321,22 +321,24 @@ void Esatto::TimerHit() if (m_TemperatureCounter++ == TEMPERATURE_FREQUENCY) { - auto externalTemperature = TemperatureNP[TEMPERATURE_EXTERNAL].value; - auto motorTemperature = TemperatureNP[TEMPERATURE_MOTOR].value; rc = updateTemperature(); // Only update temperature if there is a change of 0.1 or more - if (rc && (std::abs(externalTemperature - TemperatureNP[TEMPERATURE_EXTERNAL].value) >= 0.1 || - std::abs(motorTemperature - TemperatureNP[TEMPERATURE_MOTOR].value) >= 0.1 )) + 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}; }; From b24472523f6b550205cceddec2a08b192ad9f58d Mon Sep 17 00:00:00 2001 From: Orestes Sanchez Date: Thu, 9 Nov 2023 06:03:15 +0100 Subject: [PATCH 16/44] Snapcap driver with network connections (#1961) --- drivers.xml | 2 +- drivers/auxiliary/snapcap.cpp | 73 +++++++++++++++++++++++++++++------ drivers/auxiliary/snapcap.h | 33 ++++++++++++++-- 3 files changed, 93 insertions(+), 15 deletions(-) diff --git a/drivers.xml b/drivers.xml index 5e27eb13cc..a8a9dd7bf7 100644 --- a/drivers.xml +++ b/drivers.xml @@ -667,7 +667,7 @@ indi_snapcap - 1.2 + 1.3 indi_Excalibur 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;}; From ddf44bde7117266f654300207a80696e8e2d735b Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Sat, 25 Nov 2023 10:13:02 +0300 Subject: [PATCH 17/44] Use _WIN32 as the standard preprocessor macro for Windows builds --- libs/hid/hidtest.cpp | 6 +++--- libs/indiclient/baseclient.cpp | 2 +- libs/indicore/indiutility.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/hid/hidtest.cpp b/libs/hid/hidtest.cpp index c6480ba6e8..4b2b6fbe35 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 @@ -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/indiclient/baseclient.cpp b/libs/indiclient/baseclient.cpp index 95a5d19b55..3b0bafba8a 100644 --- a/libs/indiclient/baseclient.cpp +++ b/libs/indiclient/baseclient.cpp @@ -317,7 +317,7 @@ bool BaseClient::connectServer() IDLog("INDI::BaseClient::connectServer: creating new connection...\n"); -#ifndef _WINDOWS +#ifndef _WIN32 // System with unix support automatically connect over unix domain if (d->cServer != "localhost" || d->cServer != "127.0.0.1" || d->connectToHostAndWait("localhost:", d->cPort) == false) #endif diff --git a/libs/indicore/indiutility.h b/libs/indicore/indiutility.h index 74f2a6e562..cc34272d81 100644 --- a/libs/indicore/indiutility.h +++ b/libs/indicore/indiutility.h @@ -64,7 +64,7 @@ inline static size_t indi_strlcpy(char * dst, const char * src, size_t maxlen) // C++ #ifdef __cplusplus -#ifdef _WINDOWS +#ifdef _WIN32 typedef int mode_t; #endif From a223fb69c3acdb73f2e777f7e4a0265699673e8a Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Sat, 25 Nov 2023 10:42:18 +0300 Subject: [PATCH 18/44] Fix on MINGW --- libs/indiclient/baseclient.cpp | 2 +- libs/indicore/indiutility.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/indiclient/baseclient.cpp b/libs/indiclient/baseclient.cpp index 3b0bafba8a..8f058dee93 100644 --- a/libs/indiclient/baseclient.cpp +++ b/libs/indiclient/baseclient.cpp @@ -317,7 +317,7 @@ bool BaseClient::connectServer() IDLog("INDI::BaseClient::connectServer: creating new connection...\n"); -#ifndef _WIN32 +#if !defined (_WIN32) && !defined (_WINDOWS) // System with unix support automatically connect over unix domain if (d->cServer != "localhost" || d->cServer != "127.0.0.1" || d->connectToHostAndWait("localhost:", d->cPort) == false) #endif diff --git a/libs/indicore/indiutility.h b/libs/indicore/indiutility.h index cc34272d81..c07e192b9c 100644 --- a/libs/indicore/indiutility.h +++ b/libs/indicore/indiutility.h @@ -64,7 +64,7 @@ inline static size_t indi_strlcpy(char * dst, const char * src, size_t maxlen) // C++ #ifdef __cplusplus -#ifdef _WIN32 +#if defined (_WIN32) || defined (_WINDOWS) typedef int mode_t; #endif From 4729c8b1e2be6e970b63ec724661eaee6b746b19 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Sat, 25 Nov 2023 11:03:39 +0300 Subject: [PATCH 19/44] Another attempt at fixing MINGW32. Needs to test with CYGWIN --- libs/indiclient/baseclient.cpp | 2 +- libs/indicore/indiutility.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/indiclient/baseclient.cpp b/libs/indiclient/baseclient.cpp index 8f058dee93..640014e2b1 100644 --- a/libs/indiclient/baseclient.cpp +++ b/libs/indiclient/baseclient.cpp @@ -317,7 +317,7 @@ bool BaseClient::connectServer() IDLog("INDI::BaseClient::connectServer: creating new connection...\n"); -#if !defined (_WIN32) && !defined (_WINDOWS) +#if !defined (_WIN32) // System with unix support automatically connect over unix domain if (d->cServer != "localhost" || d->cServer != "127.0.0.1" || d->connectToHostAndWait("localhost:", d->cPort) == false) #endif diff --git a/libs/indicore/indiutility.h b/libs/indicore/indiutility.h index c07e192b9c..f418b5c7c9 100644 --- a/libs/indicore/indiutility.h +++ b/libs/indicore/indiutility.h @@ -64,7 +64,8 @@ inline static size_t indi_strlcpy(char * dst, const char * src, size_t maxlen) // C++ #ifdef __cplusplus -#if defined (_WIN32) || defined (_WINDOWS) +// JM 2023.11.25: Not available in Vanilla Windows (Visual Studio 2022) but available with MINGW? How does this affect CYGWIN? +#if defined (_WIN32) && !defined (__MINGW32__) typedef int mode_t; #endif From 88cb5d07828ba8f58c7878597ce523b0e7fc5fdd Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Thu, 30 Nov 2023 16:27:01 +0300 Subject: [PATCH 20/44] Possible fix for Windows VS 2022 compile error --- libs/indidevice/property/indipropertybasic.cpp | 2 +- libs/indidevice/property/indipropertybasic.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/indidevice/property/indipropertybasic.cpp b/libs/indidevice/property/indipropertybasic.cpp index a7e8f484ed..c47a577cfc 100644 --- a/libs/indidevice/property/indipropertybasic.cpp +++ b/libs/indidevice/property/indipropertybasic.cpp @@ -393,7 +393,7 @@ const WidgetView *PropertyBasic::at(size_t index) const } template -WidgetView &PropertyBasic::operator[](ssize_t index) const +WidgetView &PropertyBasic::operator[](int index) const { D_PTR(const PropertyBasic); assert(index >= 0); diff --git a/libs/indidevice/property/indipropertybasic.h b/libs/indidevice/property/indipropertybasic.h index a22bbe4621..055d5e061b 100644 --- a/libs/indidevice/property/indipropertybasic.h +++ b/libs/indidevice/property/indipropertybasic.h @@ -128,7 +128,7 @@ class PropertyBasic : public INDI::Property const WidgetView *at(size_t index) const; - WidgetView &operator[](ssize_t index) const; + WidgetView &operator[](int index) const; public: // STL-style iterators WidgetView *begin(); From 5732b517913f25b9ab4d8c0c855a3fdf684c2fbe Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Fri, 1 Dec 2023 10:33:34 +0300 Subject: [PATCH 21/44] Fix crasdh in case no capture format is selected --- libs/indibase/indiccd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/indibase/indiccd.cpp b/libs/indibase/indiccd.cpp index 92c2f093aa..6e837b1636 100644 --- a/libs/indibase/indiccd.cpp +++ b/libs/indibase/indiccd.cpp @@ -1741,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()); From 4561ca46f13ff256f25c96f391f90dd531dcedf6 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Fri, 1 Dec 2023 10:34:50 +0300 Subject: [PATCH 22/44] Explicitly include sharedblob when required --- libs/indibase/indiccdchip.cpp | 1 + libs/indicore/CMakeLists.txt | 4 ++-- libs/indicore/indiapi.h.in | 5 ----- libs/indicore/indidevapi.h | 4 ---- libs/indicore/sharedblob.h | 4 ++-- libs/indidevice/basedevice.cpp | 3 ++- 6 files changed, 7 insertions(+), 14 deletions(-) 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/indicore/CMakeLists.txt b/libs/indicore/CMakeLists.txt index 36651011cf..91318e76d0 100644 --- a/libs/indicore/CMakeLists.txt +++ b/libs/indicore/CMakeLists.txt @@ -41,14 +41,14 @@ list(APPEND ${PROJECT_NAME}_SOURCES indidevapi.c lilxml.cpp indiuserio.c + sharedblob.c ) if(UNIX) list(APPEND ${PROJECT_NAME}_PRIVATE_HEADERS sharedblob_parse.h shm_open_anon.h) - list(APPEND ${PROJECT_NAME}_SOURCES - sharedblob.c + list(APPEND ${PROJECT_NAME}_SOURCES sharedblob_parse.cpp shm_open_anon.c) endif() diff --git a/libs/indicore/indiapi.h.in b/libs/indicore/indiapi.h.in index bc1fa7b5bd..708fd89591 100644 --- a/libs/indicore/indiapi.h.in +++ b/libs/indicore/indiapi.h.in @@ -510,11 +510,6 @@ extern "C" { #endif // FIXME: duplicated from indidevapi.h. Can we share ? - -// Advertize support for shared blob on this platform -#define INDI_SHARED_BLOB_SUPPORT -#include "sharedblob.h" - #ifdef __cplusplus } #endif diff --git a/libs/indicore/indidevapi.h b/libs/indicore/indidevapi.h index 17f60b33a5..556e6b39c6 100644 --- a/libs/indicore/indidevapi.h +++ b/libs/indicore/indidevapi.h @@ -823,10 +823,6 @@ extern const char *permStr(IPerm p); /** @brief print the boilerplate comment introducing xml */ extern void xmlv1(); -// Advertize support for shared blob on this platform -#define INDI_SHARED_BLOB_SUPPORT -#include "sharedblob.h" - #ifdef __cplusplus } #endif diff --git a/libs/indicore/sharedblob.h b/libs/indicore/sharedblob.h index 0ca3c9c879..15d38d1ca4 100644 --- a/libs/indicore/sharedblob.h +++ b/libs/indicore/sharedblob.h @@ -1,6 +1,7 @@ -#ifdef INDI_SHARED_BLOB_SUPPORT #pragma once +#include + #ifdef __cplusplus extern "C" { #endif @@ -47,4 +48,3 @@ extern void IDSharedBlobSeal(void * ptr); void * IDSharedBlobAlloc(size_t size); -#endif diff --git a/libs/indidevice/basedevice.cpp b/libs/indidevice/basedevice.cpp index 27af5f894e..40b6c1f319 100644 --- a/libs/indidevice/basedevice.cpp +++ b/libs/indidevice/basedevice.cpp @@ -22,6 +22,7 @@ #include "base64.h" #include "config.h" #include "indicom.h" +#include "sharedblob.h" #include "indistandardproperty.h" #include "locale_compat.h" @@ -460,7 +461,7 @@ int BaseDevice::buildProp(const INDI::LilXmlElement &root, char *errmsg, bool is case INDI_BLOB: { INDI::PropertyBlob typedProperty {0}; - typedProperty.setBlobDeleter([](void *&blob) + typedProperty.setBlobDeleter([](void * &blob) { #ifdef ENABLE_INDI_SHARED_MEMORY IDSharedBlobFree(blob); From ae69e53eea08ffc0d7f8a1add1e4e45e8023b51e Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Fri, 1 Dec 2023 10:35:22 +0300 Subject: [PATCH 23/44] Do not redefine ssize_t if other libraries defined it --- libs/indimacros.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/indimacros.h b/libs/indimacros.h index 9676dc032c..65dd2dd042 100644 --- a/libs/indimacros.h +++ b/libs/indimacros.h @@ -36,7 +36,9 @@ */ #ifdef _MSC_VER # include +#ifndef HAVE_SSIZE_T typedef SSIZE_T ssize_t; +#endif #else # include #endif From bc7fea5192c7da609dddcdc193f058286615abeb Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Fri, 1 Dec 2023 10:58:59 +0300 Subject: [PATCH 24/44] Add missing header --- libs/indibase/indidriverio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/indibase/indidriverio.c b/libs/indibase/indidriverio.c index 8670175a3b..ac190de9af 100644 --- a/libs/indibase/indidriverio.c +++ b/libs/indibase/indidriverio.c @@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA #include #include "indidriver.h" +#include "sharedblob.h" #include "userio.h" #include "indiuserio.h" #include "indidriverio.h" From c58d13f761a2928d064b27b738a0a301d222dc56 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Fri, 1 Dec 2023 13:46:41 +0300 Subject: [PATCH 25/44] Fix compile on Windows --- libs/indicore/sharedblob.c | 45 +++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/libs/indicore/sharedblob.c b/libs/indicore/sharedblob.c index df0af41b7a..03b51a6ccb 100644 --- a/libs/indicore/sharedblob.c +++ b/libs/indicore/sharedblob.c @@ -26,22 +26,24 @@ #include #endif -#include #include #include #include + +#if defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) #include #include +#include +#endif #ifdef ENABLE_INDI_SHARED_MEMORY #include "shm_open_anon.h" +static pthread_mutex_t shared_buffer_mutex = PTHREAD_MUTEX_INITIALIZER; #endif // A shared buffer will be allocated by chunk of at least 1M (must be ^ 2) #define BLOB_SIZE_UNIT 0x100000 -static pthread_mutex_t shared_buffer_mutex = PTHREAD_MUTEX_INITIALIZER; - typedef struct shared_buffer { void * mapstart; @@ -62,11 +64,12 @@ static size_t allocation(size_t storage) return (storage + BLOB_SIZE_UNIT - 1) & ~(BLOB_SIZE_UNIT - 1); } +#ifdef ENABLE_INDI_SHARED_MEMORY static void sharedBufferAdd(shared_buffer * sb); static shared_buffer * sharedBufferRemove(void * mapstart); +#endif static shared_buffer * sharedBufferFind(void * mapstart); - void * IDSharedBlobAlloc(size_t size) { #ifdef ENABLE_INDI_SHARED_MEMORY @@ -105,6 +108,7 @@ void * IDSharedBlobAlloc(size_t size) void * IDSharedBlobAttach(int fd, size_t size) { +#ifdef ENABLE_INDI_SHARED_MEMORY shared_buffer * sb = (shared_buffer*)malloc(sizeof(shared_buffer)); if (sb == NULL) goto ERROR; sb->fd = fd; @@ -125,12 +129,16 @@ void * IDSharedBlobAttach(int fd, size_t size) free(sb); errno = e; } +#endif + (void)fd; + (void)size; return NULL; } void IDSharedBlobFree(void * ptr) { +#ifdef ENABLE_INDI_SHARED_MEMORY shared_buffer * sb = sharedBufferRemove(ptr); if (sb == NULL) { @@ -149,10 +157,14 @@ void IDSharedBlobFree(void * ptr) perror("shared buffer close"); } free(sb); +#else + free(ptr); +#endif } void IDSharedBlobDettach(void * ptr) { +#ifdef ENABLE_INDI_SHARED_MEMORY shared_buffer * sb = sharedBufferRemove(ptr); if (sb == NULL) { @@ -166,6 +178,9 @@ void IDSharedBlobDettach(void * ptr) _exit(1); } free(sb); +#else + free(ptr); +#endif } void * IDSharedBlobRealloc(void * ptr, size_t size) @@ -183,6 +198,9 @@ void * IDSharedBlobRealloc(void * ptr, size_t size) return realloc(ptr, size); } +#if defined(_WIN32) + return NULL; +#else if (sb->sealed) { IDSharedBlobFree(ptr); @@ -226,16 +244,22 @@ void * IDSharedBlobRealloc(void * ptr, size_t size) sb->mapstart = remaped; return remaped; +#endif } static void seal(shared_buffer * sb) { +#ifdef ENABLE_INDI_SHARED_MEMORY void * ret = mmap(sb->mapstart, sb->allocated, PROT_READ, MAP_SHARED | MAP_FIXED, sb->fd, 0); if (ret == MAP_FAILED) { perror("remap readonly failed"); } sb->sealed = 1; +#else + (void)sb; + perror("seal unsupported on this platform"); +#endif } int IDSharedBlobGetFd(void * ptr) @@ -251,17 +275,22 @@ int IDSharedBlobGetFd(void * ptr) // Make sure a shared blob is not modified after sharing seal(sb); - return sb->fd; + return sb->fd; } void IDSharedBlobSeal(void * ptr) { +#ifdef ENABLE_INDI_SHARED_MEMORY shared_buffer * sb; sb = sharedBufferFind(ptr); if (sb->sealed) return; seal(sb); +#else + (void)ptr; +#endif } +#ifdef ENABLE_INDI_SHARED_MEMORY static shared_buffer * first = NULL, *last = NULL; static void sharedBufferAdd(shared_buffer * sb) @@ -321,11 +350,17 @@ static shared_buffer * sharedBufferRemove(void * mapstart) pthread_mutex_unlock(&shared_buffer_mutex); return sb; } +#endif static shared_buffer * sharedBufferFind(void * mapstart) { +#ifdef ENABLE_INDI_SHARED_MEMORY pthread_mutex_lock(&shared_buffer_mutex); shared_buffer * sb = sharedBufferFindUnlocked(mapstart); pthread_mutex_unlock(&shared_buffer_mutex); return sb; +#else + (void)mapstart; + return NULL; +#endif } From 856ac85b965177d23cd0c819a49fd50bdaeece60 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Fri, 1 Dec 2023 13:47:04 +0300 Subject: [PATCH 26/44] INDI Library v2.0.5 release --- CMakeLists.txt | 2 +- ChangeLog | 26 ++++++++++++++++++++++++++ debian/changelog | 6 ++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a7c2f69fe..30a188a275 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}") 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/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. From fc28d1742788b6da725ee2157c1affe6ddbc4bc2 Mon Sep 17 00:00:00 2001 From: Eric Dejouhanet Date: Fri, 1 Dec 2023 18:31:54 +0100 Subject: [PATCH 27/44] fix(docker): add zmq dependency, output OS info (#1967) --- .github/docker/Dockerfile.debian | 7 +++++-- .github/docker/Dockerfile.debian-buster | 5 ++++- .github/docker/Dockerfile.debian-i386 | 7 ++++--- .github/docker/Dockerfile.fedora | 5 ++++- .github/docker/Dockerfile.ubuntu | 5 ++++- 5 files changed, 21 insertions(+), 8 deletions(-) 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 \ From d11ac07a0cf68528403cc9b5ad4d92a46b80424e Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Fri, 1 Dec 2023 21:11:37 +0300 Subject: [PATCH 28/44] Add reverse support to starlight EFS focuser. Not tested on hardware --- drivers.xml | 2 +- drivers/focuser/si_efs.cpp | 103 ++++++++++++++++++++++++++++++++++++- drivers/focuser/si_efs.h | 9 +++- 3 files changed, 110 insertions(+), 4 deletions(-) diff --git a/drivers.xml b/drivers.xml index a8a9dd7bf7..d680a682d9 100644 --- a/drivers.xml +++ b/drivers.xml @@ -487,7 +487,7 @@ indi_siefs_focus - 0.1 + 0.2 indi_lacerta_mfoc_focus 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(); From 0d5beb7fe9d8a7f0fa6f56044077f83605a778fa Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Sat, 2 Dec 2023 10:06:59 +0100 Subject: [PATCH 29/44] Link against httplib if using system libraries (#1968) --- drivers/telescope/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 796e86257d6e8935f34b5ce069918c31cc3f3e37 Mon Sep 17 00:00:00 2001 From: Eric Dejouhanet Date: Mon, 4 Dec 2023 05:15:29 +0100 Subject: [PATCH 30/44] fix(actions): upgrade actions versions. (#1972) --- .github/workflows/docker.yml | 4 ++-- .github/workflows/linux-i386.yml | 2 +- .github/workflows/linux-packages.yml | 2 +- .github/workflows/linux-pyindi.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) 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-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' From 2be49d51862a977b9cd76119f61ee56f06780fee Mon Sep 17 00:00:00 2001 From: luzpaz Date: Sun, 3 Dec 2023 23:15:52 -0500 Subject: [PATCH 31/44] Fix various typos throughout the codebase (#1969) --- README.md | 2 +- drivers/README.md | 2 +- drivers/auxiliary/STAR2kdriver.c | 2 +- drivers/auxiliary/astrometrydriver.cpp | 2 +- drivers/auxiliary/astrometrydriver.h | 2 +- drivers/auxiliary/mydcp4esp32.cpp | 6 +++--- drivers/auxiliary/mydcp4esp32.h | 4 ++-- drivers/auxiliary/pegasus_upb.cpp | 2 +- drivers/auxiliary/planewave_delta.h | 2 +- drivers/auxiliary/skysafariclient.cpp | 2 +- drivers/auxiliary/sqm.h | 2 +- drivers/auxiliary/wanderer_cover.cpp | 4 ++-- drivers/auxiliary/watchdog.cpp | 2 +- drivers/ccd/ccd_simulator.cpp | 4 ++-- drivers/ccd/guide_simulator.cpp | 2 +- drivers/dome/domepro2.h | 6 +++--- drivers/dome/nexdome_beaver.h | 2 +- drivers/dome/rigel_dome.h | 2 +- drivers/dome/scopedome_dome.h | 2 +- drivers/filter_wheel/ifwoptec.cpp | 6 +++--- drivers/filter_wheel/ifwoptec.h | 2 +- drivers/filter_wheel/pegasus_indigo.h | 2 +- drivers/filter_wheel/xagyl_wheel.h | 2 +- drivers/focuser/aaf2.h | 8 ++++---- drivers/focuser/celestron.cpp | 4 ++-- drivers/focuser/celestron.h | 4 ++-- drivers/focuser/focuslynx.cpp | 12 +++++------ drivers/focuser/focuslynxbase.cpp | 14 ++++++------- drivers/focuser/lacerta_mfoc.cpp | 2 +- drivers/focuser/lakeside.cpp | 4 ++-- drivers/focuser/moonlite.h | 8 ++++---- drivers/focuser/myfocuserpro2.cpp | 4 ++-- drivers/focuser/myfocuserpro2.h | 6 +++--- drivers/focuser/nfocus.h | 2 +- drivers/focuser/nstep.h | 2 +- drivers/focuser/planewave_efa.cpp | 2 +- drivers/focuser/planewave_efa.h | 2 +- drivers/focuser/primalucacommandset.h | 8 ++++---- drivers/focuser/rainbowRSF.h | 2 +- drivers/focuser/rbfocus.h | 4 ++-- drivers/focuser/robofocus.cpp | 2 +- drivers/focuser/sestosenso.cpp | 2 +- drivers/focuser/sestosenso.h | 2 +- drivers/focuser/sestosenso2.cpp | 4 ++-- drivers/focuser/sestosenso2.h | 2 +- drivers/focuser/steeldrive.cpp | 2 +- drivers/focuser/steeldrive2.h | 4 ++-- drivers/focuser/tcfs.h | 2 +- drivers/receiver/indi_rtlsdr.cpp | 4 ++-- drivers/receiver/receiver_simulator.cpp | 4 ++-- drivers/rotator/gemini.cpp | 18 ++++++++--------- drivers/rotator/integra.cpp | 2 +- drivers/rotator/nframe.h | 4 ++-- drivers/rotator/pegasus_falcon.cpp | 2 +- drivers/rotator/pegasus_falcon.h | 2 +- drivers/rotator/pyxis.cpp | 2 +- drivers/skeleton/focuser_driver.cpp | 2 +- drivers/skeleton/focuser_driver.h | 6 +++--- drivers/skeleton/mount_driver.cpp | 2 +- drivers/skeleton/mount_driver.h | 8 ++++---- .../shelyak/indi_shelyak_usis.cpp | 2 +- drivers/telescope/astrotrac.cpp | 4 ++-- drivers/telescope/astrotrac.h | 6 +++--- drivers/telescope/celestrongps.cpp | 4 ++-- drivers/telescope/ieqdriverbase.h | 4 ++-- drivers/telescope/ieqpro.cpp | 4 ++-- drivers/telescope/ieqprolegacy.cpp | 4 ++-- drivers/telescope/ieqprolegacydriver.h | 2 +- drivers/telescope/ioptronHC8406.cpp | 14 ++++++------- drivers/telescope/ioptronv3.cpp | 6 +++--- drivers/telescope/ioptronv3driver.h | 2 +- drivers/telescope/lx200_10micron.cpp | 4 ++-- drivers/telescope/lx200_OnStep.cpp | 14 ++++++------- drivers/telescope/lx200_OnStep.h | 8 ++++---- drivers/telescope/lx200_TeenAstro.cpp | 4 ++-- drivers/telescope/lx200am5.h | 4 ++-- drivers/telescope/lx200ap_v2.cpp | 8 ++++---- drivers/telescope/lx200apdriver.cpp | 4 ++-- drivers/telescope/lx200basic.cpp | 2 +- drivers/telescope/lx200classic.cpp | 2 +- drivers/telescope/lx200driver.cpp | 6 +++--- drivers/telescope/lx200driver.h | 8 ++++---- drivers/telescope/lx200fs2.cpp | 2 +- drivers/telescope/lx200generic.cpp | 2 +- drivers/telescope/lx200gotonova.cpp | 2 +- drivers/telescope/lx200pulsar2.cpp | 2 +- drivers/telescope/lx200telescope.cpp | 2 +- drivers/telescope/lx200telescope.h | 2 +- drivers/telescope/lx200zeq25.cpp | 2 +- drivers/telescope/magellan1.h | 2 +- drivers/telescope/magellandriver.h | 2 +- drivers/telescope/paramount.cpp | 4 ++-- drivers/telescope/planewave_mount.h | 2 +- drivers/telescope/pmc8.cpp | 4 ++-- drivers/telescope/pmc8driver.cpp | 2 +- drivers/telescope/pmc8driver.h | 2 +- drivers/telescope/rainbow.h | 2 +- drivers/telescope/scopesim_helper.cpp | 2 +- drivers/telescope/scopesim_helper.h | 4 ++-- drivers/telescope/skywatcherAPI.h | 2 +- drivers/telescope/synscandriver.cpp | 6 +++--- drivers/telescope/synscandriver.h | 6 +++--- drivers/telescope/synscandriverlegacy.cpp | 2 +- drivers/telescope/telescope_simulator.cpp | 4 ++-- drivers/telescope/telescope_simulator.h | 4 ++-- drivers/telescope/temmadriver.cpp | 12 +++++------ drivers/video/v4l2driver.cpp | 6 +++--- drivers/video/v4l2driver.h | 2 +- drivers/weather/mbox.cpp | 2 +- drivers/weather/vantage.cpp | 2 +- examples/README | 2 +- examples/tutorial_eight/simple_receiver.cpp | 4 ++-- examples/tutorial_five/dome.cpp | 2 +- examples/tutorial_five/raindetector.cpp | 2 +- examples/tutorial_six/tutorial_client.cpp | 2 +- examples/tutorial_three/simpleccd.cpp | 4 ++-- examples/tutorial_two/simplescope.cpp | 10 +++++----- indiserver/indiserver.cpp | 18 ++++++++--------- integs/ProcessController.cpp | 2 +- integs/ServerMock.h | 2 +- integs/TestClientQueries.cpp | 2 +- integs/customTestProps.cmake | 2 +- libs/alignment/AlignmentSubsystemForDrivers.h | 4 ++-- libs/alignment/BasicMathPlugin.cpp | 4 ++-- libs/alignment/BasicMathPlugin.h | 4 ++-- libs/alignment/BuiltInMathPlugin.h | 2 +- .../ClientAPIForAlignmentDatabase.cpp | 20 +++++++++---------- .../ClientAPIForMathPluginManagement.cpp | 8 ++++---- .../ClientAPIForMathPluginManagement.h | 2 +- libs/alignment/Common.h | 4 ++-- libs/alignment/InMemoryDatabase.h | 2 +- .../MapPropertiesToInMemoryDatabase.h | 2 +- libs/alignment/MathPlugin.h | 4 ++-- libs/alignment/NearestMathPlugin.cpp | 2 +- libs/alignment/SVDMathPlugin.cpp | 2 +- libs/alignment/SVDMathPlugin.h | 2 +- ...TelescopeDirectionVectorSupportFunctions.h | 2 +- libs/alignment/alignment_white_paper.md | 8 ++++---- libs/dsp/dsp.h | 14 ++++++------- libs/dsp/fits.h | 12 +++++------ libs/dsp/sdfits.h | 4 ++-- libs/fpack/fpackutil.c | 6 +++--- libs/hid/hid_libusb.c | 8 ++++---- libs/hid/hid_mac.c | 6 +++--- libs/hid/hid_win.c | 2 +- libs/hid/hidtest.cpp | 2 +- .../indiabstractclient/abstractbaseclient.cpp | 2 +- libs/indiabstractclient/abstractbaseclient.h | 2 +- .../connectionplugins/connectioninterface.h | 2 +- .../connectionplugins/connectiontcp.h | 2 +- libs/indibase/connectionplugins/ttybase.cpp | 2 +- libs/indibase/connectionplugins/ttybase.h | 2 +- libs/indibase/defaultdevice.cpp | 6 +++--- libs/indibase/defaultdevice.h | 10 +++++----- libs/indibase/indiccd.cpp | 2 +- libs/indibase/indiccd.h | 10 +++++----- libs/indibase/indiccdchip.h | 4 ++-- libs/indibase/indicontroller.h | 2 +- libs/indibase/indicorrelator.h | 2 +- libs/indibase/indidome.cpp | 4 ++-- libs/indibase/indidome.h | 12 +++++------ libs/indibase/indidriver.c | 2 +- libs/indibase/indidriver.h | 6 +++--- libs/indibase/indidrivermain.c | 6 +++--- libs/indibase/indidustcapinterface.h | 8 ++++---- libs/indibase/indifilterinterface.h | 6 +++--- libs/indibase/indifocuserinterface.h | 4 ++-- libs/indibase/indigpsinterface.h | 2 +- libs/indibase/indiguiderinterface.h | 2 +- libs/indibase/indilightboxinterface.h | 8 ++++---- libs/indibase/indirotator.h | 2 +- libs/indibase/indirotatorinterface.h | 8 ++++---- libs/indibase/indisensorinterface.h | 6 +++--- libs/indibase/inditelescope.cpp | 4 ++-- libs/indibase/inditelescope.h | 10 +++++----- libs/indibase/indiweather.h | 2 +- libs/indibase/indiweatherinterface.h | 4 ++-- libs/indibase/stream/ccvt.h | 2 +- libs/indibase/stream/ccvt_misc.c | 2 +- libs/indibase/stream/jpegutils.c | 4 ++-- libs/indibase/stream/jpegutils.h | 2 +- libs/indibase/stream/recorder/serrecorder.cpp | 2 +- .../stream/recorder/theorarecorder.cpp | 2 +- libs/indibase/stream/streammanager.cpp | 2 +- libs/indibase/stream/streammanager_p.h | 2 +- libs/indibase/webcam/pwc-ioctl.h | 2 +- libs/indibase/webcam/v4l2_base.cpp | 4 ++-- .../v4l2_decode/v4l2_builtin_decoder.cpp | 4 ++-- libs/indiclient/baseclient.cpp | 2 +- libs/indiclient/baseclient.h | 2 +- libs/indiclientqt/baseclientqt.cpp | 2 +- libs/indiclientqt/baseclientqt.h | 2 +- libs/indicore/base64.h | 2 +- libs/indicore/indiapi.h.in | 10 +++++----- libs/indicore/indicom.c | 2 +- libs/indicore/indicom.h | 18 ++++++++--------- libs/indicore/indidevapi.h | 6 +++--- libs/indicore/lilxml.cpp | 8 ++++---- libs/indicore/lilxml.h | 8 ++++---- libs/indidevice/basedevice.h | 8 ++++---- libs/indidevice/basedevice_p.h | 2 +- libs/indidevice/indibase.h | 4 ++-- libs/indidevice/indistandardproperty.h | 4 ++-- libs/inicpp.h | 4 ++-- libs/json.h | 4 ++-- tools/compiler.c | 6 +++--- tools/evalINDI.c | 2 +- 207 files changed, 439 insertions(+), 439 deletions(-) diff --git a/README.md b/README.md index 520ecc20eb..2bde161620 100644 --- a/README.md +++ b/README.md @@ -256,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/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