示例#1
0
int main(void) {


	InitializeHardware(); //set up ports, timers, interrupts

	ConfigureADC(); //get ADC set up to start reading values

	BlinkLEDs();

	myCalibrationState = XMaxState; //change to init later?
	StartCalibration(myCalibrationState, &gPushButton);

	//InitGame(); //initialize AFTER configuration so get random number based off of time to calibrate

	//after calibration finished, need user to press button to indicate they are ready to begin game
	BlinkLEDs();

	//METHOD HERE TO WAIT FOR BUTTON PRESS TO START GAME
	//startGame(); //NEED TO PUSH BUTTON TO START


    while(1) {

    	update(); //calls all different states of game


    }

	return 0;
}
示例#2
0
//
// OnReceiveMessage
//
// Virtual method called by base class with Window messages
//
BOOL CCalibFilterProperties::OnReceiveMessage(HWND hwnd,
                                              UINT uMsg,
                                              WPARAM wParam,
                                              LPARAM lParam)
{
    switch (uMsg)
    {        
        case WM_INITDIALOG:
        {
        m_hwnd = hwnd;
        SetControls( hwnd );
        SetTimer( hwnd, 0, 50, 0 );
        return 1L;
        }

        case WM_VSCROLL:
        {
        return 1L;
        }

        case WM_COMMAND:
        if( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_START_CALIB )
        {
            StartCalibration();
        }
        if( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_SAVECALIBRATION )
        {
            SaveCameraParams();
        }
        if( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_LOADCALIBRATION )
        {
            LoadCameraParams();
        }
        else if( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_STOP )
        {
            //StopCalibration();
        }
        else if( HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == BN_CLICKED )
        {
            SetDirty();
        }
        return 1L;

        case WM_TIMER:
        {
            PrintStatus();
        }
        return 1L;

        case WM_DESTROY:
        {
            KillTimer( hwnd, 0 );
        }
        return 1L;
    }
    return CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam);

} // OnReceiveMessage
SingleWallCalibrationToolbox::SingleWallCalibrationToolbox(fCalMainWindow* aParentMainWindow, Qt::WFlags aFlags)
  : AbstractToolbox(aParentMainWindow)
  , QWidget(aParentMainWindow, aFlags)
  , m_Calibration(NULL)
  , m_Segmentation(NULL)
  , m_SpatialCalibrationData(NULL)
  , m_SpatialValidationData(NULL)
  , m_RecordingBuffer(NULL)
  , m_SingleFrameCount(18)
  , m_LastRecordedFrameTimestamp(0.0)
  , m_CancelRequest(false)
  , m_NumberOfCalibrationImagesToAcquire(200)
  , m_NumberOfValidationImagesToAcquire(100)
  , m_NumberOfSegmentedCalibrationImages(0)
  , m_NumberOfSegmentedValidationImages(0)
  , m_RecordingIntervalMs(200)
  , m_MaxTimeSpentWithProcessingMs(150)
  , m_LastProcessingTimePerFrameMs(-1)
{
  ui.setupUi(this);

  // Create algorithms
  m_Calibration = vtkSingleWallCalibrationAlgo::New();

  m_Segmentation = vtkLineSegmentationAlgo::New();

  // Create tracked frame lists
  m_SpatialCalibrationData = vtkTrackedFrameList::New();
  m_SpatialCalibrationData->SetValidationRequirements(REQUIRE_UNIQUE_TIMESTAMP | REQUIRE_TRACKING_OK); 

  m_SpatialValidationData = vtkTrackedFrameList::New();
  m_SpatialValidationData->SetValidationRequirements(REQUIRE_UNIQUE_TIMESTAMP | REQUIRE_TRACKING_OK); 

  m_RecordingBuffer = vtkTrackedFrameList::New();
  m_RecordingBuffer->SetValidationRequirements(REQUIRE_UNIQUE_TIMESTAMP | REQUIRE_TRACKING_OK); 

  // Change result display properties
  ui.label_Results->setFont(QFont("Courier", 8));

  // Connect events
  connect( ui.pushButton_StartSpatial, SIGNAL( clicked() ), this, SLOT( StartCalibration() ) );
  connect( ui.pushButton_CancelSpatial, SIGNAL( clicked() ), this, SLOT( CancelCalibration() ) );
  connect( ui.pushButton_SingleFrame, SIGNAL( clicked() ), this, SLOT( SingleFrame() ) );
}
void HIDCalibrateDialog::HIDButtonPressed(unsigned char cButtonValue,unsigned char cChangedByteValue)
{
	Q_UNUSED(cButtonValue);
	if (cChangedByteValue & 1)//Left HID Button pressed;
	{
		StartCalibration();
	}
	else if (cChangedByteValue & 2)//Right HID Button pressed;
	{
		if (!m_bCalibrationActive)
		{
			this->reject();
		}
		else
		{
			StopCalibration();
		}
	}
}
示例#5
0
HTMLEventStatus CalibrateBodycb(HBROWSER_HANDLE hbrowser, HDOC_HANDLE hdoc, HELEMENT_HANDLE helem, HTMLEvent* event,char * param)
{
    switch (event->type)
    {
    case HTML_EVENT_LOAD:
    	DemoCountdown = 0;
		SetCalibrationHandlers(hbrowser, hdoc, helem);
		StartCalibration(hbrowser, hdoc, helem);
        break;
    case HTML_EVENT_UNLOAD:
		AbortCalibration(hbrowser, hdoc, helem);
        break;
    case HTML_EVENT_TIMER:
		ContinueCalibration(hbrowser, hdoc, helem);
        break;
    default:
            break;
    }
    return (HTML_EVENT_STATUS_CONTINUE);
}
void HIDCalibrateDialog::StartButtonClicked()
{
	StartCalibration();
}