-
Notifications
You must be signed in to change notification settings - Fork 886
move CAN ignition detection to opendbc #2323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6394832 to
a049c33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Moves CAN-based ignition detection out of panda firmware and into opendbc’s safety layer (per linked opendbc work), removing local ignition tracking from the CAN RX path.
Changes:
- Removes the
ignition_can_hook()call from the FDCAN RX handler. - Deletes
ignition_can/ignition_can_cntglobals and theignition_can_hook()implementation fromcan_common.h.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| board/drivers/fdcan.h | Stops invoking local CAN-based ignition detection during RX processing. |
| board/drivers/can_common.h | Removes local ignition globals and hook implementation to defer ignition detection to opendbc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Ignition detected from CAN meessages | ||
| // Ignition detected via CAN (logic now in opendbc safety layer) | ||
| bool ignition_can = false; |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignition_can / ignition_can_cnt are no longer defined in this compilation unit after removing them from can_common.h, but they are still referenced (e.g., board/main.c uses both, and board/main_comms.h reports ignition_can in the health packet). Unless these globals are now provided by the opendbc safety code at link time, this will result in undefined-symbol link failures. Please ensure there is exactly one definition (either in opendbc or a dedicated .c file in this repo) and that the remaining references include the correct declarations.
| bool ignition_can = false; | |
| bool can_loopback = false; | |
| bool ignition_can = false; | |
| uint32_t ignition_can_cnt = 0U; |
a049c33 to
3a62a80
Compare
- Add ignition_can_hook() function (exact copy from panda) - Use extern for ignition_can variables (defined in panda's can_common.h) - Add variable definitions in test harness for opendbc tests - Call ignition_can_hook from safety_rx_hook Part of commaai#1834 Requires: commaai/panda#2323
3a62a80 to
28a90b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| #define WORD_TO_BYTE_ARRAY(dst8, src32) \ | ||
| 0 [dst8] = ((src32) & 0xFFU); \ | ||
| 1 [dst8] = (((src32) >> 8U) & 0xFFU); \ | ||
| 2 [dst8] = (((src32) >> 16U) & 0xFFU); \ | ||
| 3 [dst8] = (((src32) >> 24U) & 0xFFU) | ||
| #define BYTE_ARRAY_TO_WORD(dst32, src8) \ | ||
| ((dst32) = \ | ||
| 0 [src8] | (1 [src8] << 8U) | (2 [src8] << 16U) | (3 [src8] << 24U)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this touched?
|
These kinds of PRs, with irrelevant changes and a poor description written by an LLM, are effectively spam. Read our docs before opening any more PRs on our repos: https://github.com/commaai/openpilot/blob/master/docs/CONTRIBUTING.md. |
Part of commaai/opendbc#1834
Moves CAN-based ignition detection logic to opendbc's safety layer.
Changes
ignition_canandignition_can_cntvariables fromcan_common.hignition_can_hook()function fromcan_common.hignition_can_hook(&to_push)call fromfdcan.hWhy
The ignition detection logic belongs in opendbc since it's safety-related and vehicle-specific. Moving it there allows:
Related