Bug when disconnecting an ASCOM mount

188 views
Skip to first unread message

Pierre Franquet

unread,
Aug 8, 2016, 9:35:21 PM8/8/16
to Open PHD Guiding
Hello world ;-)

I m working on a bug I have inside PHD2 with the Pierro-Astro's USB Guider 3.0 :

when connecting and using the interface , all is fine so far, but when I click on "Disconnect" button on the equipment connection window (mount driver disconnection) nothing happens.
could you please tell me what you exactly do when disconnecting ?

the problem I have is that my interface will never connect back if it is not correctly "disconnected" using the "Connected(false)" proper ASCOM command

Thanks for helping

           Pierre FRANQUET - Pierro-Astro'

Andy Galasso

unread,
Aug 8, 2016, 9:48:27 PM8/8/16
to Open PHD Guiding
Hello Pierre,

Could you post your PHD2 Debug Log? There may be some information in there to help diagnose the problem.

Andy

Andy Galasso

unread,
Aug 8, 2016, 9:50:21 PM8/8/16
to Open PHD Guiding
P.S. If your ASCOM driver has an option to enable logging, it would help to turn that on too so we can see what the ASCOM driver is doing when PHD2 disconnects.

Pierre Franquet

unread,
Aug 9, 2016, 2:24:29 AM8/9/16
to Open PHD Guiding

Hi,

I don't use logs much :-) but the driver "launches" msgboxes when the debug_mode is activated (parameter I use from register)

but the problem I see is that the connect function doesn't seem to be called when disconnecting. Could you please let me know the internal calls of the disconnect function you made ?

The PHD2 log file is empty, is there a parameter somewhere to activate logging inside phd2 ?

another bug I saw : when I try to connect the driver first, it bugs with a program main failure. Camera must be connected first (ok seems logical) but if so, may be desactivate "connect" button on mount if it generates an error :-)

If you wish, you can download and use my driver from my web site download page :-)  

http://www.pierro-astro.com/telechargements/category/15-pilotes-ascom-pour-usb-guider-et-usb-focuser

(Pilote ASCOM pour USB-Guider 3.0)

Andy Galasso

unread,
Aug 9, 2016, 11:48:52 AM8/9/16
to Open PHD Guiding
Hi Pierre,

PHD2 does not set Connected = false when the Disconnect or Disconnect All button is clicked.

If PHD2 were to do this then for some ASCOM drivers it would disconnect the scope from other apps that are connected to the scope (like planetarium apps).

I raised this question in the ASCOM developer group, you can see the discussion here: https://groups.yahoo.com/neo/groups/ASCOM-Talk/conversations/topics/34254

PHD2 does release its COM interface references when the disconnect button is clicked so as long as you driver can release resources when the final interface reference is released then it should not need to rely on all clients setting Connected = false.   As a practical matter, your driver _must_ behave this way in order to handle the case of an app terminating abnormally without setting Connected = false.

Hope that helps,
Andy

Pierre Franquet

unread,
Aug 9, 2016, 3:08:02 PM8/9/16
to Open PHD Guiding
Hello Andy,

I m a little stuck so ... I can use procedures like "dispose" or any kind of there but where to put all the unallocation routines if you don't call anything at ending connection ?
ASCOM standard requests a disconnection for releasing resources, and so do I lol so if you had a solution ?

Andy Galasso

unread,
Aug 9, 2016, 3:45:59 PM8/9/16
to Pierre Franquet, Open PHD Guiding
Pierre,

Right, Dispose() could be a good place to free the resources.  My point is that your driver cannot trust clients to set Connected=false before terminating (consider a client being killed by Task Manager or crashing due to some bug) so your driver should be able to handle those cases gracefully.

Can we continue this discussion off the forum?  I feel it is drifting away from PHD2 and into ASCOM driver development.  I have developed some ASCOM drivers and am happy to discuss it more.

Cheers,
Andy

bw_msgboard

unread,
Aug 9, 2016, 8:40:23 PM8/9/16
to Pierre Franquet, Open PHD Guiding

I’ll let Andy follow up on this but I wanted to bring up one point.  I just ran a test of this with my own ASCOM telescope driver, and a PHD2 ‘ disconnect will cause the ASCOM driver to exit if PHD2 was the last remaining client.  So there isn’t any reason to think that what PHD2 is doing should cause problems – in fact, we know it works correctly with all the commonly used ASCOM telescope drivers.  My question is, did you use one of the ASCOM driver templates and if so, which one?  If you didn’t use a template and you’re just trying to do bare-knuckle COM-Interop development, you could end up with a lot of problems in these areas.  I used the local server template for my driver and it has worked very well.

 

Good luck

Bruce

 


--
You received this message because you are subscribed to the Google Groups "Open PHD Guiding" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-phd-guidi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin S

unread,
Apr 26, 2017, 5:53:31 PM4/26/17
to Open PHD Guiding
Sorry I know this is an old thread but very applicable to my question.
Does this apply to ASCOM rotators too??
  
I'm finding that Rotator.Connected becomes false as soon as PHD2 disconnects?  

Thanks!
Kevin

Andy Galasso

unread,
Apr 26, 2017, 11:57:20 PM4/26/17
to Open PHD Guiding
Hi Kevin,

PHD2 sets the ASCOM Connected property to false when the rotator is disconnected. [source code]

But the same logic discussed above regarding mounts still applies ... a local server ASCOM driver should not assume that all clients will set Connected = false before the disconnecting from the local server, and the local server driver should handle that scenario gracefully.

Andy

Reply all
Reply to author
Forward
0 new messages