mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-23 16:32:04 +08:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 62254e411b | |||
| 40df537d7a | |||
| 2d60a61d5e | |||
| 7afc72942c | |||
| 23ec81d67a | |||
| 9500489695 | |||
| 29d39ffe71 | |||
| 726b3774b6 | |||
| 3f9502ca6b | |||
| 3a9d27b610 | |||
| b9b7e8b556 | |||
| b1315797c5 | |||
| 158eaf4dda | |||
| 59afe4df1a | |||
| 33e06a86f9 | |||
| 84e3a6d0ed | |||
| 25fa50b42c | |||
| 1a67ce35ff | |||
| ad131fef49 | |||
| be0e64ab45 | |||
| 767880ffaf | |||
| 77ea048865 | |||
| 2c5753940b |
@@ -0,0 +1 @@
|
||||
#define DEFAULT_MODEL "Notre Dame (Default)"
|
||||
+1
-2
@@ -206,8 +206,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"CarParamsSP", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"CarParamsSPCache", CLEAR_ON_MANAGER_START},
|
||||
{"CarParamsSPPersistent", PERSISTENT},
|
||||
{"CarPlatform", PERSISTENT},
|
||||
{"CarPlatformName", PERSISTENT},
|
||||
{"CarPlatformBundle", PERSISTENT},
|
||||
{"EnableGithubRunner", PERSISTENT | BACKUP},
|
||||
{"ModelRunnerTypeCache", CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"OffroadMode", CLEAR_ON_MANAGER_START},
|
||||
|
||||
+1
-1
Submodule opendbc_repo updated: d015d911c5...cd086f3e5e
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
@@ -104,7 +105,7 @@ class Car:
|
||||
with car.CarParams.from_bytes(cached_params_raw) as _cached_params:
|
||||
cached_params = _cached_params
|
||||
|
||||
fixed_fingerprint = self.params.get("CarPlatform")
|
||||
fixed_fingerprint = json.loads(self.params.get("CarPlatformBundle", encoding='utf-8') or "{}").get("platform", None)
|
||||
|
||||
self.CI = get_car(*self.can_callbacks, obd_callback(self.params), experimental_long_allowed, num_pandas, cached_params, fixed_fingerprint)
|
||||
interfaces.setup_car_interface_sp(self.CI.CP, self.CI.CP_SP, self.params)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <algorithm>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include "common/model.h"
|
||||
|
||||
/**
|
||||
* @brief Constructs the software panel with model bundle selection functionality
|
||||
* @param parent Parent widget
|
||||
@@ -105,7 +107,7 @@ QString SoftwarePanelSP::GetActiveModelName() {
|
||||
return QString::fromStdString(model_manager.getActiveBundle().getDisplayName());
|
||||
}
|
||||
|
||||
return "";
|
||||
return DEFAULT_MODEL;
|
||||
}
|
||||
|
||||
void SoftwarePanelSP::updateModelManagerState() {
|
||||
|
||||
@@ -7,14 +7,27 @@
|
||||
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle/platform_selector.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QMap>
|
||||
|
||||
#include "selfdrive/ui/sunnypilot/qt/util.h"
|
||||
|
||||
QVariant PlatformSelector::getPlatformBundle(const QString &key) {
|
||||
QString platform_bundle = QString::fromStdString(params.get("CarPlatformBundle"));
|
||||
if (!platform_bundle.isEmpty()) {
|
||||
QJsonDocument json = QJsonDocument::fromJson(platform_bundle.toUtf8());
|
||||
if (!json.isNull() && json.isObject()) {
|
||||
return json.object().value(key).toVariant();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
PlatformSelector::PlatformSelector() : ButtonControl(tr("Vehicle"), "", "") {
|
||||
platforms = loadPlatformList();
|
||||
|
||||
QObject::connect(this, &ButtonControl::clicked, [=]() {
|
||||
if (text() == tr("SEARCH")) {
|
||||
QString query = InputDialog::getText(tr("Search your vehicle"), this, tr("Enter model year (e.g., 2021) and model name (Toyota Corolla):"), false);
|
||||
@@ -25,8 +38,7 @@ PlatformSelector::PlatformSelector() : ButtonControl(tr("Vehicle"), "", "") {
|
||||
refresh(offroad);
|
||||
}
|
||||
} else {
|
||||
params.remove("CarPlatform");
|
||||
params.remove("CarPlatformName");
|
||||
params.remove("CarPlatformBundle");
|
||||
refresh(offroad);
|
||||
}
|
||||
});
|
||||
@@ -35,57 +47,45 @@ PlatformSelector::PlatformSelector() : ButtonControl(tr("Vehicle"), "", "") {
|
||||
}
|
||||
|
||||
void PlatformSelector::refresh(bool _offroad) {
|
||||
QString platform_param = QString::fromStdString(params.get("CarPlatform"));
|
||||
if (platform_param.length()) {
|
||||
setValue(QString::fromStdString(params.get("CarPlatformName")));
|
||||
setText("REMOVE");
|
||||
} else {
|
||||
setValue("");
|
||||
setText("SEARCH");
|
||||
}
|
||||
QString name = getPlatformBundle("name").toString();
|
||||
setValue(name);
|
||||
setText(name.isEmpty() ? tr("SEARCH") : tr("REMOVE"));
|
||||
setEnabled(true);
|
||||
|
||||
offroad = _offroad;
|
||||
}
|
||||
|
||||
QMap<QString, QVariantMap> PlatformSelector::loadPlatformList() {
|
||||
QMap<QString, QVariantMap> platforms;
|
||||
void PlatformSelector::setPlatform(const QString &platform) {
|
||||
QVariantMap platform_data = platforms[platform];
|
||||
|
||||
std::string json_data = util::read_file("../../sunnypilot/selfdrive/car/car_list.json").c_str();
|
||||
const QString offroad_msg = offroad ? tr("This setting will take effect immediately.") :
|
||||
tr("This setting will take effect once the device enters offroad state.");
|
||||
const QString msg = QString("<b>%1</b><br><br>%2")
|
||||
.arg(platform, offroad_msg);
|
||||
|
||||
if (json_data.empty()) {
|
||||
return platforms;
|
||||
}
|
||||
QString content("<body><h2 style=\"text-align: center;\">" + tr("Vehicle Selector") + "</h2><br>"
|
||||
"<p style=\"text-align: center; margin: 0 128px; font-size: 50px;\">" + msg + "</p></body>");
|
||||
|
||||
QJsonParseError json_error;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QString::fromStdString(json_data).toUtf8(), &json_error);
|
||||
if (doc.isNull()) {
|
||||
return platforms;
|
||||
}
|
||||
if (ConfirmationDialog(content, tr("Confirm"), tr("Cancel"), true, this).exec()) {
|
||||
QJsonObject json_bundle;
|
||||
json_bundle["platform"] = platform_data["platform"].toString();
|
||||
json_bundle["name"] = platform;
|
||||
json_bundle["make"] = platform_data["make"].toString();
|
||||
json_bundle["brand"] = platform_data["brand"].toString();
|
||||
json_bundle["model"] = platform_data["model"].toString();
|
||||
json_bundle["package"] = platform_data["package"].toString();
|
||||
|
||||
if (doc.isObject()) {
|
||||
QJsonObject obj = doc.object();
|
||||
for (const QString &key : obj.keys()) {
|
||||
QJsonObject attributes = obj.value(key).toObject();
|
||||
QVariantMap platform_data;
|
||||
|
||||
QJsonArray yearArray = attributes.value("year").toArray();
|
||||
QVariantList yearList;
|
||||
for (const QJsonValue &year : yearArray) {
|
||||
yearList.append(year.toString());
|
||||
}
|
||||
|
||||
platform_data["year"] = yearList;
|
||||
platform_data["make"] = attributes.value("make").toString();
|
||||
platform_data["model"] = attributes.value("model").toString();
|
||||
platform_data["platform"] = attributes.value("platform").toString();
|
||||
platform_data["package"] = attributes.value("package").toString();
|
||||
|
||||
platforms[key] = platform_data;
|
||||
QVariantList yearList = platform_data["year"].toList();
|
||||
QJsonArray yearArray;
|
||||
for (const QVariant &year : yearList) {
|
||||
yearArray.append(year.toString());
|
||||
}
|
||||
}
|
||||
json_bundle["year"] = yearArray;
|
||||
|
||||
return platforms;
|
||||
QString json_bundle_str = QString::fromUtf8(QJsonDocument(json_bundle).toJson(QJsonDocument::Compact));
|
||||
|
||||
params.put("CarPlatformBundle", json_bundle_str.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
void PlatformSelector::searchPlatforms(const QString &query) {
|
||||
@@ -93,7 +93,6 @@ void PlatformSelector::searchPlatforms(const QString &query) {
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<QString, QVariantMap> platforms = loadPlatformList();
|
||||
QSet<QString> matched_cars;
|
||||
|
||||
QString normalized_query = query.simplified().toLower();
|
||||
@@ -183,20 +182,6 @@ void PlatformSelector::searchPlatforms(const QString &query) {
|
||||
QString selected_platform = MultiOptionDialog::getSelection(tr("Select a vehicle"), results, "", this);
|
||||
|
||||
if (!selected_platform.isEmpty()) {
|
||||
QVariantMap platform_data = platforms[selected_platform];
|
||||
|
||||
const QString offroad_msg = offroad ? tr("This setting will take effect immediately.") :
|
||||
tr("This setting will take effect once the device enters offroad state.");
|
||||
const QString msg = QString("<b>%1</b><br><br>%2")
|
||||
.arg(selected_platform)
|
||||
.arg(offroad_msg);
|
||||
|
||||
QString content("<body><h2 style=\"text-align: center;\">" + tr("Vehicle Selector") + "</h2><br>"
|
||||
"<p style=\"text-align: center; margin: 0 128px; font-size: 50px;\">" + msg + "</p></body>");
|
||||
|
||||
if (ConfirmationDialog(content, tr("Confirm"), tr("Cancel"), true, this).exec()) {
|
||||
params.put("CarPlatform", platform_data["platform"].toString().toStdString());
|
||||
params.put("CarPlatformName", selected_platform.toStdString());
|
||||
}
|
||||
setPlatform(selected_platform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,15 @@ class PlatformSelector : public ButtonControl {
|
||||
|
||||
public:
|
||||
PlatformSelector();
|
||||
QVariant getPlatformBundle(const QString &key);
|
||||
|
||||
public slots:
|
||||
void refresh(bool _offroad);
|
||||
|
||||
private:
|
||||
void searchPlatforms(const QString &query);
|
||||
QMap<QString, QVariantMap> loadPlatformList();
|
||||
void setPlatform(const QString &platform = "");
|
||||
QMap<QString, QVariantMap> platforms;
|
||||
|
||||
Params params;
|
||||
bool offroad;
|
||||
|
||||
@@ -23,8 +23,18 @@ VehiclePanel::VehiclePanel(QWidget *parent) : QFrame(parent) {
|
||||
ScrollViewSP *scroller = new ScrollViewSP(list, this);
|
||||
vlayout->addWidget(scroller);
|
||||
|
||||
QObject::connect(uiState(), &UIState::offroadTransition, platformSelector, &PlatformSelector::refresh);
|
||||
QObject::connect(uiState(), &UIState::offroadTransition, this, &VehiclePanel::updatePanel);
|
||||
|
||||
main_layout->addWidget(vehicleScreen);
|
||||
main_layout->setCurrentWidget(vehicleScreen);
|
||||
}
|
||||
|
||||
void VehiclePanel::showEvent(QShowEvent *event) {
|
||||
updatePanel(offroad);
|
||||
}
|
||||
|
||||
void VehiclePanel::updatePanel(bool _offroad) {
|
||||
platformSelector->refresh(_offroad);
|
||||
|
||||
offroad = _offroad;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,14 @@ class VehiclePanel : public QFrame {
|
||||
|
||||
public:
|
||||
explicit VehiclePanel(QWidget *parent = nullptr);
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
public slots:
|
||||
void updatePanel(bool _offroad);
|
||||
|
||||
private:
|
||||
QStackedLayout* main_layout = nullptr;
|
||||
QWidget* vehicleScreen = nullptr;
|
||||
PlatformSelector *platformSelector = nullptr;
|
||||
bool offroad;
|
||||
};
|
||||
|
||||
@@ -12,8 +12,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include <QDir>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QLayoutItem>
|
||||
#include <QPainterPath>
|
||||
#include <QVariant>
|
||||
|
||||
#include "system/hardware/hw.h"
|
||||
|
||||
@@ -33,3 +37,44 @@ QString getUserAgent(bool sunnylink) {
|
||||
std::optional<QString> getSunnylinkDongleId() {
|
||||
return getParamIgnoringDefault("SunnylinkDongleId", "UnregisteredDevice");
|
||||
}
|
||||
|
||||
QMap<QString, QVariantMap> loadPlatformList() {
|
||||
QMap<QString, QVariantMap> _platforms;
|
||||
|
||||
std::string json_data = util::read_file("../../sunnypilot/selfdrive/car/car_list.json");
|
||||
|
||||
if (json_data.empty()) {
|
||||
return _platforms;
|
||||
}
|
||||
|
||||
QJsonParseError json_error{};
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QString::fromStdString(json_data).toUtf8(), &json_error);
|
||||
if (doc.isNull()) {
|
||||
return _platforms;
|
||||
}
|
||||
|
||||
if (doc.isObject()) {
|
||||
QJsonObject obj = doc.object();
|
||||
for (const QString &key : obj.keys()) {
|
||||
QJsonObject attributes = obj.value(key).toObject();
|
||||
QVariantMap platform_data;
|
||||
|
||||
QJsonArray yearArray = attributes.value("year").toArray();
|
||||
QVariantList yearList;
|
||||
for (const QJsonValue &year : yearArray) {
|
||||
yearList.append(year.toString());
|
||||
}
|
||||
|
||||
platform_data["year"] = yearList;
|
||||
platform_data["make"] = attributes.value("make").toString();
|
||||
platform_data["brand"] = attributes.value("brand").toString();
|
||||
platform_data["model"] = attributes.value("model").toString();
|
||||
platform_data["platform"] = attributes.value("platform").toString();
|
||||
platform_data["package"] = attributes.value("package").toString();
|
||||
|
||||
_platforms[key] = platform_data;
|
||||
}
|
||||
}
|
||||
|
||||
return _platforms;
|
||||
}
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include <QMap>
|
||||
#include <QPainter>
|
||||
#include <QWidget>
|
||||
|
||||
QString getUserAgent(bool sunnylink = false);
|
||||
std::optional<QString> getSunnylinkDongleId();
|
||||
std::optional<QString> getParamIgnoringDefault(const std::string ¶m_name, const std::string &default_value);
|
||||
QMap<QString, QVariantMap> loadPlatformList();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections import namedtuple
|
||||
import capnp
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
import sys
|
||||
@@ -220,8 +221,12 @@ def setup_settings_trips(click, pm: PubMaster, scroll=None):
|
||||
time.sleep(UI_DELAY)
|
||||
|
||||
def setup_settings_vehicle(click, pm: PubMaster, scroll=None):
|
||||
Params().put("CarPlatform", "HONDA_CIVIC_2022")
|
||||
Params().put("CarPlatformName", "Honda Civic 2022-24")
|
||||
Params().put("CarPlatformBundle", json.dumps(
|
||||
{
|
||||
"platform": "HONDA_CIVIC_2022",
|
||||
"name": "Honda Civic 2022-24"
|
||||
}
|
||||
))
|
||||
|
||||
setup_settings_device(click, pm)
|
||||
scroll(-400, 278, 862)
|
||||
|
||||
@@ -716,10 +716,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">موافق</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">تأكيد</translation>
|
||||
@@ -728,6 +724,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">إلغاء</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">إزالة</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -711,10 +711,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">Bestätigen</translation>
|
||||
@@ -723,6 +719,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Abbrechen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">LÖSCHEN</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -712,10 +712,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">Confirmar</translation>
|
||||
@@ -724,6 +720,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">ELIMINAR</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -712,10 +712,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">Confirmer</translation>
|
||||
@@ -724,6 +720,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Annuler</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">SUPPRIMER</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -711,10 +711,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">確認</translation>
|
||||
@@ -723,6 +719,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">キャンセル</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">削除</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -711,10 +711,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">확인</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">확인</translation>
|
||||
@@ -723,6 +719,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">취소</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">삭제</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -712,10 +712,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">Confirmar</translation>
|
||||
@@ -724,6 +720,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">Cancelar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">REMOVER</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -711,10 +711,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">ตกลง</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">ยืนยัน</translation>
|
||||
@@ -723,6 +719,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">ยกเลิก</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">ลบ</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -710,10 +710,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">Tamam</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">Onayla</translation>
|
||||
@@ -722,6 +718,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">KALDIR</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -711,10 +711,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">好的</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">确认</translation>
|
||||
@@ -723,6 +719,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">删除</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -711,10 +711,6 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>This setting will take effect immediately.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="obsolete">確定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
<translation type="unfinished">確認</translation>
|
||||
@@ -723,6 +719,10 @@ Pause Steering: ALC will be paused after the brake pedal is manually pressed.</s
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished">取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>REMOVE</source>
|
||||
<translation type="unfinished">移除</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PrimeAdWidget</name>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
39786068cae1ed8c0dc34ef80c281dfcc67ed18a50e06b90765c49bcfdbf7db4
|
||||
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
import hashlib
|
||||
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
|
||||
MODEL_HASH_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
class TestDefaultModel:
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
cls.onnx_path = os.path.join(BASEDIR, "selfdrive", "modeld", "models", "supercombo.onnx")
|
||||
cls.current_hash_path = os.path.join(MODEL_HASH_DIR, "model_hash")
|
||||
|
||||
@staticmethod
|
||||
def get_hash(path: str) -> str:
|
||||
sha256_hash = hashlib.sha256()
|
||||
with open(path, "rb") as f:
|
||||
for byte_block in iter(lambda: f.read(4096), b""):
|
||||
sha256_hash.update(byte_block)
|
||||
return sha256_hash.hexdigest()
|
||||
|
||||
def test_compare_onnx_hashes(self):
|
||||
new_hash = self.get_hash(str(self.onnx_path))
|
||||
|
||||
with open(self.current_hash_path) as f:
|
||||
current_hash = f.read().strip()
|
||||
|
||||
assert new_hash == current_hash, (
|
||||
"Driving model updated!\n" +
|
||||
f"Current hash: {current_hash}\n" +
|
||||
f"New hash: {new_hash}\n" +
|
||||
"Please update common/model.h if the default driving model name has changed."
|
||||
)
|
||||
Reference in New Issue
Block a user