scpi-pps: Add config keys SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE,

SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE and
SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE to HP 66xxA power supplies.
This commit is contained in:
Frank Stettner 2019-04-10 11:54:37 +02:00 committed by Uwe Hermann
parent 0ad7074c9e
commit f083ae63c7
2 changed files with 34 additions and 4 deletions

View File

@ -383,7 +383,8 @@ static int config_get(uint32_t key, GVariant **data,
cmd = SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ENABLED;
break;
case SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE:
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB)
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB ||
devc->device->dialect == SCPI_DIALECT_HP_COMP)
gvtype = G_VARIANT_TYPE_STRING;
else
gvtype = G_VARIANT_TYPE_BOOLEAN;
@ -398,7 +399,8 @@ static int config_get(uint32_t key, GVariant **data,
cmd = SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED;
break;
case SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE:
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB)
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB ||
devc->device->dialect == SCPI_DIALECT_HP_COMP)
gvtype = G_VARIANT_TYPE_STRING;
else
gvtype = G_VARIANT_TYPE_BOOLEAN;
@ -413,7 +415,8 @@ static int config_get(uint32_t key, GVariant **data,
cmd = SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION;
break;
case SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE:
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB)
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB ||
devc->device->dialect == SCPI_DIALECT_HP_COMP)
gvtype = G_VARIANT_TYPE_STRING;
else
gvtype = G_VARIANT_TYPE_BOOLEAN;
@ -500,6 +503,13 @@ static int config_get(uint32_t key, GVariant **data,
}
if (cmd == SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE) {
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);
*data = g_variant_new_boolean(reg & (1 << 3));
}
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB) {
/* Evaluate Questionable Status Register bit 0 from a HP 66xxB. */
s = g_variant_get_string(*data, NULL);
@ -510,6 +520,13 @@ static int config_get(uint32_t key, GVariant **data,
}
if (cmd == SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE) {
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);
*data = g_variant_new_boolean(reg & (1 << 6));
}
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB) {
/* Evaluate Questionable Status Register bit 1 from a HP 66xxB. */
s = g_variant_get_string(*data, NULL);
@ -520,6 +537,13 @@ static int config_get(uint32_t key, GVariant **data,
}
if (cmd == SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION_ACTIVE) {
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);
*data = g_variant_new_boolean(reg & (1 << 4));
}
if (devc->device->dialect == SCPI_DIALECT_HP_66XXB) {
/* Evaluate Questionable Status Register bit 4 from a HP 66xxB. */
s = g_variant_get_string(*data, NULL);

View File

@ -442,8 +442,11 @@ static const uint32_t hp_6630a_devopts_cg[] = {
SR_CONF_CURRENT | SR_CONF_GET,
SR_CONF_VOLTAGE_TARGET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_CURRENT_LIMIT | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_SET,
SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE | SR_CONF_GET,
SR_CONF_REGULATION | SR_CONF_GET,
};
@ -462,9 +465,12 @@ static const struct scpi_command hp_6630a_cmd[] = {
{ SCPI_CMD_GET_MEAS_CURRENT, "IOUT?" },
{ SCPI_CMD_SET_VOLTAGE_TARGET, "VSET %.4f" },
{ SCPI_CMD_SET_CURRENT_LIMIT, "ISET %.4f" },
{ SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, "STS?" },
{ SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "OVSET %.4f" },
{ 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_OVER_CURRENT_PROTECTION_ACTIVE, "STS?" },
{ SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION_ACTIVE, "STS?" },
{ SCPI_CMD_GET_OUTPUT_REGULATION, "STS?" },
ALL_ZERO
};