Skip to content

Commit

Permalink
Undo changes for SlewRateSP, since it's common and require changes in…
Browse files Browse the repository at this point in the history
… many drivers as well
  • Loading branch information
naheedsa committed Feb 8, 2024
1 parent b5d2d3a commit 0b23221
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
22 changes: 11 additions & 11 deletions drivers/telescope/telescope_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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<int>(SlewRateSP.findOnSwitchIndex()) + 1;
mcRate = static_cast<int>(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);
Expand All @@ -515,7 +515,7 @@ bool ScopeSim::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command)
return false;
}

mcRate = static_cast<int>(SlewRateSP.findOnSwitchIndex()) + 1;
mcRate = static_cast<int>(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);

Expand Down
3 changes: 1 addition & 2 deletions libs/indibase/inditelescope.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,7 @@ class Telescope : public DefaultDevice
};

// Slew Rate
INDI::PropertySwitch SlewRateSP {4};

ISwitchVectorProperty SlewRateSP;
ISwitch *SlewRateS {nullptr};

// UTC and UTC Offset
Expand Down

0 comments on commit 0b23221

Please sign in to comment.