record front lock (#20400)

* record front lock

* only if set

* add to internal installer

* move that

* change that bck

Co-authored-by: Comma Device <device@comma.ai>
albatross
Adeeb Shihadeh 2021-03-18 20:15:51 -07:00 committed by GitHub
parent c9275f262d
commit b60cd8d0a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 10 deletions

View File

@ -55,6 +55,7 @@ keys = {
b"PandaDongleId": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
b"Passive": [TxType.PERSISTENT],
b"RecordFront": [TxType.PERSISTENT],
b"RecordFrontLock": [TxType.PERSISTENT], # for the internal fleet
b"ReleaseNotes": [TxType.PERSISTENT],
b"ShouldDoUpdate": [TxType.CLEAR_ON_MANAGER_START],
b"SubscriberInfo": [TxType.PERSISTENT],

View File

@ -45,6 +45,9 @@ def manager_init(spinner=None):
("IsDriverViewEnabled", "0"),
]
if params.get("RecordFrontLock", encoding='utf-8') == "1":
params.put("RecordFront", "1")
# set unset params
for k, v in default_params:
if params.get(k) is None:

View File

@ -59,6 +59,8 @@ else:
for name, branch in installers:
d = {'BRANCH': f"'\"{branch}\"'"}
if "internal" in name:
d['INTERNAL'] = "1"
import requests
r = requests.get("https://github.com/commaci2.keys")
r.raise_for_status()

View File

@ -64,7 +64,7 @@ ParamsToggle::ParamsToggle(QString param, QString title, QString description, QS
layout->addWidget(label);
// toggle switch
Toggle *toggle = new Toggle(this);
toggle = new Toggle(this);
toggle->setFixedSize(150, 100);
layout->addWidget(toggle);
QObject::connect(toggle, SIGNAL(stateChanged(int)), this, SLOT(checkboxClicked(int)));
@ -104,12 +104,6 @@ QWidget * toggles_panel() {
"../assets/offroad/icon_warning.png"
));
toggles_list->addWidget(horizontal_line());
toggles_list->addWidget(new ParamsToggle("RecordFront",
"Record and Upload Driver Camera",
"Upload data from the driver facing camera and help improve the driver monitoring algorithm.",
"../assets/offroad/icon_network.png"
));
toggles_list->addWidget(horizontal_line());
toggles_list->addWidget(new ParamsToggle("IsRHD",
"Enable Right-Hand Drive",
"Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat.",
@ -128,6 +122,16 @@ QWidget * toggles_panel() {
"../assets/offroad/icon_shell.png"
));
ParamsToggle *record_toggle = new ParamsToggle("RecordFront",
"Record and Upload Driver Camera",
"Upload data from the driver facing camera and help improve the driver monitoring algorithm.",
"../assets/offroad/icon_network.png");
toggles_list->addWidget(horizontal_line());
toggles_list->addWidget(record_toggle);
bool record_lock = Params().read_db_bool("RecordFrontLock");
record_toggle->toggle->setEnabled(!record_lock);
QWidget *widget = new QWidget;
widget->setLayout(toggles_list);
return widget;

View File

@ -7,6 +7,8 @@
#include <QButtonGroup>
#include <QStackedLayout>
#include "selfdrive/ui/qt/widgets/toggle.hpp"
// *** settings widgets ***
class ParamsToggle : public QFrame {
@ -15,6 +17,7 @@ class ParamsToggle : public QFrame {
public:
explicit ParamsToggle(QString param, QString title, QString description,
QString icon, QWidget *parent = 0);
Toggle *toggle;
private:
QString param;

View File

@ -37,14 +37,19 @@ int fresh_clone() {
err = std::system("mv /data/tmppilot /data/openpilot");
if (err) return 1;
#ifdef SSH_KEYS
#ifdef INTERNAL
err = std::system("mkdir -p /data/params/d/");
if (err) return 1;
std::ofstream param;
param.open("/data/params/d/GithubSshKeys");
param << SSH_KEYS;
param.open("/data/params/d/RecordFrontLock");
param << "1";
param.close();
std::ofstream keys_param;
keys_param.open("/data/params/d/GithubSshKeys");
keys_param << SSH_KEYS;
keys_param.close();
#endif
return 0;