New Bug / Regression in REST API in 2.6.12


I updated to 2.6.12 and I get now while using the Camera API:


the following error message:

Invalid gain option specified!

Whatever gain I set. Even no gain set (removed optional parameter) leads to this result ! That was until 2.6.11 not the case ! The Logfile does’t show any error message !


Hi Michel

I am using the latest beta 2.6.12 and also MW 1.2rc and built a 60 point model this evening without any problem using my QSI683.

I can get the log from my Obs pc tomorrow and post on the 10micron forum. I do not have the -d option for extended logging though, but will set for future to help you iron out this issue.


I’m guessing Michael is using an ASCOM camera? This was likely an oversight when we added gains for ASCOM cameras. We’ll take a look and see what’s going on.

Gain is likely mandatory if the camera exposes it. Probably need better language around it in the API but depending on the type of camera some things are required and others aren’t. So “optional” isn’t always accurate and cannot be enforced across all devices. Just like you don’t have to enter an ISO for CCD but for DSLR it is required. Maybe our API documentation has some ability to reflect this.


Ya. Gain broke the ASCOM Camera API for sure (only if the camera implements it). We will need to add gain to the API to fix it.


The API has been fixed in

In addition, the /cameraprops endpoint now contains a “GainValues” string array so that a proper gain value may be selected.

Ken, Jared,

That’s great. I didn’t see it first with a real cam (using an qsi native), but when doing development I use ascom camera simulator, and there the problem started.


The ASCOM gain implementation isn’t the most trivial of things because Gain can either specify an integer gain value or an index into an array of gain values that are specified by the Gains property.

This is reasonably well documented - at least I can understand it - and, looking at the source for the camera simulator, it can be set up to supports both modes.

To implement this you read Gain, Gains, GainMin and GainMax, you will either get a valid value or an error. I think it’s like this:

  • if Gain throws a not implemented exception then Gain is not supported. No need to do more.
  • if Gains returns a list of gains then use the list to populate a list in the UI and use this list to specify Gain as required.
  • If Gains throws an exception then read GainMin and GainMax. Use these to set up UI that requires an integer gain value between GainMin and GainMax. Use the current value of Gain to set the default and read the value from the UI to specify Gain.
  • If this process fails then don’t support Gain. The driver must set a valid value of Gain by default.

Hope this helps, BTW best to wait until connected before doing this, some drivers may not be able to set this up until they have connected to the hardware and read its capabilities.

I’ve always set gain and offset in the ASCOM driver for my ASI1600mm-c and its always worked ok. Can you have setting the gain in SGP optional and allow us to use the ASCOM driver. I really have enough issues without trying to fix things that already work.

SGPro hides all this from the user (via our API)… you just get a list and that’s it.