| 520 | } |
| 521 | |
| 522 | void ActiveStereoFrame::UpdateFps(wxUpdateUIEvent &event) |
| 523 | { |
| 524 | wxDateTime now = wxDateTime::UNow(); |
| 525 | |
| 526 | wxTimeSpan timeDiff = now.Subtract(timeOfLastFpsUpdate); |
| 527 | |
| 528 | if (timeDiff.GetMilliseconds() > 100) |
| 529 | { |
| 530 | // compute a new FPS |
| 531 | double timeDiffNum = timeDiff.GetMilliseconds().ToDouble() / 1000.0; |
| 532 | |
| 533 | double fps = framesSinceLastFpsUpdate / timeDiffNum; |
| 534 | |
| 535 | framesSinceLastFpsUpdate = 0; |
| 536 | |
| 537 | timeOfLastFpsUpdate = now; |
| 538 | |
| 539 | wxString fpsString = wxString::Format(wxT("%4.1f"), fps); |
| 540 | |
| 541 | lblFPS->SetLabel(fpsString); |
| 542 | |
| 543 | // disable things if the fps is too low |
| 544 | if (fps < 0.5) |
| 545 | { |
| 546 | cameraConnected = false; |
| 547 | lblCameraConnected->SetLabel(wxT("Disconnected")); |
| 548 | |
| 549 | // reset layouts now that the length of the label in lblCameraConnected has changed |
| 550 | flexGridStatus->Layout(); |
| 551 | staticBoxSizerStatus->Layout(); |
| 552 | headBoxSizer->Layout(); |
| 553 | |
| 554 | butCapture->Enable(false); |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | } |
nothing calls this directly
no outgoing calls
no test coverage detected