Skip to content

Commit

Permalink
Fixed crash due not checking boundary values of the axis
Browse files Browse the repository at this point in the history
  • Loading branch information
artyom-beilis committed Nov 1, 2024
1 parent d4c96d8 commit 253c38e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/telescope/telescope_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ bool ScopeSim::MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command)
return false;
}
mcRate = static_cast<int>(SlewRateSP.findOnSwitchIndex()) + 1;
mcRate = std::max(1,std::min(4,mcRate));

int rate = (dir == INDI_DIR_NS::DIRECTION_NORTH) ? mcRate : -mcRate;
LOGF_DEBUG("MoveNS dir %s, motion %s, rate %d", dir == DIRECTION_NORTH ? "N" : "S", command == 0 ? "start" : "stop", rate);
Expand All @@ -510,6 +511,8 @@ bool ScopeSim::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command)
}

mcRate = static_cast<int>(SlewRateSP.findOnSwitchIndex()) + 1;
mcRate = std::max(1,std::min(4,mcRate));

int rate = (dir == INDI_DIR_WE::DIRECTION_EAST) ? -mcRate : mcRate;
LOGF_DEBUG("MoveWE dir %d, motion %s, rate %d", dir == DIRECTION_EAST ? "E" : "W", command == 0 ? "start" : "stop", rate);

Expand Down

0 comments on commit 253c38e

Please sign in to comment.