mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-12 21:02:13 +08:00
Run the updater when parked
This commit is contained in:
@@ -91,7 +91,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),
|
||||
PythonProcess("statsd", "selfdrive.statsd", enable_logging),
|
||||
|
||||
|
||||
@@ -110,9 +110,11 @@ private:
|
||||
|
||||
// FrogPilot variables
|
||||
void automaticUpdate();
|
||||
void updateState();
|
||||
|
||||
ButtonControl *updateTime;
|
||||
|
||||
bool isParked;
|
||||
int schedule;
|
||||
int time;
|
||||
};
|
||||
|
||||
@@ -148,11 +148,22 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
|
||||
updateLabels();
|
||||
});
|
||||
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &SoftwarePanel::automaticUpdate);
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &SoftwarePanel::updateState);
|
||||
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
void SoftwarePanel::updateState() {
|
||||
static bool previousIsParked = isParked;
|
||||
isParked = (*uiState()->sm)["carState"].getCarState().getGearShifter() == cereal::CarState::GearShifter::PARK;
|
||||
|
||||
if (isParked != previousIsParked) {
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
automaticUpdate();
|
||||
}
|
||||
|
||||
void SoftwarePanel::showEvent(QShowEvent *event) {
|
||||
// nice for testing on PC
|
||||
installBtn->setEnabled(true);
|
||||
@@ -172,8 +183,8 @@ void SoftwarePanel::updateLabels() {
|
||||
}
|
||||
|
||||
// updater only runs offroad
|
||||
onroadLbl->setVisible(is_onroad);
|
||||
downloadBtn->setVisible(!is_onroad);
|
||||
onroadLbl->setVisible(is_onroad && !isParked);
|
||||
downloadBtn->setVisible(!is_onroad || isParked);
|
||||
|
||||
// download update
|
||||
QString updater_state = QString::fromStdString(params.get("UpdaterState"));
|
||||
@@ -205,7 +216,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 || isParked) && params.getBool("UpdateAvailable"));
|
||||
installBtn->setValue(QString::fromStdString(params.get("UpdaterNewDescription")));
|
||||
installBtn->setDescription(QString::fromStdString(params.get("UpdaterNewReleaseNotes")));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user