Skip to content

Commit

Permalink
Rotator limits should be disabled by default (0) and only explicitly …
Browse files Browse the repository at this point in the history
…enabled if there is a valud > 0
  • Loading branch information
knro committed Feb 16, 2024
1 parent 910b7ea commit ca7f5b7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libs/indibase/indirotatorinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void RotatorInterface::initProperties(const char *groupName)


// Rotator Limits
RotatorLimitsNP[0].fill("ROTATOR_LIMITS_VALUE", "Max Range (degrees)", "%.f", 10, 180, 10, 90);
RotatorLimitsNP[0].fill("ROTATOR_LIMITS_VALUE", "Max Range (degrees)", "%.f", 0, 180, 30, 0);
RotatorLimitsNP.fill(m_defaultDevice->getDeviceName(), "ROTATOR_LIMITS", "Limits", groupName, IP_RW, 60, IPS_IDLE);
}

Expand All @@ -101,11 +101,13 @@ bool RotatorInterface::processNumber(const char *dev, const char *name, double v
}

// If value is outside safe zone, then prevent motion
if ( (values[0] < 180 && (std::abs(values[0] - m_RotatorOffset)) > RotatorLimitsNP[0].getValue()) ||
(values[0] > 180 && (std::abs(values[0] - m_RotatorOffset)) < (360 - RotatorLimitsNP[0].getValue())))
if (RotatorLimitsNP[0].getValue() > 0 && ((values[0] < 180
&& (std::abs(values[0] - m_RotatorOffset)) > RotatorLimitsNP[0].getValue()) ||
(values[0] > 180 && (std::abs(values[0] - m_RotatorOffset)) < (360 - RotatorLimitsNP[0].getValue()))))
{
GotoRotatorNP.s = IPS_ALERT;
DEBUGFDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_ERROR, "Rotator target %.2f exceeds safe limits of %.2f degrees...", values[0], RotatorLimitsNP[0].getValue());
DEBUGFDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_ERROR,
"Rotator target %.2f exceeds safe limits of %.2f degrees...", values[0], RotatorLimitsNP[0].getValue());
IDSetNumber(&GotoRotatorNP, nullptr);
}
else
Expand Down Expand Up @@ -173,6 +175,8 @@ bool RotatorInterface::processNumber(const char *dev, const char *name, double v
RotatorLimitsNP.update(values, names, n);
RotatorLimitsNP.setState(IPS_OK);
RotatorLimitsNP.apply();
if (RotatorLimitsNP[0].getValue() == 0)
DEBUGDEVICE(dev, Logger::DBG_SESSION, "Rotator limits are disabled.");
m_RotatorOffset = GotoRotatorN[0].value;
return true;
}
Expand Down

0 comments on commit ca7f5b7

Please sign in to comment.