Man I hope it clears up for you soon. I guess clear nights is one of a small number of benefits of living so close to a desert :)

I compiled the new code and, unfortunately, the uncontrollable slewing came back. I included the entire modified StopWaitMotor function at the end just for you to check (old code is commented out instead of deleted)

Good news though, is that the "Slew to Target" and tracking accuracies went back to what they were before.

I tested a few other functions and can pretty much confirm that the only time problems occur is when I use manual slew via my ipad vnc client, which is the cause of the second spurious start and immediately stopped slew command. All programmatic slews work properly, such as "GoTo target", "Slew to Target", and perhaps what matters to me the most, "Park" command (It's the last large movement during an unattended imaging session, occurs 4:30AM while I'm asleep). Since the second slew command is not really caused by anything KStars or Ekos/INDI related stuff, it's technically not a bug anymore :) On the other hand, knowing a specific sequence of action can leads to potential equipment damage is a bit nerve wracking.

I'm running a capture sequence now. What I can do tomorrow during day-time is to try another "socat" recording, but this time with timestamps included so you can take a look at the intervals these commands are sent. What I don't understand is, even if the second K1 command gets ignored, the mount should just keep moving regularly, instead of moving erratically with loud noise and not responding to subsequent stop commands, all the while reporting (via f1) that the motor is stopped.

Here is the code I tested:

void Skywatcher::StopWaitMotor(SkywatcherAxis axis)
{
    bool *motorrunning;
    struct timespec wait;
    ReadMotorStatus(axis);
    if (axis == Axis1 && RARunning)
        LastRunningStatus[Axis1] = RAStatus;
    if (axis == Axis2 && DERunning)
        LastRunningStatus[Axis2] = DEStatus;

    //DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
    //dispatch_command(NotInstantAxisStop, axis, nullptr);
    //read_eqmod();

    if (axis == Axis1)
        motorrunning = &RARunning;
    else
        motorrunning = &DERunning;

    //wait.tv_sec  = 0;
    //wait.tv_nsec = 100000000; // 100ms
    //ReadMotorStatus(axis);
    //while (*motorrunning)
    //{
    //    nanosleep(&wait, nullptr);
    //    ReadMotorStatus(axis);
    //}
    if (*motorrunning)
    {
        DEBUGF(telescope->DBG_MOUNT, "%s() : Axis = %c", __FUNCTION__, AxisCmd[axis]);
        dispatch_command(NotInstantAxisStop, axis, nullptr);
        wait.tv_sec  = 0;
        wait.tv_nsec = 100000000; // 100ms
        ReadMotorStatus(axis);
        while (*motorrunning)
        {
            nanosleep(&wait, nullptr);
            ReadMotorStatus(axis);
        }
    }
}


Read More...