This commit is contained in:
2025-11-01 17:53:24 +03:00
parent 683da9739d
commit 3f108fcc13
5 changed files with 117 additions and 61 deletions

View File

@@ -275,7 +275,7 @@ public:
error_t trackTarget()
{
auto err = TrackModelT::traclTarget();
auto err = TrackModelT::trackTarget();
if (err) {
*_mountStatus = mount_status_t::ERROR;
@@ -486,7 +486,7 @@ protected:
struct MccGenericFsmMountIdleState
: MccGenericFsmMountBaseState // IDLE state: mount is stopped, wait for client commands
{
static constexpr std::string_view ID{"GENERIC-MOUNT-IDLDE-STATE"};
static constexpr std::string_view ID{"GENERIC-MOUNT-IDLE-STATE"};
using transition_t = fsm::fsm_transition_table_t<
std::pair<MccGenericFsmMountIdleEvent, MccGenericFsmMountIdleState<ERROR_STATE_T>>,
@@ -584,23 +584,23 @@ protected:
std::pair<MccGenericFsmMountSlewEvent, MccGenericFsmMountSlewState>>;
void exit(MccGenericFsmMountSlewEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn(
"It seems re-entering to slewing state was asked! Do not stop the current slewing process, just "
"ignore this event!");
}
}
// void exit(MccGenericFsmMountSlewEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn(
// "It seems re-entering to slewing state was asked! Do not stop the current slewing process, just "
// "ignore this event!");
// }
// }
void enter(MccGenericFsmMountSlewEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn(
"It seems re-entering to slewing state was asked! Do not start a new slewing process, just ignore "
"this event!");
}
}
// void enter(MccGenericFsmMountSlewEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn(
// "It seems re-entering to slewing state was asked! Do not start a new slewing process, just ignore
// " "this event!");
// }
// }
void exit(fsm::traits::fsm_event_c auto& event)
{
@@ -613,10 +613,17 @@ protected:
auto* mount_ptr = event.mount();
if (event.mount()->previousStateID() == ID) {
event.mount()->logWarn(
"It seems re-entering to slewing state was asked! Do not start a new slewing process, just ignore "
"this event!");
return;
}
// call base-class stopMount method!
auto err = static_cast<MOUNT_T*>(mount_ptr)->slewToTarget();
if (err) {
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr});
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr, err});
return;
}
@@ -642,23 +649,23 @@ protected:
std::pair<MccGenericFsmMountTrackEvent, MccGenericFsmMountTrackState>>;
void exit(MccGenericFsmMountTrackEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn(
"It seems re-entering to tracking state was asked! Do not stop the current tracking process, just "
"ignore this event!");
}
}
// void exit(MccGenericFsmMountTrackEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn(
// "It seems re-entering to tracking state was asked! Do not stop the current tracking process, just
// " "ignore this event!");
// }
// }
void enter(MccGenericFsmMountTrackEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn(
"It seems re-entering to tracking state was asked! Do not start a new tracking process, just "
"ignore this event!");
}
}
// void enter(MccGenericFsmMountTrackEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn(
// "It seems re-entering to tracking state was asked! Do not start a new tracking process, just "
// "ignore this event!");
// }
// }
void exit(fsm::traits::fsm_event_c auto& event)
{
@@ -671,10 +678,17 @@ protected:
auto* mount_ptr = event.mount();
if (mount_ptr->previousStateID() == ID) {
mount_ptr->logWarn(
"It seems re-entering to tracking state was asked! Do not start a new tracking process, just "
"ignore this event!");
return;
}
// call base-class stopMount method!
auto err = static_cast<MOUNT_T*>(mount_ptr)->trackTarget();
if (err) {
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr});
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr, err});
return;
}
@@ -696,21 +710,21 @@ protected:
std::pair<MccGenericFsmMountStopEvent, MccGenericFsmMountStopState>>;
void exit(MccGenericFsmMountStopEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn("It seems a re-entering to the stop state was asked! Ignore the event!");
}
}
// void exit(MccGenericFsmMountStopEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn("It seems a re-entering to the stop state was asked! Ignore the event!");
// }
// }
void enter(MccGenericFsmMountStopEvent& event)
{
if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
event.mount()->logWarn(
"It seems a re-entering to the stop state was asked! Ignore the event and wait for the mount to "
"stop!");
}
}
// void enter(MccGenericFsmMountStopEvent& event)
// {
// if constexpr (mcc_generic_log_mount_c<MOUNT_T>) {
// event.mount()->logWarn(
// "It seems a re-entering to the stop state was asked! Ignore the event and wait for the mount to "
// "stop!");
// }
// }
void exit(fsm::traits::fsm_event_c auto& event)
{
@@ -723,10 +737,17 @@ protected:
auto* mount_ptr = event.mount();
if (mount_ptr->previousStateID() == ID) {
mount_ptr->logWarn(
"It seems a re-entering to the stop state was asked! Ignore the event and wait for the mount to "
"stop!");
return;
}
// call base-class stopMount method!
auto err = static_cast<MOUNT_T*>(mount_ptr)->stopMount();
if (err) {
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr});
mount_ptr->dispatchEvent(MccGenericFsmMountErrorEvent{mount_ptr, err});
return;
}