Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jun 9, 2021
2 parents 183a748 + 1c59355 commit 534f003
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scripts/CapReform/CapReform.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,23 @@ def show_main_dialog():
#############################
def main():
global module_max_volt
# Save state
# Save state and set in known (default) state.
scpi("*SAV 10")
scpi("MEM:STATE:FREEZE ON")

scpi("*RST")

# From now on we always restore the state in case of an error.
try:
# Script requires firmware > 1.6, check for it.
firmwareversion = scpi("SYSTem:CPU:FIRMware?")
if float(firmwareversion) < 1.6:
fwstr = scpi("SYSTem:CPU:FIRMware?")
i = fwstr.index('.')
j = fwstr.index('.',i+1)
fwmaj = int(fwstr[0:i])
fwmin = int(fwstr[i+1:j])
if not(fwmaj > 1 or (fwmaj == 1 and fwmin >= 6)):
scpi('DISP:ERR "Script requires firmware >= 1.6"')
return

# Digital output for timing/jitter measurements
scpi('SYSTEM:DIGITAL:PIN4:FUNCTION DOUTPUT')
scpi('SYST:DIGITAL:PIN4:POLARITY POS')
Expand All @@ -223,6 +228,7 @@ def main():
scpi("INST ch1")
module_max_volt = float(scpi("VOLT? MAX"))
scpi("OUTP 0")

show_main_dialog()

while True:
Expand Down

0 comments on commit 534f003

Please sign in to comment.