poll modelV2 in UI

pull/24602/head
Shane Smiskol 3 years ago
parent 572c4a10fa
commit 82aac96a1f
  1. 15
      selfdrive/ui/qt/onroad.cc
  2. 1
      selfdrive/ui/qt/widgets/cameraview.cc
  3. 8
      selfdrive/ui/ui.cc

@ -41,24 +41,19 @@ OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent) {
}
void OnroadWindow::updateState(const UIState &s) {
QColor bgColor = bg_colors[s.status];
bg = bg_colors[s.status];
Alert alert = Alert::get(*(s.sm), s.scene.started_frame);
if (s.sm->updated("controlsState") || !alert.equal({})) {
if (alert.type == "controlsUnresponsive") {
bgColor = bg_colors[STATUS_ALERT];
bg = bg_colors[STATUS_ALERT];
} else if (alert.type == "controlsUnresponsivePermanent") {
bgColor = bg_colors[STATUS_DISENGAGED];
bg = bg_colors[STATUS_DISENGAGED];
}
alerts->updateAlert(alert, bgColor);
alerts->updateAlert(alert, bg);
}
nvg->updateState(s);
if (bg != bgColor) {
// repaint border
bg = bgColor;
update();
}
nvg->update();
}
void OnroadWindow::mousePressEvent(QMouseEvent* e) {

@ -265,7 +265,6 @@ void CameraViewWidget::vipcConnected(VisionIpcClient *vipc_client) {
void CameraViewWidget::vipcFrameReceived(VisionBuf *buf) {
latest_frame = buf;
update();
}
void CameraViewWidget::vipcThread() {

@ -118,7 +118,7 @@ static void update_model(UIState *s, const cereal::ModelDataV2::Reader &model) {
}
static void update_sockets(UIState *s) {
s->sm->update(0);
s->sm->update(1000 / UI_FREQ);
}
static void update_state(UIState *s) {
@ -230,11 +230,11 @@ void UIState::updateStatus() {
}
UIState::UIState(QObject *parent) : QObject(parent) {
sm = std::make_unique<SubMaster, const std::initializer_list<const char *>>({
sm = std::make_unique<SubMaster, const std::initializer_list<const char *>, const std::initializer_list<const char *>>({
"modelV2", "controlsState", "liveCalibration", "radarState", "deviceState", "roadCameraState",
"pandaStates", "carParams", "driverMonitoringState", "sensorEvents", "carState", "liveLocationKalman",
"wideRoadCameraState", "managerState",
});
}, {"modelV2"});
Params params;
wide_camera = Hardware::TICI() ? params.getBool("EnableWideCamera") : false;
@ -243,7 +243,7 @@ UIState::UIState(QObject *parent) : QObject(parent) {
// update timer
timer = new QTimer(this);
QObject::connect(timer, &QTimer::timeout, this, &UIState::update);
timer->start(1000 / UI_FREQ);
timer->start(0);
}
void UIState::update() {

Loading…
Cancel
Save