FrogPilot features - Allow updates when parked

This commit is contained in:
FrogAi
2024-05-09 22:38:39 -07:00
parent dea30f95d8
commit 16bf20ff13
4 changed files with 13 additions and 6 deletions
+10 -5
View File
@@ -21,7 +21,7 @@ void SoftwarePanel::checkForUpdates() {
}
SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
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;");
addItem(onroadLbl);
@@ -108,6 +108,9 @@ void SoftwarePanel::showEvent(QShowEvent *event) {
}
void SoftwarePanel::updateLabels() {
UIState *s = uiState();
UIScene &scene = s->scene;
// add these back in case the files got removed
fs_watch->addParam("LastUpdateTime");
fs_watch->addParam("UpdateFailedCount");
@@ -118,9 +121,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"));
@@ -152,7 +157,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")));
+1
View File
@@ -207,6 +207,7 @@ static void update_state(UIState *s) {
}
if (sm.updated("carState")) {
auto carState = sm["carState"].getCarState();
scene.parked = carState.getGearShifter() == cereal::CarState::GearShifter::PARK;
}
if (sm.updated("controlsState")) {
auto controlsState = sm["controlsState"].getControlsState();
+1
View File
@@ -119,6 +119,7 @@ typedef struct UIScene {
bool experimental_mode;
bool map_open;
bool online;
bool parked;
bool right_hand_drive;
int alert_size;
+1 -1
View File
@@ -80,7 +80,7 @@ procs = [
PythonProcess("radard", "selfdrive.controls.radard", only_onroad),
PythonProcess("hardwared", "system.hardware.hardwared", always_run),
PythonProcess("tombstoned", "system.tombstoned", always_run, enabled=not PC),
PythonProcess("updated", "system.updated.updated", only_offroad, enabled=not PC),
PythonProcess("updated", "system.updated.updated", always_run, enabled=not PC),
PythonProcess("uploader", "system.loggerd.uploader", always_run),
PythonProcess("statsd", "system.statsd", always_run),