//checkin: 05/24/99 0012 File STD.CCDsafe.useq  ID: 0xd73 Version:  3 Checked in. 
//checkin: 03/01/99 1157 File STD.CCDsafe.useq  ID: 0xd72 Version:  2 Checked in. 
//checkin: 11/08/98 2005 File STD.CCDsafe.useq  ID: 0xd71 Version:  1 Checked in. 
//checkin: 03/07/98 1236 File STD.CCDsafe.useq  ID: 0xd70 Version:  0 Checked in. 
//checkin: 03/06/98 1657 File STD.CCDsafe.useq  ID: 0xd70 Version:  0 Checked in. Doc update
//name          STD.CCDsafe
//description:  checks for CCD safety 
//revision:     3 - R. Shine
//status:       draft; checked by: (initials and date) 
//date:         19990523
//keywords:     6: CCD
//ID:           000.000.000.000
//Type:         scene
//Target:
//Termination:  upon completion
//Telemetry:    none

// 5/23/99 -    revised to wait 15m when we get a hit, bump down by 6 for
//              the next try, the old code returned immediately with 99
//              we now return with 0 always. It is likely that this will
//              be modified again when/if we think of a better way.

$type:scene;                      
// revised to not use $g8 and $g9 11/4/98 R. Shine
$L1 = 42;       //three times the max. number of allowed "overexposures"
if( $MNV > 2000 || $MXV > 3500 ) {
  $g7 = $g7+3;
  // if ($g7 > $L1) return(99);
  if ($g7 > $L1) {  wait(15m);  $G7 = $G7 - 6;  return(0); }
 } else {
  if (($g7--) < 1) $g7=0; return(0);
 }
return(0);              // superfluous return to keep parser happy