Here's what I've got, with everything together to handle the TrackState (unparking handled down below) There aren't any other TrackStates assigned.

if (strstr(OSStat, "P"))
{
SetParked(true); //defaults to TrackState=SCOPE_PARKED
TrackState = SCOPE_PARKED;
IUSaveText(&OnstepStat[3], "Parked");
} else {
if (strstr(OSStat, "n") && strstr(OSStat, "N"))
{
IUSaveText(&OnstepStat[1], "Idle");
TrackState = SCOPE_IDLE;
}
if (strstr(OSStat, "n") && !strstr(OSStat, "N"))
{
if (strstr(OSStat, "I")) {
IUSaveText(&OnstepStat[1], "Parking/Slewing");
TrackState = SCOPE_PARKING;
} else {
IUSaveText(&OnstepStat[1], "Slewing");
TrackState = SCOPE_SLEWING;
}
}
if (strstr(OSStat, "N") && !strstr(OSStat, "n"))
{
IUSaveText(&OnstepStat[1], "Tracking");
TrackState = SCOPE_TRACKING;
}
if (!strstr(OSStat, "N") && !strstr(OSStat, "n"))
{
IUSaveText(&OnstepStat[1], "Slewing");
TrackState = SCOPE_SLEWING;
}
}

That then becomes the only handling the lx200_OnStep driver does, but there are some lower levels:

Going through lx200telescope/lx200generic, and trying to cross reference things, the only place it looks like it sets state that isn't overridden is in the init with a SCOPE_IDLE (which seems fine). (Goto and Park (overriden both set it)).

There are some in inditelescope, but I'm not certain I've found them all.

ISNewSwitch():
TrackStateSP, will change it.
ParkStateSP will change it as well.

As will the call to SetParked/SyncParkStatus (Changes to IDLE or PARK)

TODO: copy/modify to intercept TrackStateSP & ParkStateSP.
TODO: copy/override SetParked/SyncParkStatus

That will move us to a model of purely from-telescope instead of an assumed command state + from-telescope.

Once those are done, That should mean 100% the OnStep driver has control of the Trackstate, with the above from :GU#, and should eliminate the kstars camera issue.

Read More...