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.
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.