Skip to content

fix: UART passthrough #250

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

Merged
merged 1 commit into from
Jun 16, 2025
Merged

fix: UART passthrough #250

merged 1 commit into from
Jun 16, 2025

Conversation

AsCress
Copy link
Contributor

@AsCress AsCress commented Jun 15, 2025

Summary by Sourcery

Bug Fixes:

  • Fix attribute reference from self.firmware to self.device.firmware in enable_uart_passthrough logic

@AsCress AsCress requested a review from bessman June 15, 2025 08:16
Copy link

sourcery-ai bot commented Jun 15, 2025

Reviewer's Guide

Enable UART passthrough now correctly checks the firmware version via the device attribute, preventing attribute errors on newer firmware.

Sequence Diagram: Corrected Firmware Version Access in enable_uart_passthrough

sequenceDiagram
    participant SL as "ScienceLab Instance"
    participant D_obj as "Device (self.device)"
    participant F_obj as "Firmware (D_obj.firmware)"

    SL->>SL: enable_uart_passthrough(baudrate)
    activate SL
    SL->>D_obj: Get firmware object
    activate D_obj
    D_obj-->>SL: firmware_object (F_obj)
    deactivate D_obj

    SL->>F_obj: Get major version
    activate F_obj
    F_obj-->>SL: major_version
    deactivate F_obj

    alt major_version < 3
        SL->>SL: _uart_passthrough_legacy(baudrate)
    else major_version >= 3
        SL->>SL: _uart_passthrough(baudrate)
    end
    deactivate SL
Loading

Class Diagram: Structure for UART Firmware Version Access

classDiagram
    class ScienceLab {
        +device: Device
        +enable_uart_passthrough(baudrate: int) void
        -_uart_passthrough_legacy(baudrate: int) void
        -_uart_passthrough(baudrate: int) void
    }
    class Device {
        +firmware: Firmware
    }
    class Firmware {
        +major: int
    }
    ScienceLab "1" *-- "1" Device : has a
    Device "1" *-- "1" Firmware : has a
Loading

File-Level Changes

Change Details Files
Fix firmware attribute reference used in UART passthrough version check
  • Replace self.firmware.major with self.device.firmware.major
pslab/sciencelab.py

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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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 @AsCress - I've reviewed your changes and they look great!


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.

@AsCress
Copy link
Contributor Author

AsCress commented Jun 15, 2025

@bessman This is not yet mergable.

@AsCress
Copy link
Contributor Author

AsCress commented Jun 15, 2025

Screenshot 2025-06-15 142351
The passthrough mode works now !

@bessman bessman merged commit 1346356 into fossasia:main Jun 16, 2025
2 checks passed
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