Skip to content

Conversation

@rosacry
Copy link

@rosacry rosacry commented Jan 29, 2026

Part of commaai/opendbc#1834

Moves CAN-based ignition detection logic to opendbc's safety layer.

Changes

  • Remove ignition_can and ignition_can_cnt variables from can_common.h
  • Remove ignition_can_hook() function from can_common.h
  • Remove ignition_can_hook(&to_push) call from fdcan.h

Why

The ignition detection logic belongs in opendbc since it's safety-related and vehicle-specific. Moving it there allows:

  • Better testing with opendbc's safety test infrastructure
  • Cleaner separation of concerns
  • Easier maintenance of vehicle-specific logic

Related

Copilot AI review requested due to automatic review settings January 29, 2026 18:38
@rosacry rosacry force-pushed the move-ignition-to-opendbc branch from 6394832 to a049c33 Compare January 29, 2026 18:43
Copy link

Copilot AI left a 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_cnt globals and the ignition_can_hook() implementation from can_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;
Copy link

Copilot AI Jan 29, 2026

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.

Suggested change
bool ignition_can = false;
bool can_loopback = false;
bool ignition_can = false;
uint32_t ignition_can_cnt = 0U;

Copilot uses AI. Check for mistakes.
@rosacry rosacry force-pushed the move-ignition-to-opendbc branch from a049c33 to 3a62a80 Compare January 29, 2026 18:52
rosacry added a commit to rosacry/opendbc that referenced this pull request Jan 29, 2026
- 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
Copy link

Copilot AI left a 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.

Comment on lines +46 to +53
#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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this touched?

@adeebshihadeh
Copy link
Contributor

adeebshihadeh commented Jan 29, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants