Compare commits

..

4 Commits

Author SHA1 Message Date
discountchubbs
319069378e merge 2026-02-18 14:10:16 -08:00
discountchubbs
cedb501376 better attribution to plan 2026-02-18 14:09:21 -08:00
discountchubbs
fd1ec26e9a 20hz 2026-02-17 17:53:03 -08:00
discountchubbs
2b01fc4c9c Hyundai Longitudinal: deprecate ramp update for dynamic tune 2026-02-16 18:27:18 -08:00
4 changed files with 23 additions and 64 deletions

View File

@@ -180,7 +180,6 @@ 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,6 +1,5 @@
#!/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
@@ -9,14 +8,6 @@ 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()
@@ -30,25 +21,29 @@ def main():
while True:
sm.update()
should_send_bookmark = False
btn_pressed = get_button_event(sm, params)
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")
# 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 should_record_audio and sm.updated['rawAudioData']:
raw_audio = sm['rawAudioData']
@@ -73,26 +68,5 @@ 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,20 +1203,6 @@
"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": ""