Compare commits

...

40 Commits

Author SHA1 Message Date
royjr
40dc4e1591 Merge branch 'master' into hyundai-custom-button 2026-02-16 22:43:14 -05:00
royjr
cce4810904 Update opendbc_repo 2026-02-16 22:43:09 -05:00
royjr
5b58f9c1f5 Update opendbc_repo 2026-02-13 23:34:16 -05:00
royjr
815ac7732b Merge branch 'master' into hyundai-custom-button 2026-02-13 23:02:12 -05:00
royjr
2321f9d8f5 Update opendbc_repo 2026-02-13 23:02:06 -05:00
royjr
b9020e0003 Update params_metadata.json 2026-02-04 22:07:48 -05:00
royjr
ceb466578a Update params_metadata.json 2026-02-04 22:07:19 -05:00
royjr
e1cfea4924 Update RELEASES.md 2026-02-04 22:04:29 -05:00
royjr
dd8a2bf83a Merge branch 'master' into hyundai-custom-button 2026-02-04 21:45:41 -05:00
royjr
ba36a28f2a Update opendbc_repo 2026-02-04 21:43:53 -05:00
royjr
cf2010389a Revert "Update opendbc_repo"
This reverts commit 43522c4922.
2026-02-04 19:14:43 -05:00
royjr
43522c4922 Update opendbc_repo 2026-02-04 19:14:28 -05:00
royjr
1cb5f24439 Merge branch 'master' into hyundai-custom-button 2025-10-08 21:37:43 -04:00
royjr
b6a3f21a52 Merge branch 'master' into hyundai-custom-button 2025-10-08 18:27:27 -04:00
royjr
2ecc26b623 Update opendbc_repo 2025-10-08 18:27:19 -04:00
royjr
145f75fe06 Merge branch 'master' into hyundai-custom-button 2025-10-08 17:57:50 -04:00
royjr
bd0578cbf9 Update opendbc_repo 2025-10-08 17:17:28 -04:00
royjr
40f24cc0b6 Update opendbc_repo 2025-09-03 10:08:01 -04:00
royjr
754efac063 Merge branch 'master' into hyundai-custom-button 2025-09-03 09:57:35 -04:00
royjr
132cc156f4 Update opendbc_repo 2025-09-03 09:57:27 -04:00
nayan
95ad932efb disable lkas per upstream & fix mixed events 2025-08-25 09:15:20 -04:00
nayan
ae30f4119f Merge remote-tracking branch 'origin/master' into hyundai-custom-button
# Conflicts:
#	RELEASES.md
#	opendbc_repo
#	selfdrive/ui/feedback/feedbackd.py
2025-08-25 09:04:57 -04:00
nayan
d251ae4976 pr be messing with pr 2025-08-24 16:40:48 -04:00
nayan
33324e590b use altButton2 event 2025-08-23 22:24:39 -04:00
nayan
fea10ffd22 Merge remote-tracking branch 'origin/master' into hyundai-custom-button 2025-08-23 22:00:59 -04:00
nayan
f1e11e3f06 bump opendbc 2025-08-23 22:00:50 -04:00
royjr
c562eca8a1 Merge branch 'master' into hyundai-custom-button 2025-08-22 10:30:38 -04:00
royjr
d9a690dac3 Update opendbc_repo 2025-08-22 10:30:28 -04:00
nayan
a0eed058d1 bump opendbc 2025-08-13 17:28:11 -04:00
nayan
abc9f47a6f Merge remote-tracking branch 'origin/master' into hyundai-custom-button
# Conflicts:
#	opendbc_repo
2025-08-13 17:27:19 -04:00
Nayan
b064f6fcaf Merge branch 'master' into hyundai-custom-button 2025-08-12 14:41:16 -04:00
nayan
0c7d7df2ec keep both 2025-08-12 14:40:11 -04:00
nayan
dc86f35957 refactor 2025-08-12 13:29:06 -04:00
nayan
9685b0aa9b lint 2025-08-12 12:49:17 -04:00
nayan
f23cc408e3 not needed anymore 2025-08-12 12:48:49 -04:00
nayan
cea00a6c14 todo 2025-08-12 12:00:53 -04:00
nayan
f2949e1dc2 use custom button in feedbackd 2025-08-10 11:49:35 -04:00
royjr
5f1f34fa7f Update opendbc_repo 2025-08-10 09:31:11 -04:00
royjr
2c041f9025 Merge branch 'master' into hyundai-custom-button 2025-08-10 09:28:05 -04:00
nayan
74b2d519b9 move custom button to cs_sp, add bookmark functionality 2025-08-05 15:52:46 -04:00
4 changed files with 64 additions and 23 deletions

View File

@@ -180,6 +180,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"ShowTurnSignals", {PERSISTENT | BACKUP, BOOL, "0"}},
{"StandstillTimer", {PERSISTENT | BACKUP, BOOL, "0"}},
{"TrueVEgoUI", {PERSISTENT | BACKUP, BOOL, "0"}},
{"SteeringCustomButtonMapping", {PERSISTENT | BACKUP, INT, "0"}},
// MADS params
{"Mads", {PERSISTENT | BACKUP, BOOL, "1"}},

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import cereal.messaging as messaging
from enum import Enum
from openpilot.common.params import Params
from openpilot.common.swaglog import cloudlog
from cereal import car
@@ -8,6 +9,14 @@ from openpilot.system.micd import SAMPLE_RATE, SAMPLE_BUFFER
FEEDBACK_MAX_DURATION = 10.0
ButtonType = car.CarState.ButtonEvent.Type
# TODO-SP: Use common python enum when we move to raylib?
CUSTOM_MAPPING_BOOKMARK = 1 # Custom button mapping value for bookmark action
class ButtonPressType(Enum):
NONE = 'NONE'
LKAS = 'LKAS'
CUSTOM = 'CUSTOM'
def main():
params = Params()
@@ -21,29 +30,25 @@ def main():
while True:
sm.update()
should_send_bookmark = False
btn_pressed = get_button_event(sm, params)
# TODO: https://github.com/commaai/openpilot/issues/36015
# only allow the LKAS button to record feedback when MADS is disabled
if False and sm.updated['carState'] and sm['carState'].canValid and not sm['selfdriveStateSP'].mads.available:
for be in sm['carState'].buttonEvents:
if be.type == ButtonType.lkas:
if be.pressed:
if not should_record_audio:
if params.get_bool("RecordAudioFeedback"): # Start recording on first press if toggle set
should_record_audio = True
block_num = 0
waiting_for_release = False
early_stop_triggered = False
cloudlog.info("LKAS button pressed - starting 10-second audio feedback")
else:
should_send_bookmark = True # immediately send bookmark if toggle false
cloudlog.info("LKAS button pressed - bookmarking")
elif should_record_audio and not waiting_for_release: # Wait for release of second press to stop recording early
waiting_for_release = True
elif waiting_for_release: # Second press released
waiting_for_release = False
early_stop_triggered = True
cloudlog.info("LKAS button released - ending recording early")
if btn_pressed is not ButtonPressType.NONE:
if not should_record_audio:
if params.get_bool("RecordAudioFeedback"): # Start recording on first press if toggle set
should_record_audio = True
block_num = 0
waiting_for_release = False
early_stop_triggered = False
cloudlog.info(f"{btn_pressed.value} button pressed - starting 10-second audio feedback")
else:
should_send_bookmark = True # immediately send bookmark if toggle false
cloudlog.info(f"{btn_pressed.value} button pressed - bookmarking")
elif should_record_audio and not waiting_for_release: # Wait for release of second press to stop recording early
waiting_for_release = True
elif waiting_for_release: # Second press released
waiting_for_release = False
early_stop_triggered = True
cloudlog.info(f"{btn_pressed.value} button released - ending recording early")
if should_record_audio and sm.updated['rawAudioData']:
raw_audio = sm['rawAudioData']
@@ -68,5 +73,26 @@ def main():
pm.send('userBookmark', msg)
def get_button_event(sm, params):
custom_button_mapping = params.get("SteeringCustomButtonMapping")
custom_mapped = custom_button_mapping == CUSTOM_MAPPING_BOOKMARK
btn_pressed = ButtonPressType.NONE
# use custom button mapping if available
use_custom = custom_mapped and sm.updated['carState']
# only allow the LKAS button to record feedback when MADS is disabled & custom button mapping is not set
# TODO: https://github.com/commaai/openpilot/issues/36015
use_lkas = False #sm.updated['carState'] and sm['carState'].canValid and not sm['selfdriveStateSP'].mads.available
if use_custom or use_lkas:
for be in sm['carState'].buttonEvents:
if use_custom and be.type == ButtonType.altButton2:
btn_pressed = ButtonPressType.CUSTOM if be.pressed else ButtonPressType.NONE
elif use_lkas and be.type == ButtonType.lkas:
btn_pressed = ButtonPressType.LKAS if be.pressed else ButtonPressType.NONE
return btn_pressed
if __name__ == '__main__':
main()

View File

@@ -1203,6 +1203,20 @@
"title": "[TIZI/TICI only] Standstill Timer",
"description": "Show a timer on the HUD when the car is at a standstill."
},
"SteeringCustomButtonMapping": {
"title": "Steering Custom Button Mapping",
"description": "Customize the steering wheel custom/star button for openpilot control.",
"options": [
{
"value": 0,
"label": "Off"
},
{
"value": 1,
"label": "Bookmark"
}
]
},
"SubaruStopAndGo": {
"title": "Subaru Stop and Go",
"description": ""