esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

#%TITLE% Maxe-Reference-Marc.mac
#$Revision:  $
#%NAME% Macros to set zero point on a Maxe axis.
#%DESCRIPTION%
# Run  a Maxe axis over the reference marc to define a new zero.


#%UU% motor-mne
#%MDESC% Run  a Maxe axis over the reference marc to define a new zero.
def MaxeReferenceMarc '{
    local mnum, sig_rec, old_A, device, axis, address
     _check0 "$1"

    mnum    =   "$1"
    axis    =   motor_par(mnum, "channel")
    address =   motor_par(mnum, "device_id")

    # send mono to negative limit
    #  chg_dial(mono, "lim-")
    waitmove ; get_angles

    # enable index search

    esrf_io(address, "DevEnableRIndex", axis)

    # move mono after index position

    A[mnum] += 1
    move_em
    _update(mnum)
    waitmove; get_angles

    # check if only one index received
    sig_rec = 0
    sig_rec =  esrf_io(address, "DevSignalReceived", axis)
    if (sig_rec == 0) {
        print "No index reached"
    } else if (sig_rec == -1) {
        print "Device Server error"
    } else if (sig_rec != 1) {
        print "Ooops, more than one index reached:", sig_rec
    }

    # disable index search
    esrf_io(address, "DevDisableRIndex", axis)

    p  old_A = dial(mnum, A[mnum])

#    set mnum old_A+7.89920       
#    set_dial mnum old_A+7.89920  

}
'