Sync does not update current target position, causing meridian flip offset
@chrisrowland @mutlaqja While fixing UI tests, specifically TestEkosFocus::testFocusWhenMountFlips
, I realised that when the code is doing a sync of the telescope position, currentTargetPosition
is not updated. This situation causes an incorrect flip planning because obsolete coordinates are used to calculate when to flip.
I marked the following lines because in the test, the mount is not moved at all, just synced to its expected position. That causes currentTargetPosition
to be null here. Obviously this is not a real test case but it does show that syncing does not adjust the current target.
// kstars/ekos/mount.cpp - checkMeridianFlip()
if (currentTargetPosition == null)
{
meridianFlipStatusText->setText("Status: inactive (no Target set)");
emit newMeridianFlipText(meridianFlipStatusText->text());
return false;
}
What do you think? Should we adjust currentTargetPosition
based on synced coordinates if the underlying telescope accepts the command so that flipping executes at the right time?
This happens because syncing does not change the mount status, hence updateTelescopeCoords
does not update currentTargetPosition
.
// kstars/ekos/mount.cpp - updateTelescopeCoords()
ISD::Telescope::Status currentStatus = currentTelescope->status();
if (m_Status != currentStatus)
{
qCDebug(KSTARS_EKOS_MOUNT) << "Mount status changed from " << currentTelescope->getStatusString(m_Status)
<< " to " << currentTelescope->getStatusString(currentStatus);
// If we just finished a slew, let's update initialHA and the current target's position
if (currentStatus == ISD::Telescope::MOUNT_TRACKING && m_Status == ISD::Telescope::MOUNT_SLEWING)
{
if (m_MFStatus == FLIP_NONE)
{
flipDelayHrs = 0;
}
setInitialHA((sgn == '-' ? -1 : 1) * ha.Hours());
delete currentTargetPosition;
currentTargetPosition = new SkyPoint(telescopeCoord.ra(), telescopeCoord.dec());
qCDebug(KSTARS_EKOS_MOUNT) << "Slew finished, MFStatus " << meridianFlipStatusString(m_MFStatus);
}
I am working around this by toggling tracking in my test.
As proposed by @mutlaqja we could use another state for Mount, like MOUNT_SYNCING
. I'm involving @wreissenberger in the talk.