I forgot the indi version which is:
INDI Library: 1.9.1
Code v1.9.1-10-g9045b593. Protocol 1.7.
I am quite sure the current indi version distributed via ppa suffers this bug.
I made some tests even with TrackState = SCOPE_TRACKING disabled in the OnStep driver.
It must for sure be somewhere in indi or kstars, not in the driver itself ...
Trying to simplify things, I'd removed some parking code which also handled the :GU return in one case (not n or N). The own goto should be updated with that (and unrelated PEC, since the command (:QZ#) used no longer works on newer versions, but that should be good now.)
!n !N = SLEWING (tracking, goto) < Case I neglected, since it seems like you wouldn't be tracking while on a goto
n !N = SLEWING (not tracking, goto)
(If also I (Parking n progress) = PARKING)
!n N = TRACKING (tracking, no goto)
n N = IDLE (not tracking, no goto)
P (Parked, also set parked true) PARKED
Related which only give Messages/not change trackstate:
p (sets parked false) (unparked)
F (sets parked false) (parking failed)
I (sets parked false, case handled above) (parking in progress)
H (messages only, combined with p/P)
Someone want to check my logic to make sure I didn't miss anything?
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.
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.
Séquence Kstars with mount parked:
2021-07-06T10:20:36 Shutdown complete.
2021-07-06T10:20:36 Ekos stopped.
2021-07-06T10:20:35 INDI devices disconnected.
2021-07-06T10:20:31 Mount parked.
2021-07-06T10:20:30 Parking mount in progress...
2021-07-06T10:20:29 Cap parked.
2021-07-06T10:20:24 Parking Cap...
2021-07-06T10:20:23 No jobs left in the scheduler queue.
2021-07-06T10:20:22 Job 'Neptune' is terminated due to errors.
2021-07-06T10:20:22 Warning: job 'Neptune' slew failed, marking terminated due to errors.
2021-07-06T10:20:21 Job 'Neptune' is slewing to target.
2021-07-06T10:20:21 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:20:20 Job 'Neptune' is slewing to target.
2021-07-06T10:20:20 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:20:17 Job 'Neptune' is slewing to target.
2021-07-06T10:20:15 Cap unparked.
2021-07-06T10:20:10 Unparking cap...
2021-07-06T10:20:09 Mount unparked.
2021-07-06T10:20:04 Scheduler started.
Sequence Kstars with mount unparked:
2021-07-06T10:28:02 Shutdown complete.
2021-07-06T10:28:02 Ekos stopped.
2021-07-06T10:28:01 INDI devices disconnected.
2021-07-06T10:27:57 Mount parked.
2021-07-06T10:27:56 Mount unparked.
2021-07-06T10:27:55 Mount unparked.
2021-07-06T10:27:54 Mount unparked.
2021-07-06T10:27:53 Mount unparked.
2021-07-06T10:27:52 Mount unparked.
2021-07-06T10:27:51 Parking mount in progress...
2021-07-06T10:27:50 Cap parked.
2021-07-06T10:27:45 Parking Cap...
2021-07-06T10:27:44 No jobs left in the scheduler queue.
2021-07-06T10:27:43 Job 'Neptune' is terminated due to errors.
2021-07-06T10:27:43 Warning: job 'Neptune' slew failed, marking terminated due to errors.
2021-07-06T10:27:42 Job 'Neptune' is slewing to target.
2021-07-06T10:27:42 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:27:41 Job 'Neptune' is slewing to target.
2021-07-06T10:27:41 Warning: job 'Neptune' found not slewing, restarting.
2021-07-06T10:27:38 Job 'Neptune' is slewing to target.
2021-07-06T10:27:36 Cap unparked.
2021-07-06T10:27:31 Unparking cap...
2021-07-06T10:27:30 Mount already unparked.
2021-07-06T10:27:28 Scheduler started.
Sequence Kstars with old driver and mount parked:
2021-07-06T10:39:17 Shutdown complete.
2021-07-06T10:39:17 Ekos stopped.
2021-07-06T10:39:16 INDI devices disconnected.
2021-07-06T10:39:12 Mount parked.
[NOK] The telescope is on Neptune, not parked
2021-07-06T10:39:11 Parking mount in progress...
2021-07-06T10:39:10 Cap parked.
2021-07-06T10:39:05 Parking Cap...
2021-07-06T10:39:04 No jobs left in the scheduler queue.
2021-07-06T10:39:03 Job 'Neptune' is complete.
2021-07-06T10:39:02 Job 'Neptune' capture is in progress...
[NOK] capture start before the mount is on Neptune
2021-07-06T10:39:02 Job 'Neptune' slew is complete.
2021-07-06T10:39:00 Job 'Neptune' is slewing to target.
2021-07-06T10:38:58 Cap unparked.
2021-07-06T10:38:53 Unparking cap...
2021-07-06T10:38:52 Mount unparked.
2021-07-06T10:38:48 Scheduler started.
after some thinking (yes it happens) I believe best is to discriminate the sates based on the following return codes:
Status Unambiguous OnStep return Code
Slewing p and !N (it is the only one that is ambiguous with Tracking
I tried it on many scenarios and seems to work fine.
Will do some more tests and return to you with code.