This commit is contained in:
Timur A. Fatkhullin
2025-05-16 00:32:41 +03:00
parent 00cf1834e9
commit d0674d15a6
2 changed files with 22 additions and 57 deletions

View File

@@ -14,6 +14,7 @@
#include "mcc_spdlog.h"
#include "mcc_traits.h"
#include "mount_astrom.h"
#include "mount_pz.h"
// low-level functions
// namespace lowlevel
@@ -271,31 +272,6 @@ public:
_geoLocation.store(st);
}
// void setSiteLatitude(auto const& lat)
// {
// auto v = utils::parsAngleString(lat);
// if (v.has_value()) {
// auto st = _geoLocation.load();
// st.latitude = v.value() * utils::deg2radCoeff; // to radians
// logInfo("Set current site latitude to {} radians", st.latitude);
// _geoLocation.store(st);
// } else {
// logError("Invalid user latitude value! Do not change the current value!");
// }
// }
// void setSiteLongitude(auto const& lon)
// {
// auto v = utils::parsAngleString(lon);
// if (v.has_value()) {
// auto st = _geoLocation.load();
// st.longitude = v.value() * utils::deg2radCoeff; // to radians
// logInfo("Set current site longitude to {} radians", st.longitude);
// _geoLocation.store(st);
// } else {
// logError("Invalid user longitude value! Do not change the current value!");
// }
// }
void setSiteElevation(MccMountSiteInfo::mnt_site_elev_t elev)
{
@@ -327,6 +303,17 @@ public:
/* prohibited zone related methods */
template <traits::mcc_prohibited_zone_c ZT>
size_t pzAddZone(ZT zone)
{
_pzInZoneFunc.emplace_back([zone = std::move(zone)](const MccAngle& x, const MccAngle& y, void* ctx) mutable {
auto context = *static_cast<typename ZT::pzcontext_t*>(ctx);
return zone.inZone(x, y, context);
});
return _pzInZoneFunc.size();
}
// returns a time to reach the prohibited area:
// 0 - already in the zone
// std::chrono::duration<>::max() - never reach the zone
@@ -445,6 +432,8 @@ protected:
std::atomic<MccMountSiteInfo> _geoLocation;
std::atomic<MccMountMeteo> _currentMeteo;
std::vector<std::function<bool(const MccAngle&, const MccAngle&, void*)>> _pzInZoneFunc;
// default implementation
auto pzCheckImpl(const MccAngle& xcoord,
const MccAngle& ycoord,