static Boolean if_trigger_InitBoardConnection( void ); static Boolean if_trigger_StopBoardConnection( void ); static void if_trigger_AltAzGoto(char *azstr, char *altstr); static void if_trigger_AltAzOrigin(char *azstr, char *altstr); static char * if_trigger_GetCurrentAzKoor( void ); static char * if_trigger_GetCurrentAltKoor( void ); static void if_trigger_GoLeft_Fast( void ); static void if_trigger_GoUp_Fast( void ); static void if_trigger_GoDown_Fast( void ); static void if_trigger_GoRight_Fast( void ); static void if_trigger_GoLeft_Slow( void ); static void if_trigger_GoUp_Slow( void ); static void if_trigger_GoDown_Slow( void ); static void if_trigger_GoRight_Slow( void ); static void if_trigger_StopAll( void ); static void if_trigger_GuideInitialisation( void ); static void if_trigger_Guide( void ); /****************************************** High Level convert interface between palm and serial connection to CPU-Board *******************************************/ static Boolean if_trigger_InitBoardConnection( void ) { guiderunning = 0; scope.motorrun = 0; if(initBoardConnection() == false ) { FrmAlert(alertID_connectionerror); return(false); } return(true); } static Boolean if_trigger_StopBoardConnection( void ) { guiderunning = 0; if(closeBoardConnection() == false ) { FrmAlert(alertID_connectionerror); return(false); } scope.motorrun = 0; return(true); } static void if_trigger_StopAll( void ) { guiderunning = 0; if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); } else { scope.motorrun = 0; } } static char * if_trigger_GetCurrentAzKoor( void ) { double d; guiderunning = 0; if( (d = serialOperationGetAzKoor()) == -1){ FrmAlert(alertID_connectionerror); return("0"); } return(DoubleToStrDegrees( d, false )); } static char * if_trigger_GetCurrentAltKoor( void ) { double d; guiderunning = 0; if( (d = serialOperationGetAltKoor()) == -1){ FrmAlert(alertID_connectionerror); return("0"); } return(DoubleToStrDegrees( d, false )); } static void if_trigger_GoLeft_Fast( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_goto, scope.az_gotospeed, 1, -1, 0, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_GoUp_Fast( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_goto, -1, 0, scope.alt_gotospeed, 0, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_GoDown_Fast( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_goto, -1, 0, scope.alt_gotospeed, 1, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_GoRight_Fast( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_goto, scope.az_gotospeed, 0, -1, 0, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_GoLeft_Slow( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_correction, scope.az_correctionspeed, 1, -1, 0, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_GoUp_Slow( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_correction, -1, 0, scope.alt_correctionspeed, 0, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_GoDown_Slow( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_correction, -1, 0, scope.alt_correctionspeed, 1, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_GoRight_Slow( void ) { guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationCorrectionMode( scope.timerintct_correction, scope.az_correctionspeed, 0, -1, 0, -1, 0) == false ){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 1; } static void if_trigger_AltAzGoto(char *azstr, char *altstr) { double az; double alt; int res; guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if( (az = StrDegreesToDouble( azstr, 0 )) < 0 ){ FrmAlert(alertID_variableerror); return; } if( (alt = StrDegreesToDouble( altstr, 0 )) < 0 ){ FrmAlert(alertID_variableerror); return; } res = serialOperationGoto( az, alt ); if( res == 1 ){ FrmAlert(alertID_connectionerror); return; } if( res == 2 ){ FrmAlert(alertID_kooroutofrangeerror); return; } scope.motorrun = 1; } static void if_trigger_AltAzOrigin(char *azstr, char *altstr) { double az; double alt; guiderunning = 0; if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if( (az = StrDegreesToDouble( azstr, 0 )) < 0 ){ FrmAlert(alertID_variableerror); return; } if( (alt = StrDegreesToDouble( altstr, 0 )) < 0 ){ FrmAlert(alertID_variableerror); return; } if( serialOperationResetKoors( az, alt ) == false ){ FrmAlert(alertID_connectionerror); } } static void if_trigger_GuideInitialisation( void ) { if( guiderunning) { return; } if(scope.motorrun){ if(serialOperationStopMotors() == false){ FrmAlert(alertID_connectionerror); return; } scope.motorrun = 0; } if(serialOperationStartGuideing() == false){ FrmAlert(alertID_connectionerror); return; } guiderunning = 1; } static void if_trigger_Guide( void ) { if(! guiderunning) { return; } if(serialOperationGuide() == false){ guiderunning = 0; FrmAlert(alertID_connectionerror); return; } }