mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-29 10:32:10 +08:00
qt ui: slow frame warning
old-commit-hash: e11b677e0192dec29b75471f70c3476cb22d9cb8
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "common/params.h"
|
||||
#include "common/timing.h"
|
||||
#include "common/swaglog.h"
|
||||
|
||||
#include "home.hpp"
|
||||
#include "paint.hpp"
|
||||
@@ -223,6 +225,7 @@ void GLWindow::initializeGL() {
|
||||
|
||||
wake();
|
||||
|
||||
prev_draw_t = millis_since_boot();
|
||||
timer->start(1000 / UI_FREQ);
|
||||
backlight_timer->start(BACKLIGHT_DT * 1000);
|
||||
}
|
||||
@@ -270,6 +273,14 @@ void GLWindow::resizeGL(int w, int h) {
|
||||
void GLWindow::paintGL() {
|
||||
if(GLWindow::ui_state.awake){
|
||||
ui_draw(&ui_state);
|
||||
|
||||
double cur_draw_t = millis_since_boot();
|
||||
double dt = cur_draw_t - prev_draw_t;
|
||||
if (dt > 66){
|
||||
// warn on sub 15fps
|
||||
LOGW("slow frame(%llu) time: %.2f", ui_state.sm->frame, dt);
|
||||
}
|
||||
prev_draw_t = cur_draw_t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ private:
|
||||
QtSound sound;
|
||||
|
||||
bool onroad = true;
|
||||
double prev_draw_t = 0;
|
||||
|
||||
// TODO: this shouldn't be here
|
||||
float brightness_b = 0;
|
||||
|
||||
Reference in New Issue
Block a user