From 387d5b88a0c6990b6a6097be5e0bed48ae6e26d0 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Wed, 2 Jun 2021 02:03:37 +0200 Subject: [PATCH] show 'failed to fetch update' when UpdateFailedCount is updated (#21096) * show 'failed to fetch update' when UpdateFailedCount is updated * update text old-commit-hash: 867f7d39fd6d8179d924cbc11ae60f1f628293e9 --- selfdrive/ui/qt/offroad/settings.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 7d71646d98..f6bdf865a3 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -209,7 +209,12 @@ DeveloperPanel::DeveloperPanel(QWidget* parent) : QFrame(parent) { fs_watch = new QFileSystemWatcher(this); QObject::connect(fs_watch, &QFileSystemWatcher::fileChanged, [=](const QString path) { - updateLabels(); + int update_failed_count = Params().get("UpdateFailedCount").value_or(0); + if (path.contains("UpdateFailedCount") && update_failed_count > 0) { + lastUpdateTimeLbl->setText("failed to fetch update"); + } else if (path.contains("LastUpdateTime")) { + updateLabels(); + } }); } @@ -246,6 +251,7 @@ void DeveloperPanel::updateLabels() { Params params = Params(); if (params.getBool("IsOffroad")) { fs_watch->addPath(QString::fromStdString(params.getParamsPath()) + "/d/LastUpdateTime"); + fs_watch->addPath(QString::fromStdString(params.getParamsPath()) + "/d/UpdateFailedCount"); lastUpdateTimeLbl->setText("checking..."); std::system("pkill -1 -f selfdrive.updated"); }