From 16086249f60d2890648401ed61c1ee1e083575c6 Mon Sep 17 00:00:00 2001 From: Salman Naheed Date: Sun, 21 Apr 2024 17:19:29 +0300 Subject: [PATCH] Migrate Wanderer rotator lite --- drivers/rotator/wanderer_rotator_lite.cpp | 14 +++++++------- drivers/rotator/wanderer_rotator_lite.h | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/rotator/wanderer_rotator_lite.cpp b/drivers/rotator/wanderer_rotator_lite.cpp index 5ce8569a50..f823232735 100644 --- a/drivers/rotator/wanderer_rotator_lite.cpp +++ b/drivers/rotator/wanderer_rotator_lite.cpp @@ -44,8 +44,8 @@ bool WandererRotatorLite::initProperties() INDI::Rotator::initProperties(); setDefaultPollingPeriod(500); serialConnection->setDefaultBaudRate(Connection::Serial::B_19200); - IUFillSwitch(&HomeS[0], "SetHomeButton", "Set Current Position as Home", ISS_OFF); - IUFillSwitchVector(&HomeSP, HomeS, 1, getDeviceName(), "SetHome", "Set Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 5, + HomeSP[0].fill("SetHomeButton", "Set Current Position as Home", ISS_OFF); + HomeSP.fill(getDeviceName(), "SetHome", "Set Home", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 5, IPS_IDLE); return true; @@ -58,13 +58,13 @@ bool WandererRotatorLite::updateProperties() if (isConnected()) { - defineProperty(&HomeSP); + defineProperty(HomeSP); deleteProperty(PresetNP.name); deleteProperty(PresetGotoSP.name); } else { - deleteProperty(HomeSP.name); + deleteProperty(HomeSP); deleteProperty(PresetNP.name); deleteProperty(PresetGotoSP.name); } @@ -75,13 +75,13 @@ bool WandererRotatorLite::ISNewSwitch(const char *dev, const char *name, ISState { if (dev && !strcmp(dev, getDeviceName())) { - if (!strcmp(name, HomeSP.name)) + if (HomeSP.isNameMatch(name)) { - HomeSP.s = SetHomePosition() ? IPS_OK : IPS_ALERT; + HomeSP.setState(SetHomePosition() ? IPS_OK : IPS_ALERT); GotoRotatorN[0].value = 0; LOG_INFO("Home is set"); - IDSetSwitch(&HomeSP, nullptr); + HomeSP.apply(); IDSetNumber(&GotoRotatorNP, nullptr); return true; diff --git a/drivers/rotator/wanderer_rotator_lite.h b/drivers/rotator/wanderer_rotator_lite.h index 74737ac288..b399a09358 100644 --- a/drivers/rotator/wanderer_rotator_lite.h +++ b/drivers/rotator/wanderer_rotator_lite.h @@ -52,8 +52,7 @@ class WandererRotatorLite : public INDI::Rotator bool Handshake() override; bool sendCommand(const char *cmd); bool Move(const char *cmd); - ISwitchVectorProperty HomeSP; - ISwitch HomeS[1]; + INDI::PropertySwitch HomeSP {1}; bool SetHomePosition(); bool haltcommand = false; bool ReverseState;