...
This commit is contained in:
parent
98d5fa007f
commit
4ebaac2dcb
@ -8,26 +8,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "mount.h"
|
#include "mcc_mount.h"
|
||||||
|
|
||||||
namespace mcc
|
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 */
|
/* MOUNT STATE MACHINE STATES */
|
||||||
|
|
||||||
@ -37,17 +22,15 @@ concept mcc_mount_c = requires {
|
|||||||
template <traits::mcc_mount_c MountT>
|
template <traits::mcc_mount_c MountT>
|
||||||
class MccMountEventBase
|
class MccMountEventBase
|
||||||
{
|
{
|
||||||
protected:
|
public:
|
||||||
typedef MountT mount_t;
|
typedef MountT mount_t;
|
||||||
|
|
||||||
MccMountEventBase(mount_t& mount) : _mount(mount) {}
|
|
||||||
|
|
||||||
virtual ~MccMountEventBase() = default;
|
virtual ~MccMountEventBase() = default;
|
||||||
|
|
||||||
mount_t& mount() const
|
mount_t& mount() const { return _mount; }
|
||||||
{
|
|
||||||
return _mount;
|
protected:
|
||||||
}
|
MccMountEventBase(mount_t& mount) : _mount(mount) {}
|
||||||
|
|
||||||
mount_t& _mount;
|
mount_t& _mount;
|
||||||
};
|
};
|
||||||
@ -91,10 +74,7 @@ struct MccMountEventError : public MccMountEventBase<MountT> {
|
|||||||
|
|
||||||
using event_data_t = std::error_code;
|
using event_data_t = std::error_code;
|
||||||
|
|
||||||
event_data_t eventData() const
|
event_data_t eventData() const { return _error; }
|
||||||
{
|
|
||||||
return _error;
|
|
||||||
}
|
|
||||||
|
|
||||||
MccMountEventError(MountT& mount, const event_data_t& error) : base_t(mount), _error(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";
|
static constexpr std::string_view ID = "MCC-MOUNT-SLEW-EVENT";
|
||||||
|
|
||||||
struct event_data_t {
|
using event_data_t = typename MountT::slew_param_t;
|
||||||
MccCoordPairKind kind{MccCoordPairKind::COORDS_KIND_RADEC_IRCS};
|
|
||||||
MccAngle x{0.0}, y{0.0};
|
|
||||||
|
|
||||||
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) {}
|
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_STOP_BUTTON // hardware button
|
||||||
};
|
};
|
||||||
|
|
||||||
event_data_t eventData() const
|
event_data_t eventData() const { return _reason; }
|
||||||
{
|
|
||||||
return _reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string_view reason() const
|
std::string_view reason() const
|
||||||
{
|
{
|
||||||
@ -346,10 +315,7 @@ protected:
|
|||||||
EvT::ID);
|
EvT::ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exitImpl(MccMountEventIDLE<MountT>& event)
|
void exitImpl(MccMountEventIDLE<MountT>& event) { event.mount().logWarning("Suppose the error was corrected!"); }
|
||||||
{
|
|
||||||
event.mount().logWarning("Suppose the error was corrected!");
|
|
||||||
}
|
|
||||||
|
|
||||||
void exitImpl(MccMountEventInit<MountT>& event)
|
void exitImpl(MccMountEventInit<MountT>& event)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user