...
This commit is contained in:
parent
4bf95c1043
commit
31cf0a45dd
@ -396,6 +396,10 @@ public:
|
|||||||
[p_event, states, currentState, this]<traits::fsm_state_c curr_state_t>(curr_state_t*) {
|
[p_event, states, currentState, this]<traits::fsm_state_c curr_state_t>(curr_state_t*) {
|
||||||
using to_state_t = curr_state_t::transition_t::template find_state_by_event_t<EvT>;
|
using to_state_t = curr_state_t::transition_t::template find_state_by_event_t<EvT>;
|
||||||
|
|
||||||
|
if constexpr (std::holds_alternative<to_state_t>(*currentState)) {
|
||||||
|
// ?!!!! from self
|
||||||
|
}
|
||||||
|
|
||||||
if constexpr (!std::is_void_v<to_state_t>) {
|
if constexpr (!std::is_void_v<to_state_t>) {
|
||||||
std::lock_guard lock(_transitionMutex);
|
std::lock_guard lock(_transitionMutex);
|
||||||
|
|
||||||
|
|||||||
@ -260,7 +260,7 @@ public:
|
|||||||
using transition_t =
|
using transition_t =
|
||||||
fsm::fsm_transition_table_t<std::pair<MccGenericMountEventInit, MccGenericMountStateInit>,
|
fsm::fsm_transition_table_t<std::pair<MccGenericMountEventInit, MccGenericMountStateInit>,
|
||||||
std::pair<MccGenericMountEventIDLE, MccGenericMountStateUninit>,
|
std::pair<MccGenericMountEventIDLE, MccGenericMountStateUninit>,
|
||||||
std::pair<MccGenericMountEventError, MccGenericMountStateError>,
|
std::pair<MccGenericMountEventError, MccGenericMountStateUninit>,
|
||||||
std::pair<MccGenericMountEventStop, MccGenericMountStateUninit>,
|
std::pair<MccGenericMountEventStop, MccGenericMountStateUninit>,
|
||||||
std::pair<MccGenericMountEventSlew, MccGenericMountStateUninit>,
|
std::pair<MccGenericMountEventSlew, MccGenericMountStateUninit>,
|
||||||
std::pair<MccGenericMountEventTrack, MccGenericMountStateUninit>,
|
std::pair<MccGenericMountEventTrack, MccGenericMountStateUninit>,
|
||||||
@ -272,14 +272,6 @@ public:
|
|||||||
this->exitLog(event);
|
this->exitLog(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void enter(MccGenericMountEventInit& event)
|
|
||||||
{
|
|
||||||
error_t err = event.mount().initMount();
|
|
||||||
if (err) {
|
|
||||||
event.mount().dispatchEvent(MccGenericMountEventError{event.mount(), err});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <std::derived_from<MccGenericMountBaseEvent> EvT>
|
template <std::derived_from<MccGenericMountBaseEvent> EvT>
|
||||||
void enter(EvT& event)
|
void enter(EvT& event)
|
||||||
{
|
{
|
||||||
@ -287,6 +279,35 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct MccGenericMountStateInit : MccGenericMountBaseState {
|
||||||
|
using transition_t =
|
||||||
|
fsm::fsm_transition_table_t<std::pair<MccGenericMountEventInit, MccGenericMountStateInit>,
|
||||||
|
std::pair<MccGenericMountEventIDLE, MccGenericMountStateIDLE>,
|
||||||
|
std::pair<MccGenericMountEventError, MccGenericMountStateError>,
|
||||||
|
std::pair<MccGenericMountEventStop, MccGenericMountStateInit>,
|
||||||
|
std::pair<MccGenericMountEventSlew, MccGenericMountStateInit>,
|
||||||
|
std::pair<MccGenericMountEventTrack, MccGenericMountStateInit>,
|
||||||
|
std::pair<MccGenericMountEventGuiding, MccGenericMountStateInit>>;
|
||||||
|
|
||||||
|
template <std::derived_from<MccGenericMountBaseEvent> EvT>
|
||||||
|
void exit(EvT& event)
|
||||||
|
{
|
||||||
|
this->exitLog(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::derived_from<MccGenericMountBaseEvent> EvT>
|
||||||
|
void enter(EvT& event)
|
||||||
|
{
|
||||||
|
this->enterLog(event);
|
||||||
|
|
||||||
|
error_t err = event.mount()._initMount();
|
||||||
|
if (err) {
|
||||||
|
event.mount().dispatchEvent(MccGenericMountEventError{event.mount(), err});
|
||||||
|
} else {
|
||||||
|
event.mount().dispatchEvent(MccGenericMountEventIDLE{event.mount()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* CONSTRUCTORS AND DESTRUCTOR */
|
/* CONSTRUCTORS AND DESTRUCTOR */
|
||||||
|
|
||||||
@ -311,10 +332,30 @@ public:
|
|||||||
|
|
||||||
virtual ~MccGenericMountFSM() = default;
|
virtual ~MccGenericMountFSM() = default;
|
||||||
|
|
||||||
|
auto initMount()
|
||||||
|
{
|
||||||
|
this->dispatchEvent(MccGenericMountEventInit{*this});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
auto stopMount()
|
auto stopMount()
|
||||||
{
|
{
|
||||||
this->dispatchEvent(MccGenericMountEventStop{*this});
|
this->dispatchEvent(MccGenericMountEventStop{*this});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// wrappers
|
||||||
|
|
||||||
|
auto _initMount()
|
||||||
|
{
|
||||||
|
return base_gmount_t::initMount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
auto _stopMount()
|
||||||
|
{
|
||||||
|
return base_gmount_t::stopMount();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user