;+
; Project     :	SOHO - CDS
;
; Name        :	MACRO_WAIT
;
; Purpose     : Outputs command to macro to wait for given no. of milliseconds.
;
; Explanation :	MACRO delay counter wraps around after 5 minutes so need to break up longer
;               delays.
;
; Use         : <macro_wait,delay>
;
; Inputs      : delay : delay required in millseconds
;
; Opt. Inputs : None.
;
; Outputs     : Writes to array using fileout.
;
; Opt. Outputs:	None.
;
; Keywords    : None.
;
; Calls       :	fileout.
;                
; Common      :	None.
;
; Restrictions:	None.
;
; Side effects:	None.
;
; Category    :	Command preparation.
;
; Prev. Hist. :	None.
;
; Written     :	Version 0.0, Martin Carter, RAL, 16/1/96
;
; Modified    :	None.
;
; Version     :	Version 0.0, 16/1/96
;-
;**********************************************************

PRO macro_wait, input_delay

  ; get local copy

  delay = LONG(input_delay/10) ; convert to 10 ms units

  ; loop until delay over in 5 minute units

  WHILE delay GT 0 DO BEGIN

    IF delay LE 30000 THEN BEGIN

      fileout, words=2, 'CB5WAIT ' + shorthex ( delay ) + $
             '  # tell macro to wait : ' + STRTRIM ( delay*10, 1 ) + ' msecs'

      delay = 0

    ENDIF ELSE BEGIN

      fileout, words=2, 'CB5WAIT ' + shorthex ( 30000 ) + $
             '  # tell macro to wait : 300 secs'

      delay = delay - 30000

    ENDELSE

  ENDWHILE

END
