Skip to content

Commit 1c59355

Browse files
authored
Merge pull request #205 from fietser28/master
CapReform fixes
2 parents db418a2 + 506044f commit 1c59355

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts/CapReform/CapReform.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,23 @@ def show_main_dialog():
193193
#############################
194194
def main():
195195
global module_max_volt
196-
# Save state
196+
# Save state and set in known (default) state.
197197
scpi("*SAV 10")
198198
scpi("MEM:STATE:FREEZE ON")
199-
199+
scpi("*RST")
200+
200201
# From now on we always restore the state in case of an error.
201202
try:
202203
# Script requires firmware > 1.6, check for it.
203-
firmwareversion = scpi("SYSTem:CPU:FIRMware?")
204-
if float(firmwareversion) < 1.6:
204+
fwstr = scpi("SYSTem:CPU:FIRMware?")
205+
i = fwstr.index('.')
206+
j = fwstr.index('.',i+1)
207+
fwmaj = int(fwstr[0:i])
208+
fwmin = int(fwstr[i+1:j])
209+
if not(fwmaj > 1 or (fwmaj == 1 and fwmin >= 6)):
205210
scpi('DISP:ERR "Script requires firmware >= 1.6"')
206211
return
207-
212+
208213
# Digital output for timing/jitter measurements
209214
scpi('SYSTEM:DIGITAL:PIN4:FUNCTION DOUTPUT')
210215
scpi('SYST:DIGITAL:PIN4:POLARITY POS')
@@ -223,6 +228,7 @@ def main():
223228
scpi("INST ch1")
224229
module_max_volt = float(scpi("VOLT? MAX"))
225230
scpi("OUTP 0")
231+
226232
show_main_dialog()
227233

228234
while True:

0 commit comments

Comments
 (0)