JOLO Focuser problem


#1

Greetings,

I am using SGP for a six months and I am really satisfied with it, its a nice piece of software. But last week I finaly manage to liven up arduino based JOLO focuser. It works through ASCOM driver and in MaximDL everything works fine.

But I really prefere SGP, so I tried hard to make it working, unfortunately I fail…
Does anyone have a clue what is going on? Is there a hope?

I am able to connect device without problem, but when I try go to some position or coarse the focuser,somethimes it works once or twice, but then nothing happened and connection is lost. Situation is recorded in log file.

Any help is really appreciated.
Michal

sg_logfile_20160818211423.txt (42.6 KB)


#2

There are a lot of errors in the log, all of which are coming from the ASCOM driver. I’d recommend looking into the ASCOM driver if you have the code or getting in touch with the ASCOM maintainer.

Also the version of SGP you’re using is quite old, I’d recommend upgrading.

Thanks,
Jared


#3

Thanks for replay.
Sorry about the old version of SGP, now I am updated to newest version, but problem is still here.
I am not a professional code writer, but maybe I found some leads. I installed Serial port monitor and I am watching the communication on COM port which is connected to focuser. Here is what happened when I order to move the focuser in MaximDL:

P.P:1039.I.I:false.P.P:1039.I.I:false.P.P:1039.M:1012.M.I.I:true.I.I:false.I.I:false.P.P:1012.I.I:false.P.P:1012.I.I:false

and there is the same situation with SGP:

P.P:1012.P.P:1012.I.I:false.P.P:1012.M:1000.M.I.I:true.P.P:1006.P.P:1000.P.P:1000.P.P:1000.P.P:1000.P.P:1000.I.P.I:false.P:1000.P.P:1000

could it be problem of overlaping or too short timeout? It looks like this generates the errors from ASCOM driver.
Can I do anything with it?

Thank a lot.
Michal


#4

The driver is likely not designed to handle calls from multiple threads. This is generally an easy fix in the ASCOM driver.

Thanks,
Jared


#5

OK, I tried to adapt the ASCOM driver to handle multithreading. I gave it more then 12 hours, but obviously its too much for my skills…

Is there anyone to help me with it? I know its not the SGP related issue, but I have nobody else to ask, original developer not answering…

I will continue with trying…

Michal

Driver.zip (4.2 KB)


#6

This might help

Private Shared lockObj As New Object
Public Function CommandString(ByVal Command As String, Optional ByVal Raw As Boolean = False) As String Implements IFocuserV2.CommandString
    CheckConnected("CommandString")
    Dim commandToSend As String = Command
    If Not (Raw) Then
        commandToSend = Command + Constants.vbLf
    End If
    Dim answer As String
    SyncLock lockObj
        Try
            ComPort.Write(commandToSend)
            answer = ComPort.ReadTo(Constants.vbLf)
        Catch ex As System.TimeoutException
            Throw New ASCOM.DriverException("Serial port timeout for command " + Command)
        Catch ex As System.InvalidOperationException
            Throw New ASCOM.DriverException("Serial port is not opened")
        End Try
        Return answer.Trim(Constants.vbLf)
    End SyncLock
End Function

The SyncLock structure should prevent a second call to CommandString sending a message to the hardware before the first one has finished.

I’d also add a considerable amount of logging to the driver, it makes it far easier to find out what is going on.

Chris

PS this is totally untested, no errors at edit time but that’s it, not even compiled.


#7

Guys, I don’t know what to say…
Thank You so much Chris!

What a day! My third child was born five minutes after midnight and now my almost home made focuser seems to work! Now its time for some beer… a lot of them. :slight_smile:

Solution is so simple, I tried to implement mutex in code, but it was too much for me, as usually I took the hammer to kill the mosquito…

Thanks again, I will report how it will work after mechanical assembly.

Michal


www.mainsequencesoftware.com