Run the updater when parked

This commit is contained in:
FrogAi 2024-02-27 16:34:47 -07:00
parent ebc707e4f5
commit c0133812bf
6 changed files with 13 additions and 7 deletions

View File

@ -94,7 +94,7 @@ procs = [
PythonProcess("radard", "selfdrive.controls.radard", only_onroad),
PythonProcess("thermald", "selfdrive.thermald.thermald", always_run),
PythonProcess("tombstoned", "selfdrive.tombstoned", enable_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 and enable_uploading)),
PythonProcess("statsd", "selfdrive.statsd", enable_logging),

View File

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

View File

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

View File

@ -24,7 +24,7 @@ void SoftwarePanel::checkForUpdates() {
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->setStyleSheet("font-size: 50px; font-weight: 400; text-align: left; padding-top: 30px; padding-bottom: 30px;");
addItem(onroadLbl);
@ -171,9 +171,11 @@ void SoftwarePanel::updateLabels() {
return;
}
// updater only runs offroad
onroadLbl->setVisible(is_onroad);
downloadBtn->setVisible(!is_onroad);
// updater only runs offroad or when parked
bool parked = scene.parked;
onroadLbl->setVisible(is_onroad && !parked);
downloadBtn->setVisible(!is_onroad || parked);
// download update
QString updater_state = QString::fromStdString(params.get("UpdaterState"));
@ -205,7 +207,7 @@ void SoftwarePanel::updateLabels() {
versionLbl->setText(QString::fromStdString(params.get("UpdaterCurrentDescription")));
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->setDescription(QString::fromStdString(params.get("UpdaterNewReleaseNotes")));

View File

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

View File

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