From 4ebaac2dcb639107f7d9509e97f45aa6a550350d Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Sun, 15 Jun 2025 14:03:13 +0300 Subject: [PATCH] ... --- cxx/mcc_mount_events_states.h | 56 +++++++---------------------------- 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/cxx/mcc_mount_events_states.h b/cxx/mcc_mount_events_states.h index a085aa9..bfecc62 100644 --- a/cxx/mcc_mount_events_states.h +++ b/cxx/mcc_mount_events_states.h @@ -8,26 +8,11 @@ */ -#include "mount.h" +#include "mcc_mount.h" namespace mcc { -namespace traits -{ - -template -concept mcc_mount_c = requires { - requires std::same_as; - - typename T::mount_config_t; - - requires std::derived_from>; -}; - -} // namespace traits - - /* MOUNT STATE MACHINE STATES */ @@ -37,17 +22,15 @@ concept mcc_mount_c = requires { template class MccMountEventBase { -protected: +public: typedef MountT mount_t; - MccMountEventBase(mount_t& mount) : _mount(mount) {} - virtual ~MccMountEventBase() = default; - mount_t& mount() const - { - return _mount; - } + mount_t& mount() const { return _mount; } + +protected: + MccMountEventBase(mount_t& mount) : _mount(mount) {} mount_t& _mount; }; @@ -91,10 +74,7 @@ struct MccMountEventError : public MccMountEventBase { using event_data_t = std::error_code; - event_data_t eventData() const - { - return _error; - } + event_data_t eventData() const { return _error; } MccMountEventError(MountT& mount, const event_data_t& error) : base_t(mount), _error(error) {} @@ -111,17 +91,9 @@ struct MccMountEventSlew : public MccMountEventBase { static constexpr std::string_view ID = "MCC-MOUNT-SLEW-EVENT"; - struct event_data_t { - MccCoordPairKind kind{MccCoordPairKind::COORDS_KIND_RADEC_IRCS}; - MccAngle x{0.0}, y{0.0}; + using event_data_t = typename MountT::slew_param_t; - bool stop{false}; // stop after slewing: if false - start guiding - }; - - event_data_t eventData() const - { - return _eventData; - } + event_data_t eventData() const { return _eventData; } MccMountEventSlew(MountT& mount, const event_data_t& ev_data) : base_t(mount), _eventData(ev_data) {} @@ -157,10 +129,7 @@ struct MccMountEventStop : public MccMountEventBase { EVENT_STOP_BUTTON // hardware button }; - event_data_t eventData() const - { - return _reason; - } + event_data_t eventData() const { return _reason; } std::string_view reason() const { @@ -346,10 +315,7 @@ protected: EvT::ID); } - void exitImpl(MccMountEventIDLE& event) - { - event.mount().logWarning("Suppose the error was corrected!"); - } + void exitImpl(MccMountEventIDLE& event) { event.mount().logWarning("Suppose the error was corrected!"); } void exitImpl(MccMountEventInit& event) {