]> sigrok.org Git - sigrok-meter.git/commitdiff
Acquire data from two DMMs at the same time.
authorUwe Hermann <redacted>
Fri, 19 Apr 2013 15:56:59 +0000 (17:56 +0200)
committerUwe Hermann <redacted>
Fri, 19 Apr 2013 15:56:59 +0000 (17:56 +0200)
sigrok-meter
sigrok-meter.glade

index 25b7025989023b3dd62a611bae5c34c05ef38229..caa6fdd1dea3821cee17808765aaa3cad51edc3f 100755 (executable)
@@ -35,22 +35,27 @@ def init_and_run(queue):
                 unit_str = " Ohm"
             elif unit == ll.SR_UNIT_AMPERE:
                 unit_str = " A"
-            mqflags, mqflags_str = packet.payload.unit, ""
+            mqflags, mqflags_str = packet.payload.mqflags, ""
             if mqflags & ll.SR_MQFLAG_AC:
                 mqflags_str = " AC"
             elif mqflags & ll.SR_MQFLAG_DC:
                 mqflags_str = " DC"
             for i in range(packet.payload.num_samples):
-                queue.put("%f%s%s" % (data[i], unit_str, mqflags_str))
+                dev = "%s" % device.vendor
+                val = "%f%s%s" % (data[i], unit_str, mqflags_str)
+                queue.put((dev, val))
 
     # log = Log()
     # log.level = Log.SPEW
     context = Context()
-    driver = context.drivers['voltcraft-vc820']
-    device = driver.scan()[0]
-    device.limit_samples = 1000
+    drivers_to_use = ['voltcraft-vc820', 'victor-dmm']
+    drivers = [context.drivers[d] for d in drivers_to_use]
+    devices = [d.scan()[0] for d in drivers]
+    for dev in devices:
+        dev.limit_samples = 1000
     session = Session(context)
-    session.add_device(device)
+    for dev in devices:
+        session.add_device(dev)
     session.add_callback(datafeed_in)
     session.start()
     session.run()
@@ -62,6 +67,7 @@ class SigrokMeter:
         self.builder.add_from_file("sigrok-meter.glade")
         self.builder.connect_signals(self)
         self.value_label = self.builder.get_object("value_label")
+        self.value_label2 = self.builder.get_object("value_label2")
         self.win = self.builder.get_object("mainwindow")
         self.win.show_all()
         self.queue = Queue()
@@ -70,7 +76,8 @@ class SigrokMeter:
     def update_label_if_needed(self):
         try:
             t = self.queue.get_nowait()
-            self.value_label.set_text(t)
+            l = self.value_label if t[0] != "Victor" else self.value_label2
+            l.set_text("%s: %s" % (t[0], t[1]))
         except:
             pass
         GObject.timeout_add(100, self.update_label_if_needed)
index ab3e353b18424260b963aef2ad1da3e6bcbc3e06..bbcb1a657761af93dd927880d1d452dd47cd89a5 100644 (file)
             <property name="position">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkLabel" id="value_label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="justify">center</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="value_label3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="justify">center</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
         <child>
           <placeholder/>
         </child>