#pragma once /* MOUNT CONTROL COMPONENTS LIBRARY */ /* COMMON DECLARATION FOR SLEW AND GUIDING MODELS GENERIC IMPLEMENTATIONS */ #include "mcc_mount_concepts.h" namespace mcc { /* DEFAULT CLASS TO REPRESENT CELESTIAL POINT */ struct MccCelestialPoint { typedef double coord_t; MccCoordPairKind coordPairKind{MccCoordPairKind::COORDS_KIND_RADEC_ICRS}; coord_t x{0.0}, y{0.0}; }; static_assert(traits::mcc_celestial_point_c, "MccCelestialPoint INVALID DECLARATION!"); /* CHECK FOR CURRENT MOUNT POSITION IN PROHIBITED ZONES */ /* * WARNING: if an error occured during telemetry data request * result 'in zone' flags cannot be interpretated correctly! */ template ... ZTs> auto mccCheckInZonePZTuple(TelemetryT& telemetry, std::tuple& tuple_zones, std::array& in_zone) { const auto p_telemetry = &telemetry; const auto p_tuple_zones = &tuple_zones; const auto p_in_zone = &in_zone; return [p_telemetry, p_tuple_zones, p_in_zone](std::index_sequence) { typename TelemetryT::error_t t_err; ( [&t_err]() { if constexpr (Is) { if (t_err) { (*p_in_zone)[Is] = false; return; } } typename TelemetryT::mount_telemetry_data_t tdata; t_err = p_telemetry->data(tdata); if (!t_err) { (*p_in_zone)[Is] = std::get(p_tuple_zones).inZone(tdata); } }(), ...); }(std::make_index_sequence{}); } } // namespace mcc