Run the updater when parked

This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent 6d1cf97da4
commit 3a38bed701
6 changed files with 14 additions and 8 deletions

View File

@@ -91,7 +91,7 @@ procs = [
PythonProcess("radard", "selfdrive.controls.radard", only_onroad), PythonProcess("radard", "selfdrive.controls.radard", only_onroad),
PythonProcess("thermald", "selfdrive.thermald.thermald", always_run), PythonProcess("thermald", "selfdrive.thermald.thermald", always_run),
PythonProcess("tombstoned", "selfdrive.tombstoned", allow_logging, enabled=not PC), PythonProcess("tombstoned", "selfdrive.tombstoned", allow_logging, enabled=not PC),
PythonProcess("updated", "selfdrive.updated", only_offroad, enabled=not PC), PythonProcess("updated", "selfdrive.updated", always_run, enabled=not PC),
PythonProcess("uploader", "system.loggerd.uploader", allow_uploads), PythonProcess("uploader", "system.loggerd.uploader", allow_uploads),
PythonProcess("statsd", "selfdrive.statsd", allow_logging), PythonProcess("statsd", "selfdrive.statsd", allow_logging),

View File

@@ -22,7 +22,6 @@
#include "selfdrive/ui/qt/widgets/scrollview.h" #include "selfdrive/ui/qt/widgets/scrollview.h"
#include "selfdrive/ui/qt/widgets/ssh_keys.h" #include "selfdrive/ui/qt/widgets/ssh_keys.h"
#include "selfdrive/ui/qt/widgets/toggle.h" #include "selfdrive/ui/qt/widgets/toggle.h"
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/qt_window.h"

View File

@@ -13,6 +13,7 @@
#include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/widgets/controls.h" #include "selfdrive/ui/qt/widgets/controls.h"
#include "selfdrive/ui/ui.h"
// ********** settings window + top-level panels ********** // ********** settings window + top-level panels **********
class SettingsWindow : public QFrame { class SettingsWindow : public QFrame {
@@ -114,6 +115,8 @@ private:
// FrogPilot variables // FrogPilot variables
void automaticUpdate(); void automaticUpdate();
UIScene &scene;
ButtonControl *updateTime; ButtonControl *updateTime;
int schedule; int schedule;

View File

@@ -24,8 +24,8 @@ void SoftwarePanel::checkForUpdates() {
std::system("pkill -SIGUSR1 -f selfdrive.updated"); std::system("pkill -SIGUSR1 -f selfdrive.updated");
} }
SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent), scene(uiState()->scene) {
onroadLbl = new QLabel(tr("Updates are only downloaded while the car is off.")); onroadLbl = new QLabel(tr("Updates are only downloaded while the car is off or in park."));
onroadLbl->setStyleSheet("font-size: 50px; font-weight: 400; text-align: left; padding-top: 30px; padding-bottom: 30px;"); onroadLbl->setStyleSheet("font-size: 50px; font-weight: 400; text-align: left; padding-top: 30px; padding-bottom: 30px;");
addItem(onroadLbl); addItem(onroadLbl);
@@ -171,9 +171,11 @@ void SoftwarePanel::updateLabels() {
return; return;
} }
// updater only runs offroad // updater only runs offroad or when parked
onroadLbl->setVisible(is_onroad); bool parked = scene.parked;
downloadBtn->setVisible(!is_onroad);
onroadLbl->setVisible(is_onroad && !parked);
downloadBtn->setVisible(!is_onroad || parked);
// download update // download update
QString updater_state = QString::fromStdString(params.get("UpdaterState")); QString updater_state = QString::fromStdString(params.get("UpdaterState"));
@@ -205,7 +207,7 @@ void SoftwarePanel::updateLabels() {
versionLbl->setText(QString::fromStdString(params.get("UpdaterCurrentDescription"))); versionLbl->setText(QString::fromStdString(params.get("UpdaterCurrentDescription")));
versionLbl->setDescription(QString::fromStdString(params.get("UpdaterCurrentReleaseNotes"))); versionLbl->setDescription(QString::fromStdString(params.get("UpdaterCurrentReleaseNotes")));
installBtn->setVisible(!is_onroad && params.getBool("UpdateAvailable")); installBtn->setVisible((!is_onroad || parked) && params.getBool("UpdateAvailable"));
installBtn->setValue(QString::fromStdString(params.get("UpdaterNewDescription"))); installBtn->setValue(QString::fromStdString(params.get("UpdaterNewDescription")));
installBtn->setDescription(QString::fromStdString(params.get("UpdaterNewReleaseNotes"))); installBtn->setDescription(QString::fromStdString(params.get("UpdaterNewReleaseNotes")));

View File

@@ -240,6 +240,7 @@ static void update_state(UIState *s) {
if (scene.rotating_wheel) { if (scene.rotating_wheel) {
scene.steering_angle_deg = carState.getSteeringAngleDeg(); scene.steering_angle_deg = carState.getSteeringAngleDeg();
} }
scene.parked = carState.getGearShifter() == cereal::CarState::GearShifter::PARK;
} }
if (sm.updated("controlsState")) { if (sm.updated("controlsState")) {
auto controlsState = sm["controlsState"].getControlsState(); auto controlsState = sm["controlsState"].getControlsState();

View File

@@ -201,6 +201,7 @@ typedef struct UIScene {
bool map_open; bool map_open;
bool model_ui; bool model_ui;
bool numerical_temp; bool numerical_temp;
bool parked;
bool pedals_on_ui; bool pedals_on_ui;
bool reverse_cruise; bool reverse_cruise;
bool reverse_cruise_ui; bool reverse_cruise_ui;