ASCOM driver returns wrong status when panel is off

FlatMaster 120 / 150 / 250
Post Reply
stephan
Posts: 12
Joined: Sun Feb 28, 2021 12:39 pm

ASCOM driver returns wrong status when panel is off

Post by stephan »

Hi PegasusAstro,

I recently got the FlatMaster 150 and it just does not work properly with NINA 3.1. After connecting through the latest ASCOM driver as recommended here the Toggle button in NINA cannot properly switch the panel on and off.
The flat wizard has the same problem which means the main feature of the panel, adjusting its brightness per filter, cannot be used.

The root cause is an issue in your ASCOM driver. According to the ASCOM specification when the panel is switched off the CalibratorState property must be set to the value "Off" (1).
Additionally, when the CalibratorState is "Off" the Brightness property must be 0.
The driver however, leaves the CalibratorState at "Ready" (3) and also leaves the Brightness property unchanged after calling the CalibratorOff method.

The proper behaviour is specified here and here.

Those are the two critical points:
When the calibrator is safely off CalibratorState must return Off
The brightness value must be 0 when the CalibratorState is Off
Now NINA relies on the Brightness property when determining if the panel is On or Off. Because the Brightness property is not set to 0 after switching the panel off, NINA believes it is still on. As a result the panel cannot be switched on again as the method returns immediately.

Below you can find a test script written in VBS which can be executed with cscript.exe. When using the ASCOM Simulator it behaves as expected. With the Pegasus driver it does not.
I was using the latest Unity version, the driver number for the FlatMaster was 2.7.4685.427

May be you can have a look at it? Would be really great if the issue could be fixed.

Thanks in advance,
Stephan

Code: Select all

Dim chooser
Set chooser = CreateObject("ASCOM.Utilities.Chooser")
chooser.DeviceType = "CoverCalibrator"

Dim progID
progID = chooser.Choose("ASCOM.PegasusAstroCoverCalibrator 1")
'progID = "ASCOM.PegasusAstroCoverCalibrator 1"
If progID = "" Then
    WScript.Echo "No device selected. Exiting..."
    WScript.Quit
End If

Dim flatpanel
Set flatpanel = CreateObject(progID)

flatpanel.Connected = True

If flatpanel.Connected Then
    WScript.Echo "Connected to: " & flatpanel.Name
    WScript.Echo "DriverInfo: " & flatpanel.DriverInfo
    WScript.Echo "DriverVersion: " & flatpanel.DriverVersion

    WScript.Echo "---------------------"

    WScript.Echo "MaxBrightnes (should be 100): " & flatpanel.MaxBrightness
    WScript.Echo "Initial Brightnes (should be 0 for off): " & flatpanel.Brightness
    WScript.Echo "CalibratorState (should be 1 for off): " & flatpanel.CalibratorState
    WScript.Echo "---------------------"

    WScript.Echo "Switch on with brightness 42"
    
    flatpanel.CalibratorOn(42)
    Do Until flatpanel.CalibratorState <> 2
        WScript.Echo "Waiting for CalibratorState != NotReady"
        WScript.Sleep 100
    Loop
    WScript.Echo "CalibratorState (should be 3 for Ready): " & flatpanel.CalibratorState
    WScript.Echo "Brightness (should be 42): " & flatpanel.Brightness

    WScript.Echo "---------------------"
    WScript.Echo "Switch Off"
    flatpanel.CalibratorOff()
    Do Until flatpanel.CalibratorState <> 2
        WScript.Echo "Waiting for CalibratorState != NotReady"
        WScript.Sleep 100
    Loop
    WScript.Echo "CalibratorState (should be 1 for Off): " & flatpanel.CalibratorState
    WScript.Echo "Brightness (should be 0 for Off): " & flatpanel.Brightness
Else
    WScript.Echo "Failed to connect."
End If

' Disconnect when done
flatpanel.Connected = False
WScript.Echo "Disconnected."

Set flatpanel = Nothing
Set chooser = Nothing

Post Reply