]> sigrok.org Git - libsigrok.git/commitdiff
scpi-pps: Add SR_CONF_REGULATION for HP 66xxA power supplies.
authorFrank Stettner <redacted>
Wed, 10 Apr 2019 09:39:55 +0000 (11:39 +0200)
committerUwe Hermann <redacted>
Wed, 17 Apr 2019 15:44:59 +0000 (17:44 +0200)
src/hardware/scpi-pps/api.c
src/hardware/scpi-pps/profiles.c

index 104a020d84e06859f716b0603963a8f81f32fd89..8c3490c5a35ca926f24fb1bd25a49d8f61a38ca3 100644 (file)
@@ -459,6 +459,22 @@ static int config_get(uint32_t key, GVariant **data,
                                *data = g_variant_new_string("CC");
                        }
                }
+               if (devc->device->dialect == SCPI_DIALECT_HP_COMP) {
+                       /* Evaluate Status Register from a HP 66xx in COMP mode. */
+                       s = g_variant_get_string(*data, NULL);
+                       sr_atoi(s, &reg);
+                       g_variant_unref(*data);
+                       if (reg & (1 << 0))
+                               *data = g_variant_new_string("CV");
+                       else if (reg & (1 << 1))
+                               *data = g_variant_new_string("CC");
+                       else if (reg & (1 << 2))
+                               *data = g_variant_new_string("UR");
+                       else if (reg & (1 << 9))
+                               *data = g_variant_new_string("CC-");
+                       else
+                               *data = g_variant_new_string("");
+               }
                if (devc->device->dialect == SCPI_DIALECT_HP_66XXB) {
                        /* Evaluate Operational Status Register from a HP 66xxB. */
                        s = g_variant_get_string(*data, NULL);
@@ -475,8 +491,8 @@ static int config_get(uint32_t key, GVariant **data,
                }
 
                s = g_variant_get_string(*data, NULL);
-               if (g_strcmp0(s, "CV") && g_strcmp0(s, "CC") &&
-                       g_strcmp0(s, "CC-") && g_strcmp0(s, "UR")) {
+               if (g_strcmp0(s, "CV") && g_strcmp0(s, "CC") && g_strcmp0(s, "CC-") &&
+                       g_strcmp0(s, "UR") && g_strcmp0(s, "")) {
 
                        sr_err("Unknown response to SCPI_CMD_GET_OUTPUT_REGULATION: %s", s);
                        ret = SR_ERR_DATA;
index 93718be1c97dfe7c470c903756d4cb8ccebf71ab..efec3ce9b49bcfd8e5443296c99f0ac6d4237e67 100644 (file)
@@ -444,6 +444,7 @@ static const uint32_t hp_6630a_devopts_cg[] = {
        SR_CONF_CURRENT_LIMIT | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_SET,
+       SR_CONF_REGULATION | SR_CONF_GET,
 };
 
 static const struct channel_spec hp_6633a_ch[] = {
@@ -464,6 +465,7 @@ static const struct scpi_command hp_6630a_cmd[] = {
        { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, "OCP 1" },
        { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, "OCP 0" },
        { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "OVSET %.4f" },
+       { SCPI_CMD_GET_OUTPUT_REGULATION, "STS?" },
        ALL_ZERO
 };