From 506044f216c64187c89d9902ffa6aa0f6053b7ff Mon Sep 17 00:00:00 2001 From: fietser28 Date: Sun, 6 Jun 2021 22:17:18 +0200 Subject: [PATCH] - Fixed version check. Now properly checks major and minor version numbers. - Added a *RST command to make sure the BB3 is in a knwon and well defined state, removing possible problems due to previous user settings. --- scripts/CapReform/CapReform.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/CapReform/CapReform.py b/scripts/CapReform/CapReform.py index 97c947234..ffd7379ed 100644 --- a/scripts/CapReform/CapReform.py +++ b/scripts/CapReform/CapReform.py @@ -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') @@ -223,6 +228,7 @@ def main(): scpi("INST ch1") module_max_volt = float(scpi("VOLT? MAX")) scpi("OUTP 0") + show_main_dialog() while True: