Skip to content

Commit 21c3489

Browse files
Revert "store mic audio with toggle (commaai#35595)"
This reverts commit dcd56ae.
1 parent dcd56ae commit 21c3489

File tree

15 files changed

+35
-166
lines changed

15 files changed

+35
-166
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ By default, openpilot uploads the driving data to our servers. You can also acce
103103
openpilot is open source software: the user is free to disable data collection if they wish to do so.
104104

105105
openpilot logs the road-facing cameras, CAN, GPS, IMU, magnetometer, thermal sensors, crashes, and operating system logs.
106-
The driver-facing camera and microphone are only logged if you explicitly opt-in in settings.
106+
The driver-facing camera is only logged if you explicitly opt-in in settings. The microphone is not recorded.
107107

108108
By using openpilot, you agree to [our Privacy Policy](https://comma.ai/privacy). You understand that use of this software or its related services will generate certain types of user data, which may be logged and stored at the sole discretion of comma. By accepting this agreement, you grant an irrevocable, perpetual, worldwide right to comma for the use of this data.
109109
</details>

cereal/log.capnp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,7 @@ struct DebugAlert {
24702470
struct UserFlag {
24712471
}
24722472

2473-
struct SoundPressure @0xdc24138990726023 {
2473+
struct Microphone {
24742474
soundPressure @0 :Float32;
24752475

24762476
# uncalibrated, A-weighted
@@ -2480,11 +2480,6 @@ struct SoundPressure @0xdc24138990726023 {
24802480
filteredSoundPressureWeightedDbDEPRECATED @2 :Float32;
24812481
}
24822482

2483-
struct AudioData {
2484-
data @0 :Data;
2485-
sampleRate @1 :UInt32;
2486-
}
2487-
24882483
struct Touch {
24892484
sec @0 :Int64;
24902485
usec @1 :Int64;
@@ -2562,8 +2557,7 @@ struct Event {
25622557
livestreamDriverEncodeIdx @119 :EncodeIndex;
25632558

25642559
# microphone data
2565-
soundPressure @103 :SoundPressure;
2566-
rawAudioData @147 :AudioData;
2560+
microphone @103 :Microphone;
25672561

25682562
# systems stuff
25692563
androidLog @20 :AndroidLogEntry;

cereal/services.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ def __init__(self, should_log: bool, frequency: float, decimation: Optional[int]
7373
"navThumbnail": (True, 0.),
7474
"qRoadEncodeIdx": (False, 20.),
7575
"userFlag": (True, 0., 1),
76-
"soundPressure": (True, 10., 10),
77-
"rawAudioData": (False, 20.),
76+
"microphone": (True, 10., 10),
7877

7978
# debug
8079
"uiDebug": (True, 0., 1),

common/params_keys.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ inline static std::unordered_map<std::string, uint32_t> keys = {
9999
{"PandaSomResetTriggered", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
100100
{"PandaSignatures", CLEAR_ON_MANAGER_START},
101101
{"PrimeType", PERSISTENT},
102-
{"RecordAudio", PERSISTENT},
103102
{"RecordFront", PERSISTENT},
104103
{"RecordFrontLock", PERSISTENT}, // for the internal fleet
105104
{"SecOCKey", PERSISTENT | DONT_LOG},

selfdrive/assets/icons/microphone.png

Lines changed: 0 additions & 3 deletions
This file was deleted.

selfdrive/ui/layouts/settings/toggles.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"AlwaysOnDM": "Enable driver monitoring even when openpilot is not engaged.",
2323
'RecordFront': "Upload data from the driver facing camera and help improve the driver monitoring algorithm.",
2424
"IsMetric": "Display speed in km/h instead of mph.",
25-
"RecordAudio": "Record and store microphone audio while driving. The audio will be included in the dashcam video in comma connect.",
2625
}
2726

2827

@@ -78,12 +77,6 @@ def __init__(self):
7877
toggle_item(
7978
"Use Metric System", DESCRIPTIONS["IsMetric"], self._params.get_bool("IsMetric"), icon="monitoring.png"
8079
),
81-
toggle_item(
82-
"Record Microphone Audio",
83-
DESCRIPTIONS["RecordAudio"],
84-
self._params.get_bool("RecordAudio"),
85-
icon="microphone.png",
86-
),
8780
]
8881

8982
self._scroller = Scroller(items, line_separator=True, spacing=0)

selfdrive/ui/qt/offroad/settings.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
6868
"../assets/icons/metric.png",
6969
false,
7070
},
71-
{
72-
"RecordAudio",
73-
tr("Record Microphone Audio"),
74-
tr("Record and store microphone audio while driving. The audio will be included in the dashcam video in comma connect."),
75-
"../assets/icons/microphone.png",
76-
true,
77-
},
7871
};
7972

8073

selfdrive/ui/qt/sidebar.cc

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ void Sidebar::drawMetric(QPainter &p, const QPair<QString, QString> &label, QCol
2424
p.drawText(rect.adjusted(22, 0, 0, 0), Qt::AlignCenter, label.first + "\n" + label.second);
2525
}
2626

27-
Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(false), settings_pressed(false), mic_indicator_pressed(false) {
27+
Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(false), settings_pressed(false) {
2828
home_img = loadPixmap("../assets/images/button_home.png", home_btn.size());
2929
flag_img = loadPixmap("../assets/images/button_flag.png", home_btn.size());
3030
settings_img = loadPixmap("../assets/images/button_settings.png", settings_btn.size(), Qt::IgnoreAspectRatio);
31-
mic_img = loadPixmap("../assets/icons/microphone.png", QSize(30, 30));
3231

3332
connect(this, &Sidebar::valueChanged, [=] { update(); });
3433

@@ -48,15 +47,12 @@ void Sidebar::mousePressEvent(QMouseEvent *event) {
4847
} else if (settings_btn.contains(event->pos())) {
4948
settings_pressed = true;
5049
update();
51-
} else if (recording_audio && mic_indicator_btn.contains(event->pos())) {
52-
mic_indicator_pressed = true;
53-
update();
5450
}
5551
}
5652

5753
void Sidebar::mouseReleaseEvent(QMouseEvent *event) {
58-
if (flag_pressed || settings_pressed || mic_indicator_pressed) {
59-
flag_pressed = settings_pressed = mic_indicator_pressed = false;
54+
if (flag_pressed || settings_pressed) {
55+
flag_pressed = settings_pressed = false;
6056
update();
6157
}
6258
if (onroad && home_btn.contains(event->pos())) {
@@ -65,8 +61,6 @@ void Sidebar::mouseReleaseEvent(QMouseEvent *event) {
6561
pm->send("userFlag", msg);
6662
} else if (settings_btn.contains(event->pos())) {
6763
emit openSettings();
68-
} else if (recording_audio && mic_indicator_btn.contains(event->pos())) {
69-
emit openSettings(2, "RecordAudio");
7064
}
7165
}
7266

@@ -112,8 +106,6 @@ void Sidebar::updateState(const UIState &s) {
112106
pandaStatus = {{tr("NO"), tr("PANDA")}, danger_color};
113107
}
114108
setProperty("pandaStatus", QVariant::fromValue(pandaStatus));
115-
116-
setProperty("recordingAudio", s.scene.recording_audio);
117109
}
118110

119111
void Sidebar::paintEvent(QPaintEvent *event) {
@@ -128,14 +120,6 @@ void Sidebar::paintEvent(QPaintEvent *event) {
128120
p.drawPixmap(settings_btn.x(), settings_btn.y(), settings_img);
129121
p.setOpacity(onroad && flag_pressed ? 0.65 : 1.0);
130122
p.drawPixmap(home_btn.x(), home_btn.y(), onroad ? flag_img : home_img);
131-
if (recording_audio) {
132-
p.setBrush(danger_color);
133-
p.setOpacity(mic_indicator_pressed ? 0.65 : 1.0);
134-
p.drawRoundedRect(mic_indicator_btn, mic_indicator_btn.height() / 2, mic_indicator_btn.height() / 2);
135-
int icon_x = mic_indicator_btn.x() + (mic_indicator_btn.width() - mic_img.width()) / 2;
136-
int icon_y = mic_indicator_btn.y() + (mic_indicator_btn.height() - mic_img.height()) / 2;
137-
p.drawPixmap(icon_x, icon_y, mic_img);
138-
}
139123
p.setOpacity(1.0);
140124

141125
// network

selfdrive/ui/qt/sidebar.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class Sidebar : public QFrame {
1818
Q_PROPERTY(ItemStatus tempStatus MEMBER temp_status NOTIFY valueChanged);
1919
Q_PROPERTY(QString netType MEMBER net_type NOTIFY valueChanged);
2020
Q_PROPERTY(int netStrength MEMBER net_strength NOTIFY valueChanged);
21-
Q_PROPERTY(bool recordingAudio MEMBER recording_audio NOTIFY valueChanged);
2221

2322
public:
2423
explicit Sidebar(QWidget* parent = 0);
@@ -37,8 +36,8 @@ public slots:
3736
void mouseReleaseEvent(QMouseEvent *event) override;
3837
void drawMetric(QPainter &p, const QPair<QString, QString> &label, QColor c, int y);
3938

40-
QPixmap home_img, flag_img, settings_img, mic_img;
41-
bool onroad, recording_audio, flag_pressed, settings_pressed, mic_indicator_pressed;
39+
QPixmap home_img, flag_img, settings_img;
40+
bool onroad, flag_pressed, settings_pressed;
4241
const QMap<cereal::DeviceState::NetworkType, QString> network_type = {
4342
{cereal::DeviceState::NetworkType::NONE, tr("--")},
4443
{cereal::DeviceState::NetworkType::WIFI, tr("Wi-Fi")},
@@ -51,7 +50,6 @@ public slots:
5150

5251
const QRect home_btn = QRect(60, 860, 180, 180);
5352
const QRect settings_btn = QRect(50, 35, 200, 117);
54-
const QRect mic_indicator_btn = QRect(158, 252, 75, 40);
5553
const QColor good_color = QColor(255, 255, 255);
5654
const QColor warning_color = QColor(218, 202, 37);
5755
const QColor danger_color = QColor(201, 34, 49);

selfdrive/ui/soundd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def soundd_thread(self):
135135
# sounddevice must be imported after forking processes
136136
import sounddevice as sd
137137

138-
sm = messaging.SubMaster(['selfdriveState', 'soundPressure'])
138+
sm = messaging.SubMaster(['selfdriveState', 'microphone'])
139139

140140
with self.get_stream(sd) as stream:
141141
rk = Ratekeeper(20)
@@ -144,8 +144,8 @@ def soundd_thread(self):
144144
while True:
145145
sm.update(0)
146146

147-
if sm.updated['soundPressure'] and self.current_alert == AudibleAlert.none: # only update volume filter when not playing alert
148-
self.spl_filter_weighted.update(sm["soundPressure"].soundPressureWeightedDb)
147+
if sm.updated['microphone'] and self.current_alert == AudibleAlert.none: # only update volume filter when not playing alert
148+
self.spl_filter_weighted.update(sm["microphone"].soundPressureWeightedDb)
149149
self.current_volume = self.calculate_volume(float(self.spl_filter_weighted.x))
150150

151151
self.get_audible_alert(sm)

0 commit comments

Comments
 (0)