From 194f260f8ff1803388652cd4895df7207a3133fd Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:49:16 +0800 Subject: [PATCH 01/10] Update ieaffocus.cpp add iOptron iAFS focuser support --- drivers/focuser/ieaffocus.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/focuser/ieaffocus.cpp b/drivers/focuser/ieaffocus.cpp index d698c13831..a1421bf671 100644 --- a/drivers/focuser/ieaffocus.cpp +++ b/drivers/focuser/ieaffocus.cpp @@ -153,7 +153,8 @@ bool iEAFFocus::Ack() tcflush(PortFD, TCIOFLUSH); resp[nbytes_read] = '\0'; sscanf(resp, "%6d%2d%4d", &ieafpos, &ieafmodel, &ieaflast); - if (ieafmodel == 2) + //add iAFS Focuser + if ((ieafmodel == 2)||(ieafmodel == 3)) { return true; } From 0510a447ae9fc266cb7a43fe1a27b6965eb1811e Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Fri, 25 Oct 2024 18:04:30 +0800 Subject: [PATCH 02/10] Update drivers.xml --- drivers.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers.xml b/drivers.xml index 4bfadac863..bb85e52bf5 100644 --- a/drivers.xml +++ b/drivers.xml @@ -683,6 +683,10 @@ indi_pegasusindigo_wheel 1.0 + + indi_ioptron_wheel + 1.0 + From 47b334d8e1fb61ed2a93aea819dce549671b27b7 Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Fri, 25 Oct 2024 18:06:48 +0800 Subject: [PATCH 03/10] Add files via upload --- drivers/filter_wheel/ioptron_wheel.cpp | 333 +++++++++++++++++++++++++ drivers/filter_wheel/ioptron_wheel.h | 58 +++++ 2 files changed, 391 insertions(+) create mode 100644 drivers/filter_wheel/ioptron_wheel.cpp create mode 100644 drivers/filter_wheel/ioptron_wheel.h diff --git a/drivers/filter_wheel/ioptron_wheel.cpp b/drivers/filter_wheel/ioptron_wheel.cpp new file mode 100644 index 0000000000..08e60689ca --- /dev/null +++ b/drivers/filter_wheel/ioptron_wheel.cpp @@ -0,0 +1,333 @@ +/******************************************************************************* + Copyright(c) 2024 Joe Zhou. All rights reserved. + + iOptron Filter Wheel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*******************************************************************************/ + +#include "ioptron_wheel.h" + +#include "indicom.h" +#include +#include +#include +#include + +#define iEFW_TIMEOUT 4 + +/* +command : +:WMnn# Response: 1 +get position ,nn filter num。 + +:WP# Response: nn# or -1# +get curr position,nn =curr position,if is moving,return -1。 + +:WOnnsnnnnn# Response: 1 +set offset。nn =filter num , snnnnn=offset + +:WFnn# Response: snnnnn# +get offset 。nn = filter num , snnnnn=offset + +“:DeviceInfo#” Response: “nnnnnnnnnnnn#” +This command includes 12 digits. +The 7th and 8th digit means model of filter wheel. +Model number 99 is iEFW-15, 98 is iEFW18 + +:FW1# Response: nnnnnnnnnnnn# +get firmware version + + +*/ + + +static std::unique_ptr iefw_wheel(new iEFW()); + +iEFW::iEFW() +{ + setVersion(1, 0); + setFilterConnection(CONNECTION_SERIAL); +} + +const char *iEFW::getDefaultName() +{ + return "iOptron Wheel"; +} + +bool iEFW::initProperties() +{ + INDI::FilterWheel::initProperties(); + serialConnection->setDefaultPort("/dev/ttyUSB3"); + serialConnection->setDefaultBaudRate(Connection::Serial::B_115200); + FilterSlotN[0].min = 1; + FilterSlotN[0].max = 8; + // Firmware of the iEFW + IUFillText(&FirmwareT[0], "FIRMWARE", "Firmware", "Unknown"); + IUFillTextVector(&FirmwareTP, FirmwareT, 1, getDeviceName(), "FIRMWARE_ID", "iEFW Firmware", FILTER_TAB, IP_RO, 60, IPS_IDLE); + IUFillText(&WheelIDT[0], "MODEL", "Model", "iEFW"); + IUFillTextVector(&WheelIDTP, WheelIDT, 1, getDeviceName(), "MODEL_ID", "iEFW Model", FILTER_TAB, IP_RO, 60, IPS_IDLE); + return true; +} + +bool iEFW::updateProperties() +{ + INDI::FilterWheel::updateProperties(); + + if (isConnected()) + { + defineProperty(&HomeSP); + defineProperty(&FirmwareTP); + defineProperty(&WheelIDTP); + bool rc1=getiEFWInfo(); + bool rc2=getiEFWfirmwareInfo(); + getFilterPos(); + return (rc1 && rc2); + } + else + { + deleteProperty(HomeSP.name); + deleteProperty(FirmwareTP.name); + deleteProperty(WheelIDTP.name); + } + return true; +} + +bool iEFW::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) +{ + if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) + { + if (!strcmp(HomeSP.name, name)) + { + if (getiEFWID()) + { + LOG_INFO("Filter getid."); + HomeSP.s = IPS_OK; + FilterSlotNP.s = IPS_OK; + IDSetNumber(&FilterSlotNP, nullptr); + } + else + HomeSP.s = IPS_ALERT; + IDSetSwitch(&HomeSP, nullptr); + return true; + } + } + + return INDI::FilterWheel::ISNewSwitch(dev, name, states, names, n); +} + +bool iEFW::Handshake() +{ + + return getiEFWID(); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// +bool iEFW::getiEFWInfo() +{ + int nbytes_written = 0, nbytes_read = 0, rc = -1; + char resp[16]; + int iefwpos, iefwmodel, iefwlast; + sleep(2); + tcflush(PortFD, TCIOFLUSH); + if ( (rc = tty_write(PortFD, ":DeviceInfo#", strlen(":DeviceInfo#"), &nbytes_written)) != TTY_OK) + { + char errstr[MAXRBUF] = {0}; + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "Init send iEFW deviceinfo error: %s.", errstr); + return false; + }; + + if ( (rc = tty_read_section(PortFD, resp, '#', iEFW_TIMEOUT * 2, &nbytes_read)) != TTY_OK) + { + char errstr[MAXRBUF] = {0}; + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "Init read iEFW deviceinfo error: %s.", errstr); + return false; + }; + tcflush(PortFD, TCIOFLUSH); + resp[nbytes_read] = '\0'; + sscanf(resp, "%6d%2d%4d", &iefwpos, &iefwmodel, &iefwlast); + if ((iefwmodel == 98)|| (iefwmodel == 99)) + { + if (iefwmodel==99) + { + FilterSlotN[0].max = 5; + WheelIDTP.s = IPS_OK; + IUSaveText(&WheelIDT[0], "iEFW-15"); + IDSetText(&WheelIDTP, "iEFW Model is %s", "iEFW-15"); + }; + if (iefwmodel==98) + { + FilterSlotN[0].max = 8; + WheelIDTP.s = IPS_OK; + IUSaveText(&WheelIDT[0], "iEFW-18"); + IDSetText(&WheelIDTP, "iEFW Model is %s", "iEFW-18"); + }; + return true; + } + else + { + DEBUGF(INDI::Logger::DBG_ERROR, "iEFW getinfo Response: %s", resp); + return false; + } + + return true; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////// +bool iEFW::getiEFWfirmwareInfo() +{ + int nbytes_written = 0, nbytes_read = 0, rc = -1; + char errstr[MAXRBUF]; + char resp[16] = {0}; + char iefwfirminfo[16] = {0}; + tcflush(PortFD, TCIOFLUSH); + if ( (rc = tty_write(PortFD, ":FW1#", 5, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "get iEFW FiremwareInfo error: %s.", errstr); + } + if ( (rc = tty_read_section(PortFD, resp, '#', iEFW_TIMEOUT, &nbytes_read)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "get iEFW FirmwareInfo error: %s.", errstr); + return false; + } + tcflush(PortFD, TCIOFLUSH); + resp[nbytes_read] = '\0'; + sscanf(resp, "%12s", iefwfirminfo); + FirmwareTP.s = IPS_OK; + IUSaveText(&FirmwareT[0], iefwfirminfo); + IDSetText(&FirmwareTP, "iEFW Firmware is %s", iefwfirminfo); + LOGF_DEBUG("Success, response from iEFW is : %s", iefwfirminfo); + return true; +} + +int iEFW::getFilterPos() +{ + int nbytes_written = 0, nbytes_read = 0, rc = -1; + char errstr[MAXRBUF]; + char resp[16] = {0}; +// char iefwposinfo[16] = {0}; + int iefwpos = 1; + tcflush(PortFD, TCIOFLUSH); + if ( (rc = tty_write(PortFD, ":WP#", 4, &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "send iEFW filter pos Info error: %s.", errstr); + } + if ( (rc = tty_read_section(PortFD, resp, '#', iEFW_TIMEOUT, &nbytes_read)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "read iEFW filter pos Info error: %s.", errstr); + return false; + } + tcflush(PortFD, TCIOFLUSH); + resp[nbytes_read] = '\0'; + LOGF_DEBUG("Success, response from iEFW is : %s", resp); + rc=sscanf(resp, "%2d", &iefwpos); + if (rc > 0) + { + if (iefwpos>=0) + { + CurrentFilter=iefwpos+1; + FilterSlotN[0].value = CurrentFilter; + FilterSlotNP.s = IPS_OK; + return CurrentFilter; + } + else + return -1; + } + else + return 999; + +} + + +bool iEFW::getiEFWID() +{ + return getiEFWInfo(); +} +///////////////////////////////////////////////////////////////////////////// +/* +void iEFW::initOffset() +{ + +} + + +bool iEFW::setOffset(int filter, int shift) +{ + + return true; +} + +///////////////////////////////////////////////////////////////////////////// +bool iEFW::getOffset(int filter) +{ + return true; +} +*/ +///////////////////////////////////////////////////////////////////////////// + +bool iEFW::SelectFilter(int f) +{ + int nbytes_written = 0, rc = -1; + char errstr[MAXRBUF]; + // char resp[16] = {0}; + // char iefwposinfo[16] = {0}; + int iefwpos=-1; + char cmd[7]={0}; + if (CurrentFilter == f) + { + SelectFilterDone(CurrentFilter); + return true; + } + f = f - 1; + + if (f < 0 || f > (FilterSlotN[0].max-1)) + return false; + + tcflush(PortFD, TCIOFLUSH); + snprintf(cmd,7, ":WM0%d#", f); + if ( (rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK) + { + tty_error_msg(rc, errstr, MAXRBUF); + DEBUGF(INDI::Logger::DBG_ERROR, "select iEFW send pos Info error: %s.", errstr); + } + tcflush(PortFD, TCIOFLUSH); + // check current position -1 is moving + do + { + usleep(100 * 1000); + iefwpos=getFilterPos(); + } + while (iefwpos == -1); + // return current position to indi + CurrentFilter = f + 1; + SelectFilterDone(CurrentFilter); + FilterSlotNP.s = IPS_OK; + IDSetNumber(&FilterSlotNP, "Selected filter position reached"); + LOGF_DEBUG("CurrentFilter set to %d", CurrentFilter); + return true; +} + +int iEFW::QueryFilter() +{ + return CurrentFilter; +} + diff --git a/drivers/filter_wheel/ioptron_wheel.h b/drivers/filter_wheel/ioptron_wheel.h new file mode 100644 index 0000000000..86b102145e --- /dev/null +++ b/drivers/filter_wheel/ioptron_wheel.h @@ -0,0 +1,58 @@ +/******************************************************************************* + Copyright(c) 2024 Joe Zhou. All rights reserved. + + iOptron Filter Wheel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*******************************************************************************/ + +#pragma once + +#include "indifilterwheel.h" + +class iEFW : public INDI::FilterWheel +{ + public: + iEFW(); + virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override; + + protected: + const char *getDefaultName() override; + bool initProperties() override; + bool updateProperties() override; + bool Handshake() override; + int QueryFilter() override; + bool SelectFilter(int) override; +// void TimerHit() override; + int getFilterPos(); + // Firmware of the iEFW + ITextVectorProperty FirmwareTP; + IText FirmwareT[1] {}; + // Filter Wheel ID + ITextVectorProperty WheelIDTP; + IText WheelIDT[1] {}; + + private: + + bool getiEFWID(); + bool getiEFWInfo(); + bool getiEFWfirmwareInfo(); + void initOffset(); + // Calibration offset + bool getOffset(int filter); + bool setOffset(int filter, int shift); + ISwitch HomeS[1]; + ISwitchVectorProperty HomeSP; +}; From c6017fe5b33d559ebbaabd758f93b30136ba5a77 Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Fri, 25 Oct 2024 18:08:52 +0800 Subject: [PATCH 04/10] Update CMakeLists.txt --- drivers/filter_wheel/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/filter_wheel/CMakeLists.txt b/drivers/filter_wheel/CMakeLists.txt index 8975ff93cd..ed6069c164 100644 --- a/drivers/filter_wheel/CMakeLists.txt +++ b/drivers/filter_wheel/CMakeLists.txt @@ -78,3 +78,11 @@ add_executable(indi_pegasusindigo_wheel ${pegasus_indigo_SRC}) target_link_libraries(indi_pegasusindigo_wheel indidriver) install(TARGETS indi_pegasusindigo_wheel RUNTIME DESTINATION bin) + +# ############### iOptron Filter Wheel ################ +SET(ioptron_wheel_SRC + ioptron_wheel.cpp) + +add_executable(indi_ioptron_wheel ${ioptron_wheel_SRC}) +target_link_libraries(indi_ioptron_wheel indidriver) +install(TARGETS indi_ioptron_wheel RUNTIME DESTINATION bin) From 0263bf8abaa350549c64c0b490bae6ec6385c2b8 Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Sat, 26 Oct 2024 05:57:42 +0800 Subject: [PATCH 05/10] Add files via upload --- drivers/filter_wheel/ioptron_wheel.cpp | 54 +++++++++++++------------- drivers/filter_wheel/ioptron_wheel.h | 10 ++--- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/drivers/filter_wheel/ioptron_wheel.cpp b/drivers/filter_wheel/ioptron_wheel.cpp index 08e60689ca..38dd39183f 100644 --- a/drivers/filter_wheel/ioptron_wheel.cpp +++ b/drivers/filter_wheel/ioptron_wheel.cpp @@ -44,7 +44,7 @@ get offset 。nn = filter num , snnnnn=offset “:DeviceInfo#” Response: “nnnnnnnnnnnn#” This command includes 12 digits. -The 7th and 8th digit means model of filter wheel. +The 7th and 8th digit means model of filter wheel. Model number 99 is iEFW-15, 98 is iEFW18 :FW1# Response: nnnnnnnnnnnn# @@ -74,11 +74,10 @@ bool iEFW::initProperties() serialConnection->setDefaultBaudRate(Connection::Serial::B_115200); FilterSlotN[0].min = 1; FilterSlotN[0].max = 8; - // Firmware of the iEFW - IUFillText(&FirmwareT[0], "FIRMWARE", "Firmware", "Unknown"); - IUFillTextVector(&FirmwareTP, FirmwareT, 1, getDeviceName(), "FIRMWARE_ID", "iEFW Firmware", FILTER_TAB, IP_RO, 60, IPS_IDLE); - IUFillText(&WheelIDT[0], "MODEL", "Model", "iEFW"); - IUFillTextVector(&WheelIDTP, WheelIDT, 1, getDeviceName(), "MODEL_ID", "iEFW Model", FILTER_TAB, IP_RO, 60, IPS_IDLE); + FirmwareTP[0].fill("FIRMWARE", "Firmware", "240101240101"); + FirmwareTP.fill(getDeviceName(), "FIRMWARE_ID", "iEFW Firmware", FILTER_TAB, IP_RO, 60, IPS_IDLE); + WheelIDTP[0].fill("MODEL", "Model", "iEFW"); + WheelIDTP.fill(getDeviceName(), "MODEL_ID", "iEFW Model", FILTER_TAB, IP_RO, 60, IPS_IDLE); return true; } @@ -88,9 +87,9 @@ bool iEFW::updateProperties() if (isConnected()) { - defineProperty(&HomeSP); - defineProperty(&FirmwareTP); - defineProperty(&WheelIDTP); + defineProperty(HomeSP); + defineProperty(FirmwareTP); + defineProperty(WheelIDTP); bool rc1=getiEFWInfo(); bool rc2=getiEFWfirmwareInfo(); getFilterPos(); @@ -98,9 +97,9 @@ bool iEFW::updateProperties() } else { - deleteProperty(HomeSP.name); - deleteProperty(FirmwareTP.name); - deleteProperty(WheelIDTP.name); + deleteProperty(HomeSP); + deleteProperty(FirmwareTP); + deleteProperty(WheelIDTP); } return true; } @@ -109,18 +108,17 @@ bool iEFW::ISNewSwitch(const char *dev, const char *name, ISState *states, char { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { - if (!strcmp(HomeSP.name, name)) + if (HomeSP.isNameMatch(name)) { if (getiEFWID()) { LOG_INFO("Filter getid."); - HomeSP.s = IPS_OK; - FilterSlotNP.s = IPS_OK; - IDSetNumber(&FilterSlotNP, nullptr); + HomeSP.setState(IPS_OK); + HomeSP.apply(); } else - HomeSP.s = IPS_ALERT; - IDSetSwitch(&HomeSP, nullptr); + HomeSP.setState(IPS_ALERT); + HomeSP.apply(); return true; } } @@ -165,16 +163,17 @@ bool iEFW::getiEFWInfo() if (iefwmodel==99) { FilterSlotN[0].max = 5; - WheelIDTP.s = IPS_OK; - IUSaveText(&WheelIDT[0], "iEFW-15"); - IDSetText(&WheelIDTP, "iEFW Model is %s", "iEFW-15"); + WheelIDTP.setState(IPS_OK); + WheelIDTP[0].setText("iEFW-15"); + WheelIDTP.apply(); }; if (iefwmodel==98) { FilterSlotN[0].max = 8; - WheelIDTP.s = IPS_OK; - IUSaveText(&WheelIDT[0], "iEFW-18"); - IDSetText(&WheelIDTP, "iEFW Model is %s", "iEFW-18"); + WheelIDTP.setState(IPS_OK); + WheelIDTP[0].setText("iEFW-18"); + WheelIDTP.apply(); + }; return true; } @@ -210,9 +209,9 @@ bool iEFW::getiEFWfirmwareInfo() tcflush(PortFD, TCIOFLUSH); resp[nbytes_read] = '\0'; sscanf(resp, "%12s", iefwfirminfo); - FirmwareTP.s = IPS_OK; - IUSaveText(&FirmwareT[0], iefwfirminfo); - IDSetText(&FirmwareTP, "iEFW Firmware is %s", iefwfirminfo); + FirmwareTP.setState(IPS_OK); + FirmwareTP[0].setText(iefwfirminfo); + FirmwareTP.apply(); LOGF_DEBUG("Success, response from iEFW is : %s", iefwfirminfo); return true; } @@ -222,7 +221,6 @@ int iEFW::getFilterPos() int nbytes_written = 0, nbytes_read = 0, rc = -1; char errstr[MAXRBUF]; char resp[16] = {0}; -// char iefwposinfo[16] = {0}; int iefwpos = 1; tcflush(PortFD, TCIOFLUSH); if ( (rc = tty_write(PortFD, ":WP#", 4, &nbytes_written)) != TTY_OK) diff --git a/drivers/filter_wheel/ioptron_wheel.h b/drivers/filter_wheel/ioptron_wheel.h index 86b102145e..e53145c127 100644 --- a/drivers/filter_wheel/ioptron_wheel.h +++ b/drivers/filter_wheel/ioptron_wheel.h @@ -38,11 +38,8 @@ class iEFW : public INDI::FilterWheel // void TimerHit() override; int getFilterPos(); // Firmware of the iEFW - ITextVectorProperty FirmwareTP; - IText FirmwareT[1] {}; - // Filter Wheel ID - ITextVectorProperty WheelIDTP; - IText WheelIDT[1] {}; + INDI::PropertyText FirmwareTP {1}; + INDI::PropertyText WheelIDTP {1};; private: @@ -53,6 +50,5 @@ class iEFW : public INDI::FilterWheel // Calibration offset bool getOffset(int filter); bool setOffset(int filter, int shift); - ISwitch HomeS[1]; - ISwitchVectorProperty HomeSP; + INDI::PropertySwitch HomeSP{1}; }; From 31fc1a37ad41c709151487fc130620452aa8fe6b Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Sun, 27 Oct 2024 08:35:05 +0800 Subject: [PATCH 06/10] Update ioptron_wheel.cpp --- drivers/filter_wheel/ioptron_wheel.cpp | 39 ++++++-------------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/drivers/filter_wheel/ioptron_wheel.cpp b/drivers/filter_wheel/ioptron_wheel.cpp index 38dd39183f..79b99b05cf 100644 --- a/drivers/filter_wheel/ioptron_wheel.cpp +++ b/drivers/filter_wheel/ioptron_wheel.cpp @@ -70,7 +70,7 @@ const char *iEFW::getDefaultName() bool iEFW::initProperties() { INDI::FilterWheel::initProperties(); - serialConnection->setDefaultPort("/dev/ttyUSB3"); +// serialConnection->setDefaultPort("/dev/ttyUSB3"); serialConnection->setDefaultBaudRate(Connection::Serial::B_115200); FilterSlotN[0].min = 1; FilterSlotN[0].max = 8; @@ -144,7 +144,7 @@ bool iEFW::getiEFWInfo() { char errstr[MAXRBUF] = {0}; tty_error_msg(rc, errstr, MAXRBUF); - DEBUGF(INDI::Logger::DBG_ERROR, "Init send iEFW deviceinfo error: %s.", errstr); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "Init send iEFW deviceinfo error: %s.", errstr); return false; }; @@ -152,7 +152,7 @@ bool iEFW::getiEFWInfo() { char errstr[MAXRBUF] = {0}; tty_error_msg(rc, errstr, MAXRBUF); - DEBUGF(INDI::Logger::DBG_ERROR, "Init read iEFW deviceinfo error: %s.", errstr); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "Init read iEFW deviceinfo error: %s.", errstr); return false; }; tcflush(PortFD, TCIOFLUSH); @@ -179,7 +179,7 @@ bool iEFW::getiEFWInfo() } else { - DEBUGF(INDI::Logger::DBG_ERROR, "iEFW getinfo Response: %s", resp); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "iEFW getinfo Response: %s", resp); return false; } @@ -198,12 +198,12 @@ bool iEFW::getiEFWfirmwareInfo() if ( (rc = tty_write(PortFD, ":FW1#", 5, &nbytes_written)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - DEBUGF(INDI::Logger::DBG_ERROR, "get iEFW FiremwareInfo error: %s.", errstr); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "get iEFW FiremwareInfo error: %s.", errstr); } if ( (rc = tty_read_section(PortFD, resp, '#', iEFW_TIMEOUT, &nbytes_read)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - DEBUGF(INDI::Logger::DBG_ERROR, "get iEFW FirmwareInfo error: %s.", errstr); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "get iEFW FirmwareInfo error: %s.", errstr); return false; } tcflush(PortFD, TCIOFLUSH); @@ -226,12 +226,12 @@ int iEFW::getFilterPos() if ( (rc = tty_write(PortFD, ":WP#", 4, &nbytes_written)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - DEBUGF(INDI::Logger::DBG_ERROR, "send iEFW filter pos Info error: %s.", errstr); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "send iEFW filter pos Info error: %s.", errstr); } if ( (rc = tty_read_section(PortFD, resp, '#', iEFW_TIMEOUT, &nbytes_read)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - DEBUGF(INDI::Logger::DBG_ERROR, "read iEFW filter pos Info error: %s.", errstr); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "read iEFW filter pos Info error: %s.", errstr); return false; } tcflush(PortFD, TCIOFLUSH); @@ -260,27 +260,6 @@ bool iEFW::getiEFWID() { return getiEFWInfo(); } -///////////////////////////////////////////////////////////////////////////// -/* -void iEFW::initOffset() -{ - -} - - -bool iEFW::setOffset(int filter, int shift) -{ - - return true; -} - -///////////////////////////////////////////////////////////////////////////// -bool iEFW::getOffset(int filter) -{ - return true; -} -*/ -///////////////////////////////////////////////////////////////////////////// bool iEFW::SelectFilter(int f) { @@ -305,7 +284,7 @@ bool iEFW::SelectFilter(int f) if ( (rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - DEBUGF(INDI::Logger::DBG_ERROR, "select iEFW send pos Info error: %s.", errstr); + LOGF_ERROR(INDI::Logger::DBG_ERROR, "select iEFW send pos Info error: %s.", errstr); } tcflush(PortFD, TCIOFLUSH); // check current position -1 is moving From d1e650dded0bb84335449713d5bec805e2c4a185 Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Sun, 27 Oct 2024 08:38:01 +0800 Subject: [PATCH 07/10] Update ioptron_wheel.h --- drivers/filter_wheel/ioptron_wheel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/filter_wheel/ioptron_wheel.h b/drivers/filter_wheel/ioptron_wheel.h index e53145c127..ac93ef6987 100644 --- a/drivers/filter_wheel/ioptron_wheel.h +++ b/drivers/filter_wheel/ioptron_wheel.h @@ -48,7 +48,7 @@ class iEFW : public INDI::FilterWheel bool getiEFWfirmwareInfo(); void initOffset(); // Calibration offset - bool getOffset(int filter); - bool setOffset(int filter, int shift); + // bool getOffset(int filter); + // bool setOffset(int filter, int shift); INDI::PropertySwitch HomeSP{1}; }; From 43b7ee8b92255a753eac0bf4ddf7083e3b6dcf25 Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Sun, 27 Oct 2024 08:46:06 +0800 Subject: [PATCH 08/10] Update ioptron_wheel.cpp --- drivers/filter_wheel/ioptron_wheel.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/filter_wheel/ioptron_wheel.cpp b/drivers/filter_wheel/ioptron_wheel.cpp index 79b99b05cf..b69fb099ac 100644 --- a/drivers/filter_wheel/ioptron_wheel.cpp +++ b/drivers/filter_wheel/ioptron_wheel.cpp @@ -144,7 +144,7 @@ bool iEFW::getiEFWInfo() { char errstr[MAXRBUF] = {0}; tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR(INDI::Logger::DBG_ERROR, "Init send iEFW deviceinfo error: %s.", errstr); + LOGF_ERROR( "Init send iEFW deviceinfo error: %s.", errstr); return false; }; @@ -152,7 +152,7 @@ bool iEFW::getiEFWInfo() { char errstr[MAXRBUF] = {0}; tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR(INDI::Logger::DBG_ERROR, "Init read iEFW deviceinfo error: %s.", errstr); + LOGF_ERROR( "Init read iEFW deviceinfo error: %s.", errstr); return false; }; tcflush(PortFD, TCIOFLUSH); @@ -179,7 +179,7 @@ bool iEFW::getiEFWInfo() } else { - LOGF_ERROR(INDI::Logger::DBG_ERROR, "iEFW getinfo Response: %s", resp); + LOGF_ERROR( "iEFW getinfo Response: %s", resp); return false; } @@ -198,12 +198,12 @@ bool iEFW::getiEFWfirmwareInfo() if ( (rc = tty_write(PortFD, ":FW1#", 5, &nbytes_written)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR(INDI::Logger::DBG_ERROR, "get iEFW FiremwareInfo error: %s.", errstr); + LOGF_ERROR( "get iEFW FiremwareInfo error: %s.", errstr); } if ( (rc = tty_read_section(PortFD, resp, '#', iEFW_TIMEOUT, &nbytes_read)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR(INDI::Logger::DBG_ERROR, "get iEFW FirmwareInfo error: %s.", errstr); + LOGF_ERROR( "get iEFW FirmwareInfo error: %s.", errstr); return false; } tcflush(PortFD, TCIOFLUSH); @@ -226,12 +226,12 @@ int iEFW::getFilterPos() if ( (rc = tty_write(PortFD, ":WP#", 4, &nbytes_written)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR(INDI::Logger::DBG_ERROR, "send iEFW filter pos Info error: %s.", errstr); + LOGF_ERROR( "send iEFW filter pos Info error: %s.", errstr); } if ( (rc = tty_read_section(PortFD, resp, '#', iEFW_TIMEOUT, &nbytes_read)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR(INDI::Logger::DBG_ERROR, "read iEFW filter pos Info error: %s.", errstr); + LOGF_ERROR( "read iEFW filter pos Info error: %s.", errstr); return false; } tcflush(PortFD, TCIOFLUSH); @@ -284,7 +284,7 @@ bool iEFW::SelectFilter(int f) if ( (rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK) { tty_error_msg(rc, errstr, MAXRBUF); - LOGF_ERROR(INDI::Logger::DBG_ERROR, "select iEFW send pos Info error: %s.", errstr); + LOGF_ERROR( "select iEFW send pos Info error: %s.", errstr); } tcflush(PortFD, TCIOFLUSH); // check current position -1 is moving From 4a0417da71b418d4c9549f82fee9e7632da8554f Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Sun, 27 Oct 2024 08:54:58 +0800 Subject: [PATCH 09/10] Update ioptron_wheel.h --- drivers/filter_wheel/ioptron_wheel.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/filter_wheel/ioptron_wheel.h b/drivers/filter_wheel/ioptron_wheel.h index ac93ef6987..659348e621 100644 --- a/drivers/filter_wheel/ioptron_wheel.h +++ b/drivers/filter_wheel/ioptron_wheel.h @@ -47,8 +47,5 @@ class iEFW : public INDI::FilterWheel bool getiEFWInfo(); bool getiEFWfirmwareInfo(); void initOffset(); - // Calibration offset - // bool getOffset(int filter); - // bool setOffset(int filter, int shift); INDI::PropertySwitch HomeSP{1}; }; From a2937e30d946c4b2b933d39bee0b8efb05a2feeb Mon Sep 17 00:00:00 2001 From: joe13905179063 <150975019+joe13905179063@users.noreply.github.com> Date: Mon, 28 Oct 2024 08:31:09 +0800 Subject: [PATCH 10/10] Update ioptron_wheel.cpp --- drivers/filter_wheel/ioptron_wheel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/filter_wheel/ioptron_wheel.cpp b/drivers/filter_wheel/ioptron_wheel.cpp index b69fb099ac..0201e1f041 100644 --- a/drivers/filter_wheel/ioptron_wheel.cpp +++ b/drivers/filter_wheel/ioptron_wheel.cpp @@ -112,7 +112,7 @@ bool iEFW::ISNewSwitch(const char *dev, const char *name, ISState *states, char { if (getiEFWID()) { - LOG_INFO("Filter getid."); + LOG_INFO("Filter is at home position"); HomeSP.setState(IPS_OK); HomeSP.apply(); }