This commit is contained in:
2025-08-08 23:50:55 +03:00
parent c45d17b236
commit b99263a014
11 changed files with 709 additions and 197 deletions

View File

@@ -129,9 +129,9 @@ public:
traits::mcc_irange_of_pzones_c<typename TELEMETRY_T::mount_telemetry_data_t> PZ_T,
// traits::mcc_tuple_c PZ_T, // std::tuple of prohibited zones
typename... LoggerCtorArgTs>
MccSimpleSlewModel(TELEMETRY_T& telemetry,
HARDWARE_T& hardware,
PZ_T& prohibited_zone,
MccSimpleSlewModel(TELEMETRY_T* telemetry,
HARDWARE_T* hardware,
PZ_T* prohibited_zone,
LoggerCtorArgTs&&... ctor_args)
requires(!std::same_as<LoggerT, MccNullLogger>)
: LoggerT(std::forward<LoggerCtorArgTs>(ctor_args)...)
@@ -141,16 +141,16 @@ public:
init(telemetry, hardware, prohibited_zone);
}
template <traits::mcc_mount_telemetry_c TELEMETRY_T,
traits::mcc_mount_hardware_c HARDWARE_T,
traits::mcc_irange_of_pzones_c<typename TELEMETRY_T::mount_telemetry_data_t> PZ_T
// traits::mcc_tuple_c PZ_T // std::tuple of prohibited zones
>
MccSimpleSlewModel(TELEMETRY_T& telemetry, HARDWARE_T& hardware, PZ_T& prohibited_zone)
requires(std::same_as<LoggerT, MccNullLogger>)
{
init(telemetry, hardware, prohibited_zone);
}
// template <traits::mcc_mount_telemetry_c TELEMETRY_T,
// traits::mcc_mount_hardware_c HARDWARE_T,
// traits::mcc_irange_of_pzones_c<typename TELEMETRY_T::mount_telemetry_data_t> PZ_T
// // traits::mcc_tuple_c PZ_T // std::tuple of prohibited zones
// >
// MccSimpleSlewModel(TELEMETRY_T& telemetry, HARDWARE_T& hardware, PZ_T& prohibited_zone)
// requires(std::same_as<LoggerT, MccNullLogger>)
// {
// init(telemetry, hardware, prohibited_zone);
// }
MccSimpleSlewModel(MccSimpleSlewModel&& other)
: _stopRequested(other._stopRequested.load()), _slewFunc(std::move(other._slewFunc))
@@ -195,21 +195,21 @@ protected:
std::atomic_bool _stopRequested{false};
std::function<error_t(const slew_point_t&)> _slewFunc{};
void init(auto& telemetry, auto& hardware, auto& prohibited_zones)
void init(auto* p_telemetry, auto* p_hardware, auto* p_prohibited_zones)
{
// deduce controls types
using hardware_t = decltype(hardware);
using telemetry_t = decltype(telemetry);
using hardware_t = decltype(*p_hardware);
using telemetry_t = decltype(*p_telemetry);
static_assert(traits::mcc_mount_default_telemetry_c<telemetry_t>,
"TELEMETRY CLASS MUST BE A DESCENDANT OF 'MccMountTelemetry'!");
using astrom_engine_t = typename telemetry_t::astrom_engine_t;
static constexpr size_t Nzones = std::tuple_size_v<decltype(prohibited_zones)>;
static constexpr size_t Nzones = std::tuple_size_v<decltype(*p_prohibited_zones)>;
const auto p_telemetry = &telemetry;
const auto p_hardware = &hardware;
const auto p_prohibited_zones = &prohibited_zones;
// const auto p_telemetry = &telemetry;
// const auto p_hardware = &hardware;
// const auto p_prohibited_zones = &prohibited_zones;
_slewFunc = [p_telemetry, p_hardware, p_prohibited_zones, this](slew_point_t slew_point) {
_stopRequested = false;