...
This commit is contained in:
@@ -27,7 +27,10 @@ public:
|
||||
|
||||
virtual ~MccMountEventBase() = default;
|
||||
|
||||
mount_t& mount() const { return _mount; }
|
||||
mount_t& mount() const
|
||||
{
|
||||
return _mount;
|
||||
}
|
||||
|
||||
protected:
|
||||
MccMountEventBase(mount_t& mount) : _mount(mount) {}
|
||||
@@ -74,7 +77,10 @@ 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) {}
|
||||
|
||||
@@ -93,7 +99,10 @@ struct MccMountEventSlew : public MccMountEventBase<MountT> {
|
||||
|
||||
using event_data_t = typename MountT::slew_param_t;
|
||||
|
||||
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) {}
|
||||
|
||||
@@ -129,7 +138,10 @@ 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
|
||||
{
|
||||
@@ -187,13 +199,13 @@ protected:
|
||||
template <std::derived_from<MccMountEventBase<MountT>> EvT>
|
||||
void exitImpl(EvT& event)
|
||||
{
|
||||
event.mount().logWarning("Call an empty MccMountStateBase::exitImpl method!!! Event type is '{}'", EvT::ID);
|
||||
event.mount().logWarn("Call an empty MccMountStateBase::exitImpl method!!! Event type is '{}'", EvT::ID);
|
||||
}
|
||||
|
||||
template <std::derived_from<MccMountEventBase<MountT>> EvT>
|
||||
void enterImpl(EvT& event)
|
||||
{
|
||||
event.mount().logWarning("Call an empty MccMountStateBase::enterImpl method!!! Event type is '{}'", EvT::ID);
|
||||
event.mount().logWarn("Call an empty MccMountStateBase::enterImpl method!!! Event type is '{}'", EvT::ID);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -315,7 +327,10 @@ 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)
|
||||
{
|
||||
@@ -400,4 +415,34 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// guiding state
|
||||
|
||||
template <traits::mcc_mount_c MountT>
|
||||
struct MccMountStateGuiding : MccMountStateBase<MountT> {
|
||||
static constexpr std::string_view ID = "MCC-MOUNT-GUIDING-STATE";
|
||||
|
||||
// only initialization
|
||||
using transition_t =
|
||||
fsm::fsm_transition_table_t<std::pair<MccMountEventInit<MountT>, MccMountStateInit<MountT>>,
|
||||
std::pair<MccMountEventError<MountT>, MccMountStateStop<MountT>>,
|
||||
// std::pair<MccMountEventSlew<MountT>, MccMountStateSlew<MountT>>,
|
||||
std::pair<MccMountEventGuiding<MountT>, MccMountStateStop<MountT>>,
|
||||
std::pair<MccMountEventStop<MountT>, MccMountStateStop<MountT>>,
|
||||
std::pair<MccMountEventShutdown<MountT>, MccMountStateStop<MountT>>>;
|
||||
|
||||
protected:
|
||||
template <std::derived_from<MccMountEventBase<MountT>> EvT>
|
||||
void exitImpl(EvT& event)
|
||||
{
|
||||
}
|
||||
|
||||
template <std::derived_from<MccMountEventSlew<MountT>> EvT>
|
||||
void enterImpl(EvT& event)
|
||||
{
|
||||
event.mount().slewMount(/* params here ...*/);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mcc
|
||||
|
||||
Reference in New Issue
Block a user