From e29204d23a63be8948c922835d63bfb48ff79711 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Fri, 12 Jan 2024 22:39:30 -0700 Subject: [PATCH] Error log button --- selfdrive/ui/qt/offroad/settings.h | 1 + selfdrive/ui/qt/offroad/software_settings.cc | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/selfdrive/ui/qt/offroad/settings.h b/selfdrive/ui/qt/offroad/settings.h index 3b4dca0..0a028a2 100644 --- a/selfdrive/ui/qt/offroad/settings.h +++ b/selfdrive/ui/qt/offroad/settings.h @@ -97,6 +97,7 @@ private: QLabel *onroadLbl; LabelControl *versionLbl; + ButtonControl *errorLogBtn; ButtonControl *installBtn; ButtonControl *downloadBtn; ButtonControl *targetBranchBtn; diff --git a/selfdrive/ui/qt/offroad/software_settings.cc b/selfdrive/ui/qt/offroad/software_settings.cc index e635ea8..bfe1803 100644 --- a/selfdrive/ui/qt/offroad/software_settings.cc +++ b/selfdrive/ui/qt/offroad/software_settings.cc @@ -8,6 +8,7 @@ #include #include +#include #include "common/params.h" #include "common/util.h" @@ -120,6 +121,14 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { }); addItem(uninstallBtn); + // error log button + errorLogBtn = new ButtonControl(tr("Error Log"), tr("VIEW"), "View the error log for debugging purposes when openpilot crashes."); + connect(errorLogBtn, &ButtonControl::clicked, [=]() { + std::string txt = util::read_file("/data/community/crashes/error.txt"); + ConfirmationDialog::rich(QString::fromStdString(txt), this); + }); + addItem(errorLogBtn); + fs_watch = new ParamWatcher(this); QObject::connect(fs_watch, &ParamWatcher::paramChanged, [=](const QString ¶m_name, const QString ¶m_value) { schedule = params.getInt("UpdateSchedule");