From 0b232210c54945b4c5f653130819ae8e0d61b9c9 Mon Sep 17 00:00:00 2001 From: Salman Naheed Date: Thu, 8 Feb 2024 08:38:39 +0300 Subject: [PATCH] Undo changes for SlewRateSP, since it's common and require changes in many drivers as well --- drivers/telescope/telescope_simulator.cpp | 22 +++++++++++----------- libs/indibase/inditelescope.h | 3 +-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/telescope/telescope_simulator.cpp b/drivers/telescope/telescope_simulator.cpp index c05d9a85b3..7c6cf64752 100644 --- a/drivers/telescope/telescope_simulator.cpp +++ b/drivers/telescope/telescope_simulator.cpp @@ -100,11 +100,11 @@ bool ScopeSim::initProperties() IUFillNumberVector(&GuideRateNP, GuideRateN, 2, getDeviceName(), "GUIDE_RATE", "Guiding Rate", MOTION_TAB, IP_RW, 0, IPS_IDLE); - SlewRateSP[SLEW_GUIDE].fill("SLEW_GUIDE", "Guide", ISS_OFF); - SlewRateSP[SLEW_CENTERING].fill("SLEW_CENTERING", "Centering", ISS_OFF); - SlewRateSP[SLEW_FIND].fill("SLEW_FIND", "Find", ISS_OFF); - SlewRateSP[SLEW_MAX].fill("SLEW_MAX", "Max", ISS_ON); - SlewRateSP.fill(getDeviceName(), "TELESCOPE_SLEW_RATE", "Slew Rate", MOTION_TAB, + IUFillSwitch(&SlewRateS[SLEW_GUIDE], "SLEW_GUIDE", "Guide", ISS_OFF); + IUFillSwitch(&SlewRateS[SLEW_CENTERING], "SLEW_CENTERING", "Centering", ISS_OFF); + IUFillSwitch(&SlewRateS[SLEW_FIND], "SLEW_FIND", "Find", ISS_OFF); + IUFillSwitch(&SlewRateS[SLEW_MAX], "SLEW_MAX", "Max", ISS_ON); + IUFillSwitchVector(&SlewRateSP, SlewRateS, 4, getDeviceName(), "TELESCOPE_SLEW_RATE", "Slew Rate", MOTION_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); // Add Tracking Modes, the order must match the order of the TelescopeTrackMode enum @@ -468,13 +468,13 @@ bool ScopeSim::ISNewSwitch(const char *dev, const char *name, ISState *states, c } #endif // Slew mode - if (SlewRateSP.isNameMatch(name)) + if (strcmp(name, SlewRateSP.name) == 0) { - if (SlewRateSP.update(states, names, n)) + if (IUUpdateSwitch(&SlewRateSP, states, names, n) < 0) return false; - SlewRateSP.setState(IPS_OK); - SlewRateSP.apply(); + SlewRateSP.s = IPS_OK; + IDSetSwitch(&SlewRateSP, nullptr); return true; } } @@ -497,7 +497,7 @@ bool ScopeSim::MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) LOG_ERROR("Please unpark the mount before issuing any motion commands."); return false; } - mcRate = static_cast(SlewRateSP.findOnSwitchIndex()) + 1; + mcRate = static_cast(IUFindOnSwitchIndex(&SlewRateSP)) + 1; int rate = (dir == INDI_DIR_NS::DIRECTION_NORTH) ? mcRate : -mcRate; LOGF_DEBUG("MoveNS dir %s, motion %s, rate %d", dir == DIRECTION_NORTH ? "N" : "S", command == 0 ? "start" : "stop", rate); @@ -515,7 +515,7 @@ bool ScopeSim::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) return false; } - mcRate = static_cast(SlewRateSP.findOnSwitchIndex()) + 1; + mcRate = static_cast(IUFindOnSwitchIndex(&SlewRateSP)) + 1; int rate = (dir == INDI_DIR_WE::DIRECTION_EAST) ? -mcRate : mcRate; LOGF_DEBUG("MoveWE dir %d, motion %s, rate %d", dir == DIRECTION_EAST ? "E" : "W", command == 0 ? "start" : "stop", rate); diff --git a/libs/indibase/inditelescope.h b/libs/indibase/inditelescope.h index e1d53843be..c4d57e49c8 100644 --- a/libs/indibase/inditelescope.h +++ b/libs/indibase/inditelescope.h @@ -770,8 +770,7 @@ class Telescope : public DefaultDevice }; // Slew Rate - INDI::PropertySwitch SlewRateSP {4}; - + ISwitchVectorProperty SlewRateSP; ISwitch *SlewRateS {nullptr}; // UTC and UTC Offset