Skip to content

Commit

Permalink
add deltas
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-demin committed Oct 31, 2016
1 parent 411c1f1 commit 3205fba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
8 changes: 5 additions & 3 deletions PyQtScope.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ def transmit_command(self, command):
data += command + b'\0'*((4 - (size % 4)) % 4)
self.device.write(0x06, data, 1000)
else:
self.device.write(command)
self.device.write(b'\n')
self.device.write(command + b'\n')

def receive_result(self):
if os.name == 'nt':
Expand Down Expand Up @@ -240,7 +239,7 @@ def read_data(self):
getattr(self, 'meas%d' % (i + 1)).setText('%s %s %s%s' % (sou, typ, val, uni))
progress.setValue(4)
# read cursors
self.transmit_command(b'CURS?;:CURS:VBA:HPOS1?;:CURS:VBA:HPOS2?')
self.transmit_command(b'CURS?;:CURS:VBA:HPOS1?;:CURS:VBA:HPOS2?;:CURS:HBA:DELT?;:CURS:VBA:DELT?')
curs = self.receive_result()[:-1].decode('utf-8').rsplit(';')
self.curst.setText('%s %s' % (curs[1], self.cursors[curs[0]]))
if curs[0] == 'VBARS':
Expand All @@ -258,16 +257,19 @@ def read_data(self):
else:
self.curs3.setText('%ss' % (metric_prefix(float(curs[4]))))
self.curs4.setText('%sV' % (metric_prefix(float(curs[9]))))
self.delta.setText('dt = %ss' % (metric_prefix(float(curs[11]))))
elif curs[0] == 'HBARS':
self.curs1.setText('%sV' % metric_prefix(float(curs[6])))
self.curs2.setText('')
self.curs3.setText('%sV' % metric_prefix(float(curs[7])))
self.curs4.setText('')
self.delta.setText('dV = %sV' % (metric_prefix(float(curs[10]))))
else:
self.curs1.setText('')
self.curs2.setText('')
self.curs3.setText('')
self.curs4.setText('')
self.delta.setText('')
progress.setValue(5)
except:
print('Error: %s' % sys.exc_info()[1])
Expand Down
17 changes: 12 additions & 5 deletions PyQtScope.ui
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<height>600</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="centralLayout">
<item>
<widget class="QWidget" name="plotWidget" native="true">
<property name="sizePolicy">
Expand Down Expand Up @@ -99,11 +99,11 @@
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="measBox">
<property name="title">
<string>MEASUREMENTS</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="measLayout">
<item>
<widget class="QLabel" name="meas1">
<property name="text">
Expand Down Expand Up @@ -156,11 +156,11 @@
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="cursBox">
<property name="title">
<string>CURSORS</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="cursLayout">
<item row="2" column="0">
<widget class="QLabel" name="curs3">
<property name="text">
Expand Down Expand Up @@ -196,6 +196,13 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="delta">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 3205fba

Please sign in to comment.