]> sigrok.org Git - libsigrok.git/blobdiff - hardware/gmc-mh-1x-2x/protocol.c
Fix 'aquisition' typo in a few places.
[libsigrok.git] / hardware / gmc-mh-1x-2x / protocol.c
index b0163dbd1e0bf2eeac67e2e8e868665fc2b12796..d20c910b73070fe5e6878f434d64efc6cc62600a 100644 (file)
@@ -132,7 +132,7 @@ static void decode_rs_16(uint8_t rs, struct dev_context *devc)
                if (devc->mq == SR_MQ_VOLTAGE) /* V */
                        devc->scale *= 0.1;
                else if (devc->mq == SR_MQ_CURRENT) /* 000.0 µA */
-                       devc->scale *= 0.0000001; /* Untested! */
+                       devc->scale *= 0.00001;
                else if (devc->mq == SR_MQ_RESISTANCE) {
                        if (devc->buflen >= 10) {
                                /* °C with 10 byte msg type, otherwise GOhm. */
@@ -480,8 +480,19 @@ static void decode_ctmv_2x(uint8_t ctmv, struct dev_context *devc)
                devc->unit = SR_UNIT_UNITLESS;
                devc->mqflags |= SR_MQFLAG_AC;
                break;
+       case 0x1f: /* 11111 Undocumented: 25S in stopwatch mode.
+                       The value is voltage, not time, so treat it such. */
+               devc->mq = SR_MQ_VOLTAGE;
+               devc->unit = SR_UNIT_VOLT;
+               devc->mqflags |= SR_MQFLAG_DC;
+               break;
+       case 0x20: /* 100000 Undocumented: 25S in event count mode.
+               Value is 0 anyway. */
+               devc->mq = SR_MQ_VOLTAGE;
+               devc->unit = SR_UNIT_UNITLESS;
+               break;
        default:
-               sr_err("decode_ctmv_2x(%d, ...): Unknown ctmv!");
+               sr_err("decode_ctmv_2x(%d, ...): Unknown ctmv!", ctmv);
                break;
        }
 }
@@ -1151,7 +1162,7 @@ SR_PRIV int gmc_mh_1x_2x_receive_data(int fd, int revents, void *cb_data)
                }
        }
 
-       /* If number of samples or time limit reached, stop aquisition. */
+       /* If number of samples or time limit reached, stop acquisition. */
        if (devc->limit_samples && (devc->num_samples >= devc->limit_samples))
                sdi->driver->dev_acquisition_stop(sdi, cb_data);
 
@@ -1202,7 +1213,7 @@ SR_PRIV int gmc_mh_2x_receive_data(int fd, int revents, void *cb_data)
                }
        }
 
-       /* If number of samples or time limit reached, stop aquisition. */
+       /* If number of samples or time limit reached, stop acquisition. */
        if (devc->limit_samples && (devc->num_samples >= devc->limit_samples))
                sdi->driver->dev_acquisition_stop(sdi, cb_data);
 
@@ -1320,11 +1331,15 @@ int req_stat14(const struct sr_dev_inst *sdi, gboolean power_on)
 
        if (power_on) {
                sr_info("Write some data and wait 3s to turn on powered off device...");
-               if ((serial_write(serial, msg, sizeof(msg)) == -1) ||
-                               (serial_write(serial, msg, sizeof(msg)) == -1) ||
-                               (serial_write(serial, msg, sizeof(msg)) == -1))
+               if (serial_write(serial, msg, sizeof(msg)) < 0)
+                       return SR_ERR;
+               g_usleep(1*1000*1000);
+               if (serial_write(serial, msg, sizeof(msg)) < 0)
+                       return SR_ERR;
+               g_usleep(1*1000*1000);
+               if (serial_write(serial, msg, sizeof(msg)) < 0)
                        return SR_ERR;
-               g_usleep(3*1000*1000);
+               g_usleep(1*1000*1000);
                serial_flush(serial);
        }
 
@@ -1517,12 +1532,12 @@ SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
                }
                devc->limit_msec = g_variant_get_uint64(data);
                sr_dbg("Setting time limit to %" PRIu64 "ms.",
-                      devc->limit_msec);
+                       devc->limit_msec);
                break;
        case SR_CONF_LIMIT_SAMPLES:
                devc->limit_samples = g_variant_get_uint64(data);
                sr_dbg("Setting sample limit to %" PRIu64 ".",
-                      devc->limit_samples);
+                       devc->limit_samples);
                break;
        default:
                return SR_ERR_NA;