mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 21:14:01 +08:00
* store/send mic audio with toggle * script to extract audio from logs * change description and add translation placeholders * microphone icon * apply toggle in loggerd * add legnth and counter * startFrameIdx counter * Revert "change description and add translation placeholders" This reverts commit 7baa1f6de99c6ebe9f9906193da7e83dad79511a. * send mic data first and then calc * restore changed description/icon after revert * adjust fft samples to keep old time window * remove extract_audio.py since audio is now stored in qcam isntead of rlog * qt microphone recording icon * Revert "remove extract_audio.py since audio is now stored in qcam isntead of rlog" This reverts commit 7a3a75bd8db5376d1e442a3ba931c67550b5f132. * move extract_audio script and output file by default * remove length field * recording indicator swaps sides based on lhd/rhd * use record icon from comma body * Update toggle description Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * update raylib toggle desc cause I did earlier * microphone --> soundPressure, audioData --> rawAudioData * cleanup unused var * update README * sidebar mic indicator instead of annotated camera * improve logic readability * remove startFrameIdx and sequenceNum * use Q_PROPERTY/setProperty so that update() is actually called on value change * specify old id for SoundPressure * fix typo --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
96 lines
3.6 KiB
Python
96 lines
3.6 KiB
Python
from openpilot.system.ui.lib.list_view import multiple_button_item, toggle_item
|
|
from openpilot.system.ui.lib.scroller import Scroller
|
|
from openpilot.system.ui.lib.widget import Widget
|
|
from openpilot.common.params import Params
|
|
|
|
# Description constants
|
|
DESCRIPTIONS = {
|
|
"OpenpilotEnabledToggle": (
|
|
"Use the openpilot system for adaptive cruise control and lane keep driver assistance. " +
|
|
"Your attention is required at all times to use this feature."
|
|
),
|
|
"DisengageOnAccelerator": "When enabled, pressing the accelerator pedal will disengage openpilot.",
|
|
"LongitudinalPersonality": (
|
|
"Standard is recommended. In aggressive mode, openpilot will follow lead cars closer and be more aggressive with the gas and brake. " +
|
|
"In relaxed mode openpilot will stay further away from lead cars. On supported cars, you can cycle through these personalities with " +
|
|
"your steering wheel distance button."
|
|
),
|
|
"IsLdwEnabled": (
|
|
"Receive alerts to steer back into the lane when your vehicle drifts over a detected lane line " +
|
|
"without a turn signal activated while driving over 31 mph (50 km/h)."
|
|
),
|
|
"AlwaysOnDM": "Enable driver monitoring even when openpilot is not engaged.",
|
|
'RecordFront': "Upload data from the driver facing camera and help improve the driver monitoring algorithm.",
|
|
"IsMetric": "Display speed in km/h instead of mph.",
|
|
"RecordAudio": "Record and store microphone audio while driving. The audio will be included in the dashcam video in comma connect.",
|
|
}
|
|
|
|
|
|
class TogglesLayout(Widget):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self._params = Params()
|
|
items = [
|
|
toggle_item(
|
|
"Enable openpilot",
|
|
DESCRIPTIONS["OpenpilotEnabledToggle"],
|
|
self._params.get_bool("OpenpilotEnabledToggle"),
|
|
icon="chffr_wheel.png",
|
|
),
|
|
toggle_item(
|
|
"Experimental Mode",
|
|
initial_state=self._params.get_bool("ExperimentalMode"),
|
|
icon="experimental_white.png",
|
|
),
|
|
toggle_item(
|
|
"Disengage on Accelerator Pedal",
|
|
DESCRIPTIONS["DisengageOnAccelerator"],
|
|
self._params.get_bool("DisengageOnAccelerator"),
|
|
icon="disengage_on_accelerator.png",
|
|
),
|
|
multiple_button_item(
|
|
"Driving Personality",
|
|
DESCRIPTIONS["LongitudinalPersonality"],
|
|
buttons=["Aggressive", "Standard", "Relaxed"],
|
|
button_width=255,
|
|
callback=self._set_longitudinal_personality,
|
|
selected_index=int(self._params.get("LongitudinalPersonality") or 0),
|
|
icon="speed_limit.png"
|
|
),
|
|
toggle_item(
|
|
"Enable Lane Departure Warnings",
|
|
DESCRIPTIONS["IsLdwEnabled"],
|
|
self._params.get_bool("IsLdwEnabled"),
|
|
icon="warning.png",
|
|
),
|
|
toggle_item(
|
|
"Always-On Driver Monitoring",
|
|
DESCRIPTIONS["AlwaysOnDM"],
|
|
self._params.get_bool("AlwaysOnDM"),
|
|
icon="monitoring.png",
|
|
),
|
|
toggle_item(
|
|
"Record and Upload Driver Camera",
|
|
DESCRIPTIONS["RecordFront"],
|
|
self._params.get_bool("RecordFront"),
|
|
icon="monitoring.png",
|
|
),
|
|
toggle_item(
|
|
"Use Metric System", DESCRIPTIONS["IsMetric"], self._params.get_bool("IsMetric"), icon="monitoring.png"
|
|
),
|
|
toggle_item(
|
|
"Record Microphone Audio",
|
|
DESCRIPTIONS["RecordAudio"],
|
|
self._params.get_bool("RecordAudio"),
|
|
icon="microphone.png",
|
|
),
|
|
]
|
|
|
|
self._scroller = Scroller(items, line_separator=True, spacing=0)
|
|
|
|
def _render(self, rect):
|
|
self._scroller.render(rect)
|
|
|
|
def _set_longitudinal_personality(self, button_index: int):
|
|
self._params.put("LongitudinalPersonality", str(button_index))
|