Ejemplo n.º 1
0
void CMainDlg::Status( char *lpszStatusString ) 
{
	WTL::CEdit status ;
	status.Attach( GetDlgItem( IDC_EDIT_STATUS ) ) ;
	status.SetReadOnly( FALSE ) ;
	status.SetSelAll( ) ;
	status.Clear( ) ;
	status.SetReadOnly( ) ;
	status.AppendText( lpszStatusString ) ;
	status.Detach( ) ;
}
Ejemplo n.º 2
0
void CMainDlg::StatusResult( unsigned __int64 u64Accum , DWORD dwCycles )
{
	WTL::CEdit res ;
	res.Attach( GetDlgItem( IDC_EDIT_RESULT ) ) ;
	res.SetReadOnly( FALSE ) ;
	res.SetSelAll( ) ;
	res.Clear( ) ;
	res.SetReadOnly( ) ;
	if ( dwCycles == 0 ){
		res.AppendText( "##.##" ) ;
	}else{
		float fRes = ( float )u64Accum / ( float )dwCycles ;
		char szRes[ 256 ] ;
		*szRes = NULL ;
		sprintf( szRes , "%.6f" , fRes / ( float )( ( 1 << 24 ) - 1 ) ) ;
		res.AppendText( szRes ) ;
	}
	res.Detach( ) ;
}
Ejemplo n.º 3
0
void CMainDlg::UpdateControls( ) 
{
	WTL::CButton btnConnect,btnDisconnect,btnStart ;
	WTL::CButton	btnVoltPosSet , btnVoltPosGet ;
	WTL::CButton	btnVoltNegSet , btnVoltNegGet ;
	WTL::CButton	btnTableTimeout ;
	WTL::CButton	btnTableZero , btnTableStop ;
	WTL::CButton	btnTableSpeedX , btnTableSpeedY ;
	WTL::CButton	btnTableStepX , btnTableStepY ;

	WTL::CButton	btnTableSpeedXGet , btnTableSpeedYGet ;
	WTL::CButton	btnTableStepXGet , btnTableStepYGet ;

	WTL::CButton	btnTableEchoStepX , btnTableEchoStepY ;

	WTL::CButton	btnMirrorZero ;
	WTL::CButton	btnMirrorPos1 , btnMirrorPos2 ;
	WTL::CButton	btnMirrorPos1Set , btnMirrorPos2Set ;
	WTL::CButton	btnMirrorPos1Get , btnMirrorPos2Get ;

	WTL::CEdit	editCount ;
	WTL::CEdit	editVoltPos , editVoltNeg ;
	WTL::CEdit	editTableTimeout ; 
	WTL::CEdit	editTableSpeedX , editTableSpeedY ;
	WTL::CEdit	editTableStepX	, editTableStepY ;
	WTL::CEdit	editTableEchoStepX	, editTableEchoStepY ;
	
	WTL::CEdit	editMirrorPos1 , editMirrorPos2 ;


	btnConnect.Attach( GetDlgItem( IDC_BUTTON_CONNECT ) ) ;
	btnDisconnect.Attach( GetDlgItem( IDC_BUTTON_DISCONNECT ) ) ;
	btnStart.Attach( GetDlgItem( IDC_BUTTON_START ) ) ;
	editCount.Attach( GetDlgItem( IDC_EDIT_COUNT ) ) ;

	btnVoltPosSet.Attach( GetDlgItem( IDC_BUTTON_VOLT_POS_SET ) ) ;  
	btnVoltPosGet.Attach( GetDlgItem( IDC_BUTTON_VOLT_POS_GET ) ) ;
	btnVoltNegSet.Attach( GetDlgItem( IDC_BUTTON_VOLT_NEG_SET ) ) ;  
	btnVoltNegGet.Attach( GetDlgItem( IDC_BUTTON_VOLT_NEG_GET ) ) ;
	editVoltPos.Attach( GetDlgItem( IDC_EDIT_VOLT_POS ) ) ; 
	editVoltNeg.Attach( GetDlgItem( IDC_EDIT_VOLT_NEG ) ) ;

	editTableTimeout.Attach( GetDlgItem( IDC_EDIT_TIMEOUT ) ) ; 
	editTableSpeedX.Attach( GetDlgItem( IDC_EDIT_TABLE_SPEED_X ) ) ;
	editTableSpeedY.Attach( GetDlgItem( IDC_EDIT_TABLE_SPEED_Y ) )  ;
	editTableStepX.Attach( GetDlgItem( IDC_EDIT_TABLE_STEP_X ) ) 	;
	editTableStepY.Attach( GetDlgItem( IDC_EDIT_TABLE_STEP_Y ) )  ;

	btnTableTimeout.Attach( GetDlgItem( IDC_BUTTON_TIMEOUT ) ) ;
	btnTableZero.Attach( GetDlgItem( IDC_BUTTON_TABLE_ZERO ) ) ; 
	btnTableStop.Attach( GetDlgItem( IDC_BUTTON_TABLE_STOP ) ) ;
	btnTableSpeedX.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_X ) ) ; 
	btnTableSpeedY.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_Y ) ) ;
	btnTableStepX.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_X ) ) ;
	btnTableStepY.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_Y ) ) ;
	btnTableSpeedXGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_X_GET ) ) ; 
	btnTableSpeedYGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_Y_GET ) ) ;
	btnTableStepXGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_X_GET ) ) ;
	btnTableStepYGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_Y_GET ) ) ;

	btnTableEchoStepX.Attach( GetDlgItem( IDC_BUTTON_TABLE_ECHO_STEP_X ) ) ;
	btnTableEchoStepY.Attach( GetDlgItem( IDC_BUTTON_TABLE_ECHO_STEP_Y ) ) ;
	editTableEchoStepX.Attach( GetDlgItem( IDC_EDIT_TABLE_ECHO_STEP_X ) )	; 
	editTableEchoStepY.Attach( GetDlgItem( IDC_EDIT_TABLE_ECHO_STEP_Y ) )  ;

	editMirrorPos1.Attach( GetDlgItem( IDC_EDIT_MIRROR_POS1 ) ) ;
	editMirrorPos2.Attach( GetDlgItem( IDC_EDIT_MIRROR_POS2 ) ) ;

	btnMirrorZero.Attach( GetDlgItem( IDC_BUTTON_MIRROR_ZERO ) ) ;
	btnMirrorPos1.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS1 ) ) ; 
	btnMirrorPos2.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS2 ) ) ;
	btnMirrorPos1Set.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS1_SET ) ) ; 
	btnMirrorPos2Set.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS2_SET ) ) ;
	btnMirrorPos1Get.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS1_GET ) ) ; 
	btnMirrorPos2Get.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS2_GET ) ) ;

	switch( m_status ){
	case NOT_CONNECTED:
		btnConnect.EnableWindow( TRUE ) ;
		btnDisconnect.EnableWindow( FALSE ) ;
		btnStart.EnableWindow( FALSE ) ;
		
		btnVoltPosSet.EnableWindow( FALSE ) ;  
		btnVoltPosGet.EnableWindow( FALSE ) ;
		btnVoltNegSet.EnableWindow( FALSE ) ;  
		btnVoltNegGet.EnableWindow( FALSE ) ;

		btnTableTimeout.EnableWindow( FALSE ) ;
		btnTableZero.EnableWindow( FALSE ) ; 
		btnTableStop.EnableWindow( FALSE ) ;
		btnTableSpeedX.EnableWindow( FALSE ) ; 
		btnTableSpeedY.EnableWindow( FALSE ) ;
		btnTableStepX.EnableWindow( FALSE ) ;
		btnTableStepY.EnableWindow( FALSE ) ;
		btnTableSpeedXGet.EnableWindow( FALSE ) ; 
		btnTableSpeedYGet.EnableWindow( FALSE ) ;
		btnTableStepXGet.EnableWindow( FALSE ) ;
		btnTableStepYGet.EnableWindow( FALSE ) ;

		btnMirrorZero.EnableWindow( FALSE ) ;
		btnMirrorPos1.EnableWindow( FALSE ) ; 
		btnMirrorPos2.EnableWindow( FALSE ) ;
		btnMirrorPos1Set.EnableWindow( FALSE ) ; 
		btnMirrorPos2Set.EnableWindow( FALSE ) ;
		btnMirrorPos1Get.EnableWindow( FALSE ) ; 
		btnMirrorPos2Get.EnableWindow( FALSE ) ;

		btnTableEchoStepX.EnableWindow( FALSE ) ;
		btnTableEchoStepY.EnableWindow( FALSE ) ;
		editTableEchoStepX.EnableWindow( FALSE ) ; 
		editTableEchoStepY.EnableWindow( FALSE )  ;
		
		editVoltPos.SetReadOnly( ) ; 
		editVoltNeg.SetReadOnly( ) ;

		editTableTimeout.SetReadOnly( ) ; 
		editTableSpeedX.SetReadOnly( ) ;
		editTableSpeedY.SetReadOnly( ) ;
		editTableStepX.SetReadOnly( ) ;
		editTableStepY.SetReadOnly( ) ;
		
		editCount.SetReadOnly( ) ;

		editMirrorPos1.SetReadOnly( ) ;
		editMirrorPos2.SetReadOnly( ) ;

		break ;
	case CONNECTED:
		btnConnect.EnableWindow( FALSE ) ;
		btnDisconnect.EnableWindow( TRUE ) ;
		btnStart.EnableWindow( TRUE ) ;

		btnVoltPosSet.EnableWindow( TRUE ) ;  
		btnVoltPosGet.EnableWindow( TRUE ) ;
		btnVoltNegSet.EnableWindow( TRUE ) ;  
		btnVoltNegGet.EnableWindow( TRUE ) ;

		btnTableTimeout.EnableWindow( TRUE ) ;
		btnTableZero.EnableWindow( TRUE ) ; 
		btnTableStop.EnableWindow( TRUE ) ;
		btnTableSpeedX.EnableWindow( TRUE ) ; 
		btnTableSpeedY.EnableWindow( TRUE ) ;
		btnTableStepX.EnableWindow( TRUE ) ;
		btnTableStepY.EnableWindow( TRUE ) ;
		btnTableSpeedXGet.EnableWindow( TRUE ) ; 
		btnTableSpeedYGet.EnableWindow( TRUE ) ;
		btnTableStepXGet.EnableWindow( TRUE ) ;
		btnTableStepYGet.EnableWindow( TRUE ) ;
		btnTableEchoStepX.EnableWindow( TRUE ) ;
		btnTableEchoStepY.EnableWindow( TRUE ) ;
		editTableEchoStepX.EnableWindow( TRUE ) ; 
		editTableEchoStepY.EnableWindow( TRUE )  ;

		btnMirrorZero.EnableWindow( TRUE ) ;
		btnMirrorPos1.EnableWindow( TRUE ) ; 
		btnMirrorPos2.EnableWindow( TRUE ) ;
		btnMirrorPos1Set.EnableWindow( TRUE ) ; 
		btnMirrorPos2Set.EnableWindow( TRUE ) ;
		btnMirrorPos1Get.EnableWindow( TRUE ) ; 
		btnMirrorPos2Get.EnableWindow( TRUE ) ;
		
		editVoltPos.SetReadOnly( FALSE ) ; 
		editVoltNeg.SetReadOnly( FALSE ) ;

		editTableTimeout.SetReadOnly( FALSE ) ; 
		editTableSpeedX.SetReadOnly( FALSE ) ;
		editTableSpeedY.SetReadOnly( FALSE ) ;
		editTableStepX.SetReadOnly( FALSE ) ;
		editTableStepY.SetReadOnly( FALSE ) ;

		editCount.SetReadOnly( FALSE ) ;

		editMirrorPos1.SetReadOnly( FALSE ) ;
		editMirrorPos2.SetReadOnly( FALSE ) ;

		break ;
	case PROCESSING:
		btnConnect.EnableWindow( FALSE ) ;
		btnDisconnect.EnableWindow( FALSE ) ;
		btnStart.EnableWindow( FALSE ) ;
		editCount.SetReadOnly( ) ;
		
		break ;
	}

	btnConnect.Detach(  ) ;
	btnDisconnect.Detach(  ) ;
	btnStart.Detach(  ) ;
	editCount.Detach( ) ;

	btnVoltPosSet.Detach( ) ;  
	btnVoltPosGet.Detach( ) ;
	btnVoltNegSet.Detach( ) ;  
	btnVoltNegGet.Detach( ) ;

	editVoltPos.Detach( ) ; 
	editVoltNeg.Detach( ) ;

	editTableTimeout.Detach( ) ; 
	editTableSpeedX.Detach( ) ;
	editTableSpeedY.Detach( ) ;
	editTableStepX.Detach( ) ;
	editTableStepY.Detach( ) ;

	btnTableTimeout.Detach( ) ;
	btnTableZero.Detach( ) ; 
	btnTableStop.Detach( ) ;
	btnTableSpeedX.Detach( ) ; 
	btnTableSpeedY.Detach( ) ;
	btnTableStepX.Detach( ) ;
	btnTableStepY.Detach( ) ;

	btnTableSpeedXGet.Detach( ) ; 
	btnTableSpeedYGet.Detach( ) ;
	btnTableStepXGet.Detach( ) ;
	btnTableStepYGet.Detach( ) ;

	btnTableEchoStepX.Detach( ) ;
	btnTableEchoStepY.Detach( ) ;
	editTableEchoStepX.Detach( ) ; 
	editTableEchoStepY.Detach( )  ;

	editMirrorPos1.Detach( ) ;
	editMirrorPos2.Detach( ) ;
	btnMirrorZero.Detach( ) ;
	btnMirrorPos1.Detach( ) ; 
	btnMirrorPos2.Detach( ) ;
	btnMirrorPos1Set.Detach( ) ; 
	btnMirrorPos2Set.Detach( ) ;
	btnMirrorPos1Get.Detach( ) ; 
	btnMirrorPos2Get.Detach( ) ;
}