Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting ScopeInfo property #2032

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

tstibor
Copy link
Contributor

@tstibor tstibor commented Mar 21, 2024

Setting Scopeinfo property with previous settings: min, max, step, val:

ScopeInfoNP[FocalLength].fill("FOCAL_LENGTH", "Focal Length (mm)", "%.2f", 10, 10000, 100, 0); ScopeInfoNP[Aperture].fill("APERTURE", "Aperture (mm)", "%.2f", 10, 3000, 100, 0);

resulted in error:

Error: Invalid range for Aperture (mm) (APERTURE). Valid range is from 10 to 3000. Requested value is 0 [DEBUG] Configuration successfully saved for SCOPE_INFO. Error: Invalid range for Focal Length (mm) (FOCAL_LENGTH). Valid range is from 10 to 10000. Requested value is 0 [DEBUG] Configuration successfully saved for SCOPE_INFO.

because at least one property value is 0 by default however, min values are set to 10mm, so the value cannot be set via the property settings. In addition the step size is decreased to 1mm and enum values are in uppercase letters. Moreover, the state of the property is IPS_OK only when the update is successful, otherwise IPS_ALERT.

Setting Scopeinfo property with previous settings: min, max, step, val:

ScopeInfoNP[FocalLength].fill("FOCAL_LENGTH", "Focal Length (mm)", "%.2f", 10, 10000, 100, 0);
ScopeInfoNP[Aperture].fill("APERTURE", "Aperture (mm)", "%.2f", 10, 3000, 100, 0);

resulted in error:

Error: Invalid range for Aperture (mm) (APERTURE). Valid range is from 10 to 3000. Requested value is 0
[DEBUG] Configuration successfully saved for SCOPE_INFO.
Error: Invalid range for Focal Length (mm) (FOCAL_LENGTH). Valid range is from 10 to 10000. Requested value is 0
[DEBUG] Configuration successfully saved for SCOPE_INFO.

because at least one property value is 0 by default however, min values are set
to 10mm, so the value cannot be set via the property settings. In addition the
step size is decreased to 1mm and enum values are in uppercase
letters. Moreover, the state of the property is IPS_OK only when the update is
successful, otherwise IPS_ALERT.
Comment on lines -731 to +732
FocalLength,
Aperture
FOCAL_LENGTH,
APERTURE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason for this change? any other drivers using these enums?

Copy link
Contributor Author

@tstibor tstibor Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used also in guide_simulator.cpp and ccd_simulator.cpp. Checking other parts of the code, it seems to be conform to use capital letter enums definitions. So far all

enum {
 CAPITAL_LETTERS
 ...
 ...
}

have this capital letter pattern. E.g:

enum
        {
            CCD_CAN_BIN        = 1 << 0, /*!< Does the CCD support binning?  */
            CCD_CAN_SUBFRAME   = 1 << 1, /*!< Does the CCD support setting ROI?  */
            CCD_CAN_ABORT      = 1 << 2, /*!< Can the CCD exposure be aborted?  */
            CCD_HAS_GUIDE_HEAD = 1 << 3, /*!< Does the CCD have a guide head?  */
            CCD_HAS_ST4_PORT   = 1 << 4, /*!< Does the CCD have an ST4 port?  */
            CCD_HAS_SHUTTER    = 1 << 5, /*!< Does the CCD have a mechanical shutter?  */
            CCD_HAS_COOLER     = 1 << 6, /*!< Does the CCD have a cooler and temperature control?  */
            CCD_HAS_BAYER      = 1 << 7, /*!< Does the CCD send color data in bayer format?  */
            CCD_HAS_STREAMING  = 1 << 8, /*!< Does the CCD support live video streaming?  */
            CCD_HAS_WEB_SOCKET = 1 << 9, /*!< Does the CCD support web socket transfers?  */
            CCD_HAS_DSP        = 1 << 10 /*!< Does the CCD support image processing?  */
        } CCDCapability;

enum TelescopeStatus
        {
            SCOPE_IDLE,
            SCOPE_SLEWING,
            SCOPE_TRACKING,
            SCOPE_PARKING,
            SCOPE_PARKED
        };
        enum TelescopeMotionCommand
        {
            MOTION_START = 0,
            MOTION_STOP
        };
        enum TelescopeSlewRate
        {
            SLEW_GUIDE,
            SLEW_CENTERING,
            SLEW_FIND,
            SLEW_MAX
        };

@knro knro merged commit 372d293 into indilib:master Mar 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants