From 0b69267d01fcfa2b032d3b72377efee0e85dd756 Mon Sep 17 00:00:00 2001 From: Jasem Mutlaq Date: Mon, 29 Jul 2024 11:56:24 +0300 Subject: [PATCH] Fix checking for home switch status. Since HomeSP can have variable members, we need to check by name for the required action. --- libs/indibase/inditelescope.cpp | 8 +++----- libs/indibase/inditelescope.h | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/libs/indibase/inditelescope.cpp b/libs/indibase/inditelescope.cpp index 53a3a0ec3c..e60d3e6798 100644 --- a/libs/indibase/inditelescope.cpp +++ b/libs/indibase/inditelescope.cpp @@ -1232,12 +1232,10 @@ bool Telescope::ISNewSwitch(const char *dev, const char *name, ISState *states, if (HomeSP.isNameMatch(name)) { auto onSwitchName = IUFindOnSwitchName(states, names, n); - TelescopeHomeAction action = HOME_NONE; - if (HomeSP[HOME_FIND].isNameMatch(onSwitchName)) - action = HOME_FIND; - else if (HomeSP[HOME_SET].isNameMatch(onSwitchName)) + auto action = HOME_FIND; + if (onSwitchName == "SET") action = HOME_SET; - else + else if (onSwitchName == "GO") action = HOME_GO; if (isParked()) diff --git a/libs/indibase/inditelescope.h b/libs/indibase/inditelescope.h index 165b19ce58..3e0c0d538f 100644 --- a/libs/indibase/inditelescope.h +++ b/libs/indibase/inditelescope.h @@ -136,10 +136,9 @@ class Telescope : public DefaultDevice enum TelescopeHomeAction { - HOME_NONE = 1 << 0, /*!< Mount does not support any form of homing */ - HOME_FIND = 1 << 1, /*!< Mount can search for home position */ - HOME_SET = 1 << 2, /*!< Mount can use current-position as home position */ - HOME_GO = 1 << 3, /*!< Mount can slew to home position */ + HOME_FIND, /*!< Command mount to search for home position. */ + HOME_SET, /*!< Command mount to accept current position as the home position. */ + HOME_GO, /*!< Command mount to slew to home position. */ }; enum TelescopePECState