! EncZoomResetCal.scr ! Reset calibration values and update cal file ! ----------------------------------------------------------------------------------------------- loadsub "EncZoomGlob.scr" loadsub "EncZoomSdoGlob.scr" ! ----------------------------------------------------------------------------------------------- gosub GET_QUIET_FLAG ! Sets var quietFlag% ! ----------------------------------------------------------------------------------------------- gosub CLR_STATUS_MSG_ALL gosub SET_SCRIPT_STATUS_FAIL ! ----------------------------------------------------------------------------------------------- if quietFlag% = 0 then msg$ = "" msg$ = msg$ & " Reset Cal Values \n\n" msg$ = msg$ & " This will reset the following values to zero \n" msg$ = msg$ & " and update the cal file: \n\n" msg$ = msg$ & " Lower Prog Limit \n" msg$ = msg$ & " Upper Prog Limit \n" msg$ = msg$ & " 1X Pos \n" msg$ = msg$ & " Lower Wand Limit \n" msg$ = msg$ & " Upper Wand Limit \n" msg$ = msg$ & " Backlash Comp \n\n" msg$ = msg$ & " Do you want to continue? " msgtype% = 6 gosub SHOW_DIALOG ! Uses vars msg$ and msgtype%, sets var ok% if ok% = 0 then stop endif endif ! ----------------------------------------------------------------------------------------------- msg$ = "Reset Cal Values" gosub SET_STATUS_MSG_1 gosub LOG_DATE_TIME_MSG ! ----------------------------------------------------------------------------------------------- ! Get existing values from controls gosub GET_LOWER_PROG_LIMIT ! Gets control value into var LowerProgLimit gosub GET_UPPER_PROG_LIMIT ! Gets control value into var UpperProgLimit gosub GET_1X_POS ! Gets control value into var OneXPos gosub GET_LOWER_WAND_LIMIT ! Gets control value into var LowerWandLimit gosub GET_UPPER_WAND_LIMIT ! Gets control value into var UpperWandLimit gosub GET_BACKLASH_COMP ! Gets control value into var BacklashComp ! ----------------------------------------------------------------------------------------------- msg$ = "Previous cal values:" gosub LOG_MSG ofmtr("%.0f") msg$ = "LowerProgLimit = " & val$(LowerProgLimit) gosub LOG_MSG msg$ = "UpperProgLimit = " & val$(UpperProgLimit) gosub LOG_MSG msg$ = "1X Pos = " & val$(OneXPos) gosub LOG_MSG msg$ = "LowerWandLimit = " & val$(LowerWandLimit) gosub LOG_MSG msg$ = "UpperWandLimit = " & val$(UpperWandLimit) gosub LOG_MSG msg$ = "BacklashComp = " & val$(BacklashComp) gosub LOG_MSG ! ----------------------------------------------------------------------------------------------- LowerProgLimit = 0 UpperProgLimit = 0 OneXPos = 0 LowerWandLimit = 0 UpperWandLimit = 0 BacklashComp = 0 ! ----------------------------------------------------------------------------------------------- ! Set custom controls gosub SET_LOWER_PROG_LIMIT ! Sets control using var LowerProgLimit gosub SET_UPPER_PROG_LIMIT ! Sets control using var UpperProgLimit gosub SET_1X_POS ! Sets control using var OneXPos gosub SET_LOWER_WAND_LIMIT ! Sets control using var LowerWandLimit gosub SET_UPPER_WAND_LIMIT ! Sets control using var UpperWandLimit gosub SET_BACKLASH_COMP ! Sets control using var BacklashComp ! ----------------------------------------------------------------------------------------------- ! Set internal cal info gosub SET_CONFIG_CALINFO gosub SET_PROG_LIMITS_CALINFO ! Uses vars LowerProgLimit, UpperProgLimit gosub SET_WAND_LIMITS_CALINFO ! Uses vars LowerWandLimit, UpperWandLimit gosub SET_BACKLASH_COMP_CALINFO ! Uses var BacklashComp gosub SET_STD_MAGS_CALINFO ! ----------------------------------------------------------------------------------------------- ! Update the cal file writecalfile("") ! ----------------------------------------------------------------------------------------------- ! Set firmware backlash compensation gosub SDO_SET_BACKLASH_COMP ! Uses var BacklashComp ! ----------------------------------------------------------------------------------------------- ! If there is no magnification cal file, create a fake one fn$ = ZoomCalDataDir$ & "\\" & ZoomCalDataFn$ gosub DOES_FILE_EXIST ! Uses var fn$, sets var fileExists% if fileExists% = 0 then assign @fp to fn$ "w" line$ = "UNCALIBRATED" output @fp; line$ line$ = "15000 1" output @fp; line$ line$ = "50000 5" output @fp; line$ assign @fp to "" endif ! ----------------------------------------------------------------------------------------------- msg$ = "Reset cal values and updated the cal file" gosub SET_STATUS_MSG_2 gosub LOG_DATE_TIME_MSG ! ----------------------------------------------------------------------------------------------- if quietFlag% = 0 then msg$ = " Reset cal values and updated the cal file " gosub SHOW_MESSAGE_DIALOG endif ! ----------------------------------------------------------------------------------------------- gosub SET_SCRIPT_STATUS_PASS ! ----------------------------------------------------------------------------------------------- end ! ----------------------------------------------------------------------------------------------- loadsub "EncZoomSubs.scr" loadsub "EncZoomSdoSubs.scr" ! -----------------------------------------------------------------------------------------------