Hyundai: delay cancel button send#3305
Conversation
Car behavior reportReplays driving segments through this PR and compares the behavior to master. Testing 260 segments for: HYUNDAI_AZERA_HEV_6TH_GEN, HYUNDAI_ELANTRA_GT_I30, HYUNDAI_ELANTRA_2021, HYUNDAI_ELANTRA_HEV_2021, HYUNDAI_GENESIS, HYUNDAI_IONIQ, HYUNDAI_IONIQ_HEV_2022, HYUNDAI_IONIQ_EV_2020, HYUNDAI_IONIQ_PHEV_2019, HYUNDAI_IONIQ_PHEV, HYUNDAI_KONA_2022, HYUNDAI_KONA_EV, HYUNDAI_KONA_EV_2022, HYUNDAI_KONA_EV_2ND_GEN, HYUNDAI_SANTA_FE, HYUNDAI_SANTA_FE_2022, HYUNDAI_SANTA_FE_HEV_2022, HYUNDAI_SANTA_FE_PHEV_2022, HYUNDAI_SONATA, HYUNDAI_SONATA_LF, HYUNDAI_STARIA_4TH_GEN, HYUNDAI_PALISADE, HYUNDAI_SONATA_HYBRID, HYUNDAI_IONIQ_5, HYUNDAI_IONIQ_6, HYUNDAI_TUCSON_4TH_GEN, HYUNDAI_SANTA_CRUZ_1ST_GEN, HYUNDAI_CUSTIN_1ST_GEN ✅ 0 changed, 260 passed, 0 errors |
05c7819 to
45c15aa
Compare
|
@sshane please let me know if there's anything else you'd want to see on this. I have been driving on this for 2 weeks and have no issue with it. Thanks! |
| # Delayed cancel: on newer CAN models, CF_Clu_CruiseSwState=4 is a pause/resume toggle (not a true cancel). | ||
| # Waiting CANCEL_BUTTON_DELAY_FRAMES lets factory SCC disengage naturally on brake press within its ~100 ms | ||
| # latency, and this branch acts as a fallback if SCC fails to disengage for any other reason. |
There was a problem hiding this comment.
you can remove these 2 if the top describes it
sshane
left a comment
There was a problem hiding this comment.
Matches GM, LGTM. This may eliminate or reduce Toyota beep, I'm not totally sure it's not just a conflict when braking. Can you make a generic function that GM and this can re-use? Or at least put up a temp commit so I can check it out?
|
@sshane removed duplicated comments per review. Ready to merge.
I opened a draft PR here. Added Toyota in there for now for easier testing. Will split once it's confirmed to work. |
| if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: | ||
| can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info)) | ||
| self.last_button_frame = self.frame |
There was a problem hiding this comment.
Wouldn't these cars have the same problem? It's just a message name difference?
There was a problem hiding this comment.
Oh nvm we send ACC message. Why can't we always send ACC message? No comment explaining why. Example of early complexity harming future work
There was a problem hiding this comment.
Unifying this is the kind of stuff I want to do before new ports
| MAX_ANGLE_FRAMES = 89 | ||
| MAX_ANGLE_CONSECUTIVE_FRAMES = 2 | ||
|
|
||
| # On some HKG CAN and CAN FD non-CANFD_ALT_BUTTONS, the cancel button (CF_Clu_CruiseSwState / CRUISE_BUTTONS = 4) is |
There was a problem hiding this comment.
Merging now, but can you update this comment after when we figure out if we can unify CC with the CAN FD alt and non alt buttons?


Description
CF_Clu_CruiseSwState/CRUISE_BUTTONS= 4) is a pause/resume toggle, not a dedicated cancel. When the driver brakes to disengage, openpilot fires this bit ~17 ms later while factory SCC is still mid-transition, triggering the "SCC Conditions Not Met" alert.CANCEL_BUTTON_DELAY_FRAMES = 10(~100 ms) using a cancel_counter pattern, same approach GM uses for its ECM soft-disable fault (thanks @sshane !). This lets factory SCC disengage naturally on brake press before OP ever sends the toggle.CC.cruiseControl.cancelremains asserted past the delay, such as factory SCC failed to disengage on brake for any other reason. Force-cancel remains fully functional.Validation
79f534ddd71804c000000015--738e5913fc/079f534ddd71804c0/00000011--ecef752f2c79f534ddd71804c0/00000015--738e5913fcIMG_3059.mov
IMG_3057.mov