Skip to content

Commit

Permalink
Ensure that we only update snooped properties for the devices defined…
Browse files Browse the repository at this point in the history
… in ACTIVE_DEVICES.
  • Loading branch information
knro committed Jul 31, 2024
1 parent bbe6a21 commit de01a6e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ endif()
# #################################### INDI version ################################################
set(CMAKE_INDI_VERSION_MAJOR 2)
set(CMAKE_INDI_VERSION_MINOR 0)
set(CMAKE_INDI_VERSION_RELEASE 8)
set(CMAKE_INDI_VERSION_RELEASE 9)

set(INDI_SOVERSION ${CMAKE_INDI_VERSION_MAJOR})
set(CMAKE_INDI_VERSION_STRING "${CMAKE_INDI_VERSION_MAJOR}.${CMAKE_INDI_VERSION_MINOR}.${CMAKE_INDI_VERSION_RELEASE}")
Expand Down
22 changes: 12 additions & 10 deletions libs/indibase/indiccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ bool CCD::updateProperties()
bool CCD::ISSnoopDevice(XMLEle * root)
{
XMLEle * ep = nullptr;
const char * propName = findXMLAttValu(root, "name");
auto propName = findXMLAttValu(root, "name");
auto deviceName = std::string(findXMLAttValu(root, "device"));

if (IUSnoopNumber(root, &EqNP) == 0)
{
Expand All @@ -755,7 +756,7 @@ bool CCD::ISSnoopDevice(XMLEle * root)
}
J2000Valid = true;
}
else if (!strcmp("TELESCOPE_PIER_SIDE", propName))
else if (!strcmp("TELESCOPE_PIER_SIDE", propName) && deviceName == ActiveDeviceTP[ACTIVE_TELESCOPE].getText())
{
// set default to say we have no valid information from mount
pierSide = -1;
Expand All @@ -770,7 +771,8 @@ bool CCD::ISSnoopDevice(XMLEle * root)
pierSide = 0;
}
}
else if (!strcmp(propName, "TELESCOPE_INFO"))
// Deprecated
else if (!strcmp(propName, "TELESCOPE_INFO") && deviceName == ActiveDeviceTP[ACTIVE_TELESCOPE].getText())
{
for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
{
Expand All @@ -786,7 +788,7 @@ bool CCD::ISSnoopDevice(XMLEle * root)
}
}
}
else if (!strcmp(propName, "FILTER_NAME"))
else if (!strcmp(propName, "FILTER_NAME") && deviceName == ActiveDeviceTP[ACTIVE_FILTER].getText())
{
LOG_DEBUG("SNOOP: FILTER_NAME update...");
FilterNames.clear();
Expand All @@ -795,15 +797,15 @@ bool CCD::ISSnoopDevice(XMLEle * root)
LOGF_DEBUG("SNOOP: FILTER_NAME -> %s", join(FilterNames, ", ").c_str());

}
else if (!strcmp(propName, "FILTER_SLOT"))
else if (!strcmp(propName, "FILTER_SLOT") && deviceName == ActiveDeviceTP[ACTIVE_FILTER].getText())
{
LOG_DEBUG("SNOOP: FILTER_SLOT update...");
CurrentFilterSlot = -1;
for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
CurrentFilterSlot = atoi(pcdataXMLEle(ep));
LOGF_DEBUG("SNOOP: FILTER_SLOT is %d", CurrentFilterSlot);
}
else if (!strcmp(propName, "SKY_QUALITY"))
else if (!strcmp(propName, "SKY_QUALITY") && deviceName == ActiveDeviceTP[ACTIVE_SKYQUALITY].getText())
{
for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
{
Expand All @@ -816,7 +818,7 @@ bool CCD::ISSnoopDevice(XMLEle * root)
}
}
}
else if (!strcmp(propName, "ABS_ROTATOR_ANGLE"))
else if (!strcmp(propName, "ABS_ROTATOR_ANGLE") && deviceName == ActiveDeviceTP[ACTIVE_ROTATOR].getText())
{
for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
{
Expand All @@ -831,7 +833,7 @@ bool CCD::ISSnoopDevice(XMLEle * root)
}

// JJ ed 2019-12-10
else if (!strcmp(propName, "ABS_FOCUS_POSITION"))
else if (!strcmp(propName, "ABS_FOCUS_POSITION") && deviceName == ActiveDeviceTP[ACTIVE_FOCUSER].getText())
{
for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
{
Expand All @@ -844,7 +846,7 @@ bool CCD::ISSnoopDevice(XMLEle * root)
}
}
}
else if (!strcmp(propName, "FOCUS_TEMPERATURE"))
else if (!strcmp(propName, "FOCUS_TEMPERATURE") && deviceName == ActiveDeviceTP[ACTIVE_FOCUSER].getText())
{
for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
{
Expand All @@ -859,7 +861,7 @@ bool CCD::ISSnoopDevice(XMLEle * root)
}
//

else if (!strcmp(propName, "GEOGRAPHIC_COORD"))
else if (!strcmp(propName, "GEOGRAPHIC_COORD") && deviceName == ActiveDeviceTP[ACTIVE_TELESCOPE].getText())
{
for (ep = nextXMLEle(root, 1); ep != nullptr; ep = nextXMLEle(root, 0))
{
Expand Down
3 changes: 2 additions & 1 deletion libs/indibase/indidome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,10 @@ bool Dome::ISSnoopDevice(XMLEle * root)
{
XMLEle * ep = nullptr;
const char * propName = findXMLAttValu(root, "name");
auto deviceName = std::string(findXMLAttValu(root, "device"));

// Check TARGET
if (!strcmp("TARGET_EOD_COORD", propName))
if (!strcmp("TARGET_EOD_COORD", propName) && deviceName == ActiveDeviceTP[ACTIVE_MOUNT].getText())
{
int rc_ra = -1, rc_de = -1;
double ra = 0, de = 0;
Expand Down
7 changes: 4 additions & 3 deletions libs/indibase/inditelescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,11 @@ bool Telescope::ISSnoopDevice(XMLEle *root)

XMLEle *ep = nullptr;
const char *propName = findXMLAttValu(root, "name");
auto deviceName = std::string(findXMLAttValu(root, "device"));

if (isConnected())
{
if (HasLocation() && !strcmp(propName, "GEOGRAPHIC_COORD"))
if (HasLocation() && !strcmp(propName, "GEOGRAPHIC_COORD") && deviceName == ActiveDeviceTP[ACTIVE_GPS].getText())
{
// Only accept IPS_OK state
if (strcmp(findXMLAttValu(root, "state"), "Ok"))
Expand All @@ -495,7 +496,7 @@ bool Telescope::ISSnoopDevice(XMLEle *root)

return processLocationInfo(latitude, longitude, elevation);
}
else if (HasTime() && !strcmp(propName, "TIME_UTC"))
else if (HasTime() && !strcmp(propName, "TIME_UTC") && deviceName == ActiveDeviceTP[ACTIVE_GPS].getText())
{
// Only accept IPS_OK state
if (strcmp(findXMLAttValu(root, "state"), "Ok"))
Expand All @@ -515,7 +516,7 @@ bool Telescope::ISSnoopDevice(XMLEle *root)

return processTimeInfo(utc, offset);
}
else if (!strcmp(propName, "DOME_PARK")/* || !strcmp(propName, "DOME_SHUTTER")*/)
else if (!strcmp(propName, "DOME_PARK") && deviceName == ActiveDeviceTP[ACTIVE_DOME].getText())
{
// This is handled by Watchdog driver.
// Mount shouldn't park due to dome closing in INDI::Telescope
Expand Down

0 comments on commit de01a6e

Please sign in to comment.