Skip to content

Commit

Permalink
record front lock (commaai#20400)
Browse files Browse the repository at this point in the history
* record front lock

* only if set

* add to internal installer

* move that

* change that bck

Co-authored-by: Comma Device <[email protected]>
  • Loading branch information
adeebshihadeh and Comma Device authored Mar 19, 2021
1 parent c9275f2 commit b60cd8d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions common/params_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
3 changes: 3 additions & 0 deletions selfdrive/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions selfdrive/ui/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 11 additions & 7 deletions selfdrive/ui/qt/offroad/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -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.",
Expand All @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions selfdrive/ui/qt/offroad/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <QButtonGroup>
#include <QStackedLayout>

#include "selfdrive/ui/qt/widgets/toggle.hpp"

// *** settings widgets ***

class ParamsToggle : public QFrame {
Expand All @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions selfdrive/ui/qt/setup/installer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b60cd8d

Please sign in to comment.