ASCOM Focuser & Temp Compensation

A place to report problems and bugs in SharpCap
Forum rules


If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs

Please also read about Troubleshooting USB Issues before posting.

*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***

Please include the following details in any bug report:

* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
Post Reply
Excalibur
Posts: 8
Joined: Tue Sep 12, 2017 5:24 pm

ASCOM Focuser & Temp Compensation

#1

Post by Excalibur »

Hi Robin,
I know you made some changes regarding Focusers when ASCOM 6.4 was released, but I am not sure I follow what those changes were.

However, since I am the writer of Baader Steeldrive ASCOM driver I realised I needed to upgrade for ASCOM 6.4, now done. Now being more on par with what the changes where and why, I find that Sharpcap still does not allow Move when TempComp is active.

There is a backstory to why focusers have been badly specced in ASCOM for years, and why there have been different manual workarounds in programs like MaxImDL to handle this inconsistency. But now with ASCOM 6.4 at least it is clear who have responsibility to do what concerning how drivers should be used.

IFocuserV2.Move allows exceptions, which some focusers throw if TempComp is active.
IFocuserV3.Move must not throw exceptions, and it is up to the writer of the driver to handle issues if TempComp is active.

My driver, ASCOM Baader Steeldrive Focuser, is now ported to IFcosuerV3 but I still find that SharpCap does not allow Move when TempComp is active.

Since there is a degree of backward compatibility to consider, I would propose the following change:
1. If focuser method .InterfaceVersion returns < 3, proceed as now.
2. If focuser method .InterfaceVersion returns >= 3, allow Move even if TempComp is active.

Does this seem acceptable?

I can help testing and verifying the changes if you proceed, just contact me.

Clear Skies,
Magnus
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: ASCOM Focuser & Temp Compensation

#2

Post by admin »

Hi Magnus,

thanks for the heads up on that – I hadn't realised that there was a new version of the IFocuser interface available in the latest Ascom platform. I will have to update SharpCap when I get some time to use that new version of the interface if possible and fall back to the original version if the new version isn't there.

Cheers, Robin
User avatar
admin
Site Admin
Posts: 13177
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: ASCOM Focuser & Temp Compensation

#3

Post by admin »

Hi,

you have to love Ascom, don't you! They change the behaviour with the new version of the interface, but there's no clean way inside the client application to tell whether you're talking to the old type of driver or the new type of driver. I've changed things around so that it will allow the command to run the move to be sent to the Ascom driver in the hope that it will work. If an error comes back and it turns out that temperature compensation was active then SharpCap will show the same error box that it previously did. If no error comes back then presumably everything is worked. If an error comes back and temperature compensation is inactive then presumably something has gone wrong inside the Ascom driver itself (lost communication with device, et cetera).

Anyway, hopefully this will fix your issue and it's in the latest version of SharpCap 3.2 which can be downloaded from the usual place.

Cheers, Robin
Excalibur
Posts: 8
Joined: Tue Sep 12, 2017 5:24 pm

Re: ASCOM Focuser & Temp Compensation

#4

Post by Excalibur »

Hi Robin,

Quick work indeed, I downloaded the latest version and tested - Focuser moves also with TempComp active.

However, it seems you have based the logic on ASCOM 6.4 being used. I am not sure that is a good idea for Sharpcap, since installing ASCOM 6.4 does not magically make the drivers conform to the new interface.

There is one simple way to tell. All drivers, Focusers as well, include a method:

269 public short InterfaceVersion
270 {
271 // set by the driver wizard
272 get
273 {
274 tl.LogMessage("InterfaceVersion Get", "TEMPLATEINTERFACEVERSION");
275 return Convert.ToInt16("TEMPLATEINTERFACEVERSION");
276 }
277 }

This will tell which version the driver says it is conforming to:

In this case:
InterfaceVersion < 3, old standard - handle as you please. The documentation also warns that early V1 might instead throw an exception.
InterfaceVersion = 3, the driver is based on the new IFocuserV3. and it is always safe to issue a Move(), after checking that it is not already IsMoving(). Although I dont know if any driver is yet multiclient (mine is not) it is always best to not assume.
InterfaceVersion > 3, likely to happen in the future, will at least conform to IFocuserV3 concerning Move() unless otherwise stated by ASCOM.

I suspect using this would be far safer since it requires Drivers to be upgraded and conforming to IFocuserV3 before Move() is allowed with TempComp active = less concern for SharpCap. There is no telling what older Focusers might cause SharpCap to do if you only base it on ASCOM 6.4++ being active.

Clear Skies,
Magnus
Post Reply