bring this back

old-commit-hash: 714e02d0bd
chrysler-long2
Adeeb Shihadeh 3 years ago
parent c4b78042dd
commit ba78f80850
  1. 1
      selfdrive/ui/.gitignore
  2. 3
      selfdrive/ui/SConscript
  3. 50
      selfdrive/ui/mui.cc

@ -4,6 +4,7 @@ moc_*
translations/main_test_en.* translations/main_test_en.*
ui ui
mui
watch3 watch3
installer/installers/* installer/installers/*
qt/text qt/text

@ -92,6 +92,9 @@ if GetOption('extras') and arch != "Darwin":
# build updater UI # build updater UI
qt_env.Program("qt/setup/updater", ["qt/setup/updater.cc", asset_obj], LIBS=qt_libs) qt_env.Program("qt/setup/updater", ["qt/setup/updater.cc", asset_obj], LIBS=qt_libs)
# build mui
qt_env.Program("mui", ["mui.cc"], LIBS=qt_libs)
# build installers # build installers
senv = qt_env.Clone() senv = qt_env.Clone()
senv['LINKFLAGS'].append('-Wl,-strip-debug') senv['LINKFLAGS'].append('-Wl,-strip-debug')

@ -0,0 +1,50 @@
#include <QApplication>
#include <QtWidgets>
#include <QTimer>
#include "cereal/messaging/messaging.h"
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/qt_window.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QWidget w;
setMainWindow(&w);
w.setStyleSheet("background-color: black;");
// our beautiful UI
QVBoxLayout *layout = new QVBoxLayout(&w);
QLabel *label = new QLabel("");
layout->addWidget(label, 0, Qt::AlignCenter);
QTimer timer;
QObject::connect(&timer, &QTimer::timeout, [=]() {
static SubMaster sm({"deviceState", "controlsState"});
bool onroad_prev = sm.allAliveAndValid({"deviceState"}) &&
sm["deviceState"].getDeviceState().getStarted();
sm.update(0);
bool onroad = sm.allAliveAndValid({"deviceState"}) &&
sm["deviceState"].getDeviceState().getStarted();
if (onroad) {
label->setText("");
auto cs = sm["controlsState"].getControlsState();
UIStatus status = cs.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;
label->setStyleSheet(QString("color: %1; font-size: 250px;").arg(bg_colors[status].name()));
} else {
label->setText("offroad");
label->setStyleSheet("color: grey; font-size: 40px;");
}
if ((onroad != onroad_prev) || sm.frame < 2) {
Hardware::set_brightness(50);
Hardware::set_display_power(onroad);
}
});
timer.start(50);
return a.exec();
}
Loading…
Cancel
Save