]> sigrok.org Git - libsigrok.git/commitdiff
deree-de5000: Drop SR_CONF_MEASURED_QUANTITY functionality.
authorBert Vermeulen <redacted>
Sat, 29 Aug 2015 21:01:02 +0000 (23:01 +0200)
committerBert Vermeulen <redacted>
Sun, 30 Aug 2015 18:40:56 +0000 (20:40 +0200)
This was superfluous -- there is no need to be able to query the
last MQ(s) sent by the device, since they're already being sent
along with the measurements in analog packets.

Since there is also no way to change the MQ (that is done with the
buttons on the device), there is no need to even list the possible
MQs.

src/lcr/es51919.c

index 3b02852427c9394d3ee63c9d4fd2a8b7199bc5fe..cbce7dcd849d15332200850962bc69d23f829ecf 100644 (file)
@@ -406,20 +406,6 @@ static const double frequencies[] = {
        100, 120, 1000, 10000, 100000, 0,
 };
 
-enum { QUANT_AUTO = 5, };
-
-static const char *const quantities1[] = {
-       "NONE", "INDUCTANCE", "CAPACITANCE", "RESISTANCE", "RESISTANCE", "AUTO",
-};
-
-static const char *const list_quantities1[] = {
-       "NONE", "INDUCTANCE", "CAPACITANCE", "RESISTANCE", "AUTO",
-};
-
-static const char *const quantities2[] = {
-       "NONE", "DISSIPATION", "QUALITY", "RESISTANCE", "ANGLE", "AUTO",
-};
-
 enum { MODEL_NONE, MODEL_PAR, MODEL_SER, MODEL_AUTO, };
 
 static const char *const models[] = {
@@ -443,12 +429,6 @@ struct dev_context {
        /** The frequency of the test signal (index to frequencies[]). */
        unsigned int freq;
 
-       /** Measured primary quantity (index to quantities1[]). */
-       unsigned int quant1;
-
-       /** Measured secondary quantity (index to quantities2[]). */
-       unsigned int quant2;
-
        /** Equivalent circuit model (index to models[]). */
        unsigned int model;
 };
@@ -584,18 +564,6 @@ static unsigned int parse_freq(const uint8_t *pkt)
        return freq;
 }
 
-static unsigned int parse_quant(const uint8_t *pkt, int is_secondary)
-{
-       const uint8_t *buf;
-
-       if (pkt[2] & 0x20)
-               return QUANT_AUTO;
-
-       buf = pkt_to_buf(pkt, is_secondary);
-
-       return buf[0];
-}
-
 static unsigned int parse_model(const uint8_t *pkt)
 {
        if (pkt[2] & 0x40)
@@ -639,18 +607,6 @@ static int send_freq_update(struct sr_dev_inst *sdi, unsigned int freq)
                                g_variant_new_double(frequencies[freq]));
 }
 
-static int send_quant1_update(struct sr_dev_inst *sdi, unsigned int quant)
-{
-       return do_config_update(sdi, SR_CONF_MEASURED_QUANTITY,
-                               g_variant_new_string(quantities1[quant]));
-}
-
-static int send_quant2_update(struct sr_dev_inst *sdi, unsigned int quant)
-{
-       return do_config_update(sdi, SR_CONF_MEASURED_2ND_QUANTITY,
-                               g_variant_new_string(quantities2[quant]));
-}
-
 static int send_model_update(struct sr_dev_inst *sdi, unsigned int model)
 {
        return do_config_update(sdi, SR_CONF_EQUIV_CIRCUIT_MODEL,
@@ -676,22 +632,6 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
                        return;
        }
 
-       val = parse_quant(pkt, 0);
-       if (val != devc->quant1) {
-               if (send_quant1_update(sdi, val) == SR_OK)
-                       devc->quant1 = val;
-               else
-                       return;
-       }
-
-       val = parse_quant(pkt, 1);
-       if (val != devc->quant2) {
-               if (send_quant2_update(sdi, val) == SR_OK)
-                       devc->quant2 = val;
-               else
-                       return;
-       }
-
        val = parse_model(pkt);
        if (val != devc->model) {
                if (send_model_update(sdi, val) == SR_OK)
@@ -882,12 +822,6 @@ SR_PRIV int es51919_serial_config_get(uint32_t key, GVariant **data,
        case SR_CONF_OUTPUT_FREQUENCY:
                *data = g_variant_new_double(frequencies[devc->freq]);
                break;
-       case SR_CONF_MEASURED_QUANTITY:
-               *data = g_variant_new_string(quantities1[devc->quant1]);
-               break;
-       case SR_CONF_MEASURED_2ND_QUANTITY:
-               *data = g_variant_new_string(quantities2[devc->quant2]);
-               break;
        case SR_CONF_EQUIV_CIRCUIT_MODEL:
                *data = g_variant_new_string(models[devc->model]);
                break;
@@ -941,8 +875,6 @@ static const uint32_t devopts[] = {
        SR_CONF_LIMIT_FRAMES | SR_CONF_SET,
        SR_CONF_LIMIT_MSEC | SR_CONF_SET,
        SR_CONF_OUTPUT_FREQUENCY | SR_CONF_GET | SR_CONF_LIST,
-       SR_CONF_MEASURED_QUANTITY | SR_CONF_GET | SR_CONF_LIST,
-       SR_CONF_MEASURED_2ND_QUANTITY | SR_CONF_GET | SR_CONF_LIST,
        SR_CONF_EQUIV_CIRCUIT_MODEL | SR_CONF_GET | SR_CONF_LIST,
 };
 
@@ -966,14 +898,6 @@ SR_PRIV int es51919_serial_config_list(uint32_t key, GVariant **data,
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_DOUBLE,
                        frequencies, ARRAY_SIZE(frequencies), sizeof(double));
                break;
-       case SR_CONF_MEASURED_QUANTITY:
-               *data = g_variant_new_strv(list_quantities1,
-                                          ARRAY_SIZE(list_quantities1));
-               break;
-       case SR_CONF_MEASURED_2ND_QUANTITY:
-               *data = g_variant_new_strv(quantities2,
-                                          ARRAY_SIZE(quantities2));
-               break;
        case SR_CONF_EQUIV_CIRCUIT_MODEL:
                *data = g_variant_new_strv(models, ARRAY_SIZE(models));
                break;