Ascom command used to open / close shutter

Hi,

I’m writing an Ascom driver to open & close my shed roof but i’m having issues trying trouble integrating it with SGP. When i connect the driver, i then goto the control panel in SGP and i notice that the status in the observatory control doesn’t seem to work, anlong with the open and close buttons.

Which Ascom command is used for for the shutter status and to open & close the the shutter ?

My next question is about removing asom drivers from the driver list. I have lots of drivers listed due to testing various revisions of my driver and i would like to know how i can get rid of them ?

Many thanks in advance,
Richard.

have you tried cnnecting the dome via poth hub and using the control in poth hub to confrim it behaves by hand?

Does “CanSetShutter” return true?

For the status we use ShutterStatus and it should be returning a ShutterState value.

You should be able to uninstall ASCOM drivers via the normal windows installer if you setup a package. If they’re just COM objects then you can use the ASCOM Profile tool to remove them. Or possibly using the RegSvr to unregister the COM object. To be honest I’m not entirely sure what the “correct” way to do it is. I’ve always used the ASCOM Profile tool. Maybe @Chris can add some more data.

Thanks,
Jared

Hi Jared

Many thanks for the quick response. I’ve not coded anything yet to move the shutter, as i fell at the first hurdle of trying to read the shutter status.

Cureently just testing with a vb form, ans i tried reading the status by doing a textbox1.text = objdome.shutterstatus in an attemp to just read the status and place it into a text box.

Do you know what type of value the shutter status returns, as i also tried reading it as an integer and still no joy.

Rich.

The ASCOM documentation describes the shutter states, basically ShutterState is an an enumeration.

The Profile editor can be used to remove unwanted drivers, or if a driver was installed using a installer use the uninstaller.

Chris

Hi Chris,

Thanks for the reply. i basically dont understand how to hadnle it. looking at the documentation, it’s supposed to a number which represent a given state. when i tried to read that state into a string into a integer or string i get no joy.
/
How have you implemented it in SGP, i.e. what line of code did you use to read the shutter state ? as it might point mein the right direction.

Regards,
Richard.
Richard,

The ShutterStatus property returns a ShutterState Enumeration, look up Enumerations in VB and you should get some ideas about how to use these. It’s not a number, nor a string but can be converted to either.

SGP is nothing to do with me but I expect that there will be code like

’ open the shutter
dome.OpenShutter
while not dome.ShutterStatus = ShutterState.shutterOpen ’ check if the shutter is open
Thread.Sleep 1000 ’ wait a bit
wend
’ the shutter is now open
’ no error checking

That’s my attempt at VB and I may have got the detail wrong.
Try to treat ShutterStatus as an enumeration and use the enueration name. It helps to make your code understandable.

Chris

Well,

I thought this was going to be fairly straight forward, i didn’t think it would be this difficult to write a simple ascom driver. Essentially all i’m trying to do is read a string value from the serialport that i terminated with a “#” and depending on that string value “0” or “1” then update the shutter status in SGP, and if then if i click on the open or close button in SGP send a # terminated string back to the serial port.which will tell my hardware to open or close.

That seems as if it shouldn’t be difficult.

It may be worth zipping up your project and posting it to the ASCOM files area. If we can have a look we may be able to suggest something.

Chris

Hi Chris,

I managed to get lots of help from the world of Ascom, with a special thanks to a chap who goes by the name of Tom How from the Currige observatory who pretty much wrote the code for me for both my Arduino and the VB for the Ascom driver and i’m glad to report that it works perfectly.

Now all i need is to wait and see if a potential bug i reported in SGP with Dome slaving is just down to my pc or if it affects everyone.

For the rest of the week i’ll be adding in the code for the magnetic sensors and a rain sensor along with adding a colour tough screen to my Arduino.

Many thanks for everyones help.
Rich.

I seem to be having the same issue. You didn’t state what the solution was.
I’ve written Arduino code which is fully debugged.
I written an ASCOM driver in VB. However, despite setting “CanSethutter” return value to True, I only ever see a status of shutter closed and as consequence SGPro can only ever be used to open the shutter.
Close does not work from SGPro but does work from the ASCOM Dome Control panel. The Dom Control Panel also only ever shows “Staus: Closed”, so I’m sure that’s the issue.

CanSetShutter is a capability property and reports what the driver can do.

You also need to implement the ShutterStatus property where you report if the shutter is open, closed or moving using the ShutterState enumeration, the OpenShutter() method and the CloseShutter() method which do what they say.

1 Like

Hi Chris,

Thanks for the prompt reply.
Yes, I have implemented ShutterStatus but only report either open or closed.
It is essential to report Opening and Closing too?

My Arduino implementation accepts the following commands:

  1. DS# (Dome Status) - responds with “O”, “C” or “M” for open closed or moving.
  2. DO# (Dome Open) - Issued in my ASCOM driver from OpenShutter.
  3. DC# (Dome Close) - Issued in my ASCOM driver from CloseShutter.

My ShutterStatus implementation issues the DS# command, but I only use the shutterClosed and shutterOpen enumerations at the moment. Maybe I’ll try adding the other two? I see there’s also ShutterError. My Arduino responds with “J” for jammed which is determined by checking that the limit switches release in the first 500mS of motor movement, so I could add that too.

Ian

I’d map the Arduino status to the ASCOM ones, after all the arduino knows if it’s in the process of opening or closing the shutter.
What do you currently report when the shutter is neither open nor closed?

My Arduino code reports “M#” if the shutter is neither open or closed.
However, it currently sits in the open or close functions until either the limit switch has been triggered or it has timed out, i.e. unable to process further commands.

I believe the client application, i.e. SGPro in my case, polls ShutterStatus of the ASCOM driver continuously. Is that your understanding?

Looks like I need to re-write my Arduino code.

That said, when I hard-code a “close” into my ASCOM driver’d ShutterStatus property I still only ever see “closed” reported by ASCOM dome control panel and SGPro, so I’m not fully convinced.

I’ll try a re-jig of the Arduino code when I get the chance and let you know how it goes.

Thanks for all your help, it’s greatly appreciated.

Ian

You could report different states depending if your Arduino is opening or closing. I’d also design the Arduino code so it didn’t block at all. I don’t know your code but you might be able to have the main loop checking to see if there is a command coming and if not check the limit switches and turn the motor on or off and set the status appropriately.
Or perhaps the limit switches could generate interrupts and the interrupt service routines would change the status and turn the motor off.
The client can poll as fast as it likes and could run multiple threads so even though the code is blocked in the open or close method the status could still be read in a different thread.

Hi Chris,

I re-wrote my Arduino code today to return all four states, open, closing, closed and opening. Also, now does not block status requests.

I also had issues with Windows 10 deciding to use the old version of my ASCOM DLL. A quick delete of all versions on the system, re-installed the driver and all working perfectly.

Thanks for the pointers.

Ian