Skip to content
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

Sync: commaai/panda:master into sunnypilot/panda:master-new #61

Merged
merged 4 commits into from
Jan 7, 2025

Conversation

sunnyhaibin
Copy link
Collaborator

@sunnyhaibin sunnyhaibin commented Jan 7, 2025

Summary by Sourcery

Enhancements:

  • Remove unnecessary type annotations from the CanClient and IsoTpMessage classes.

Copy link

sourcery-ai bot commented Jan 7, 2025

Reviewer's Guide by Sourcery

This pull request synchronizes the commaai/panda repository with the sunnypilot/panda repository. It includes updates to the CAN client, UDS client, and ISO-TP message classes, as well as changes to the Cuatro board configuration and Subaru Pre-Global safety parameters.

Class diagram for updated CAN and UDS communication classes

classDiagram
    class CanClient {
        +tx_addr: int
        +rx_addr: int
        +rx_buff: deque[bytes]
        +sub_addr: int
        +bus: int
        +debug: bool
        +__init__(can_send, can_recv, tx_addr, rx_addr, bus, sub_addr, debug)
        +send(msgs: list[bytes], delay: float)
    }
    class IsoTpMessage {
        -_can_client: CanClient
        -_timeout: float
        -_debug: bool
        -_max_len: int
        +__init__(can_client, timeout, single_frame_mode, separation_time, debug, max_len)
    }
    class UdsClient {
        +bus: int
        +__init__(panda, tx_addr, rx_addr, bus, sub_addr, timeout, debug, tx_timeout, response_pending_timeout)
    }
    IsoTpMessage --> CanClient
    UdsClient --> CanClient
    note for CanClient "Updated rx_buff type annotation"
    note for IsoTpMessage "Removed parentheses from class definition"
    note for UdsClient "Removed parentheses from class definition"
Loading

State diagram for Cuatro board boot states

stateDiagram-v2
    [*] --> BOOT_BOOTKICK: GPIO A0 Active Low
    [*] --> BOOT_RESET: GPIO C12 Active Low
    note right of BOOT_RESET: Now enabled in bootkick function
Loading

File-Level Changes

Change Details Files
Updated class definitions to use the new Python class definition style.
  • Changed CanClient(), IsoTpMessage(), and UdsClient() to CanClient, IsoTpMessage, and UdsClient, respectively, to adhere to the new style guide.
python/uds.py
Modified the Cuatro board configuration.
  • Uncommented the line set_gpio_output(GPIOC, 12, state != BOOT_RESET); and added a TODO comment to confirm its necessity.
board/boards/cuatro.h
Updated the Subaru Pre-Global safety parameters.
  • Changed the value of FLAG_SUBARU_PREGLOBAL_REVERSED_DRIVER_TORQUE from 1 to 4 in both python/__init__.py and board/safety/safety_subaru_preglobal.h files.
python/__init__.py
board/safety/safety_subaru_preglobal.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @sunnyhaibin - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The bootkick reset code in cuatro.h was previously commented out with 'only use if we have to'. Please validate and confirm this functionality is needed before enabling it.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sunnyhaibin sunnyhaibin merged commit 781af8b into master-new Jan 7, 2025
10 checks passed
@sunnyhaibin sunnyhaibin deleted the sync-20250107 branch January 7, 2025 05:41
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.

4 participants