This commit is contained in:
2025-04-12 15:18:09 +03:00
parent 89d67fd95c
commit d5dd260007
5 changed files with 267 additions and 35 deletions

View File

@@ -10,6 +10,7 @@
#include <string_view>
#include "spdlog/sinks/null_sink.h"
#include "mcc_coord.h"
#include "mcc_spdlog.h"
#include "mcc_traits.h"
#include "mount_astrom.h"
@@ -45,6 +46,7 @@ concept mcc_mount_state_c = requires(T t, const T t_const) {
} // namespace traits
/* SOME BASIC DATA STRUCTURES DEFINITIONS */
// meteo parameters (e.g. to compute refraction)
@@ -195,32 +197,48 @@ public:
_geoLocation.store(geoloc);
}
void setSiteLatitude(auto const& lat)
void setSiteLatitude(const MccCoordinate& 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!");
}
auto st = _geoLocation.load();
st.latitude = lat;
logInfo("Set current site latitude to {} radians", st.latitude);
_geoLocation.store(st);
}
void setSiteLongitude(auto const& lon)
void setSiteLongitude(const MccCoordinate& 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!");
}
auto st = _geoLocation.load();
st.longitude = lon;
logInfo("Set current site longitude to {} radians", st.longitude);
_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)
{
auto st = _geoLocation.load();
@@ -249,22 +267,34 @@ public:
}
// prohibited zone related methods
/* prohibited zone related methods */
bool pzCheck(traits::mcc_real_or_char_range auto const& xcoord, traits::mcc_real_or_char_range auto const& ycoord)
// returns a time to reach the prohibited area:
// 0 - already in the zone
// std::chrono::sys_time<>::max() - never reach the zone
// the kind of cordinates (e.g. IRCS or apparent, equatorial or horizontal) is a subject of implementation
auto pzTimeTo(const MccCoordinate& xcoord,
const MccCoordinate& ycoord,
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
{
return true;
}
auto pzPredict(traits::mcc_systime_c auto const& time_point,
traits::mcc_real_or_char_range auto const& xcoord,
traits::mcc_real_or_char_range auto const& ycoord)
{
using d_t = std::remove_cvref_t<decltype(time_point)>::duration;
using d_t = std::remove_cvref_t<decltype(utc)>::duration;
return d_t::max();
}
// returns a time to exit the prohibited area:
// 0 - already out of the zone
// std::chrono::sys_time<>::max() - the zone itself
// the kind of cordinates (e.g. IRCS or apparent, equatorial or horizontal) is a subject of implementation
auto pzTimeFrom(const MccCoordinate& xcoord,
const MccCoordinate& ycoord,
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
{
using d_t = std::remove_cvref_t<decltype(utc)>::duration;
return d_t{0};
}
// IERS databases updater