From 90acf1ee8cf3bc1c1accc1029d82862e987d1a3d Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Mon, 10 Nov 2025 16:06:44 +0300 Subject: [PATCH] fix axis switch limit pzone calculations --- asibfm700/asibfm700_mount.cpp | 10 ++++++---- mcc/mcc_pzone.h | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/asibfm700/asibfm700_mount.cpp b/asibfm700/asibfm700_mount.cpp index a419ec1..b42e50e 100644 --- a/asibfm700/asibfm700_mount.cpp +++ b/asibfm700/asibfm700_mount.cpp @@ -83,13 +83,15 @@ Asibfm700Mount::error_t Asibfm700Mount::initMount() clearPZones(); logInfo("Add prohibited zones ..."); - logInfo(" Add MccAltLimitPZ zone: min alt = {}, lat = {}", _mountConfig.pzMinAltitude().degrees(), - _mountConfig.siteLatitude().degrees()); + logInfo(" Add MccAltLimitPZ zone: min alt = {}, lat = {} (pzone type: '{}')", + _mountConfig.pzMinAltitude().degrees(), _mountConfig.siteLatitude().degrees(), + "Minimal altitude prohibited zone"); addPZone(mcc::MccAltLimitPZ{_mountConfig.pzMinAltitude(), _mountConfig.siteLatitude(), this}); - logInfo(" Add MccAxisLimitSwitchPZ zone: min value = {}, max value = {}", - _mountConfig.pzLimitSwitchHAMin().degrees(), _mountConfig.pzLimitSwitchHAMax().degrees()); + logInfo(" Add MccAxisLimitSwitchPZ zone: min value = {}, max value = {} (pzone type: '{}')", + _mountConfig.pzLimitSwitchHAMin().degrees(), _mountConfig.pzLimitSwitchHAMax().degrees(), + "HA-axis limit switch"); size_t pz_num = addPZone(mcc::MccAxisLimitSwitchPZ{ _mountConfig.pzLimitSwitchHAMin(), _mountConfig.pzLimitSwitchHAMax(), this}); diff --git a/mcc/mcc_pzone.h b/mcc/mcc_pzone.h index 7d1a8b2..3185347 100644 --- a/mcc/mcc_pzone.h +++ b/mcc/mcc_pzone.h @@ -639,7 +639,8 @@ public: if constexpr (mcc_eqt_hrz_coord_c) { // assume here .X and are hardware encoder coordinate of corresponding axis - *result = (coords.X < _maxLimit) && (coords.X > _minLimit); + *result = (coords.X > _maxLimit) || (coords.X < _minLimit); + // *result = (coords.X < _maxLimit) && (coords.X > _minLimit); } else { // mcc_celestial_point_c if (coords.pair_kind == MccCoordPairKind::COORDS_KIND_XY) { // hardware *result = (coords.X < _maxLimit) && (coords.X > _minLimit); @@ -651,7 +652,8 @@ public: return ret; } - *result = (pt.X < _maxLimit) && (pt.X > _minLimit); + *result = (pt.X > _maxLimit) || (pt.X < _minLimit); + // *result = (pt.X < _maxLimit) && (pt.X > _minLimit); } }