This commit is contained in:
Timur A. Fatkhullin 2025-06-15 14:03:13 +03:00
parent 98d5fa007f
commit 4ebaac2dcb

View File

@ -8,26 +8,11 @@
*/
#include "mount.h"
#include "mcc_mount.h"
namespace mcc
{
namespace traits
{
template <typename T>
concept mcc_mount_c = requires {
requires std::same_as<const MccMountType, decltype(T::mountType)>;
typename T::mount_config_t;
requires std::derived_from<T, MccMount<T::mountType, typename T::mount_config_t>>;
};
} // namespace traits
/* MOUNT STATE MACHINE STATES */
@ -37,17 +22,15 @@ concept mcc_mount_c = requires {
template <traits::mcc_mount_c MountT>
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<MountT> {
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<MountT> {
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<MountT> {
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<MountT>& event)
{
event.mount().logWarning("Suppose the error was corrected!");
}
void exitImpl(MccMountEventIDLE<MountT>& event) { event.mount().logWarning("Suppose the error was corrected!"); }
void exitImpl(MccMountEventInit<MountT>& event)
{