]> sigrok.org Git - libsigrok.git/commitdiff
hameg-hmo: Query probe unit (Volt, Ampere) from scope
authorStefan Brüns <redacted>
Mon, 2 May 2016 22:08:58 +0000 (00:08 +0200)
committerUwe Hermann <redacted>
Mon, 16 May 2016 21:35:10 +0000 (23:35 +0200)
src/hardware/hameg-hmo/protocol.c
src/hardware/hameg-hmo/protocol.h

index ffd682bf5a7f3158a2ea0c640bcc875a778cec68..280e23208194579fcda7bdf59ab64c0d96a9df18 100644 (file)
@@ -47,6 +47,7 @@ static const char *hameg_scpi_dialect[] = {
        [SCPI_CMD_SET_HORIZ_TRIGGERPOS]     = ":TIM:POS %s",
        [SCPI_CMD_GET_ANALOG_CHAN_STATE]    = ":CHAN%d:STAT?",
        [SCPI_CMD_SET_ANALOG_CHAN_STATE]    = ":CHAN%d:STAT %d",
+       [SCPI_CMD_GET_PROBE_UNIT]           = ":PROB%d:SET:ATT:UNIT?",
 };
 
 static const uint32_t hmo_devopts[] = {
@@ -422,6 +423,19 @@ static int analog_channel_state_get(struct sr_scpi_dev_inst *scpi,
                if (scope_state_get_array_option(scpi, command, config->coupling_options,
                                         &state->analog_channels[i].coupling) != SR_OK)
                        return SR_ERR;
+
+               g_snprintf(command, sizeof(command),
+                          (*config->scpi_dialect)[SCPI_CMD_GET_PROBE_UNIT],
+                          i + 1);
+
+               if (sr_scpi_get_string(scpi, command, &tmp_str) != SR_OK)
+                       return SR_ERR;
+
+               if (tmp_str[0] == 'A')
+                       state->analog_channels[i].probe_unit = 'A';
+               else
+                       state->analog_channels[i].probe_unit = 'V';
+               g_free(tmp_str);
        }
 
        return SR_OK;
index 3747d62b0b36f6e02e1290d6f0f4583ad9143fd0..6219ed635ef048fc014bb43200f1b3b2a79ebd15 100644 (file)
@@ -73,6 +73,7 @@ struct analog_channel_state {
        float vertical_offset;
 
        gboolean state;
+       char probe_unit;
 };
 
 struct scope_state {