Skip to content

Serial CAN bus bit rate selector#69

Merged
LelsersLasers merged 10 commits into
masterfrom
millan/bit_rate_selector
May 30, 2026
Merged

Serial CAN bus bit rate selector#69
LelsersLasers merged 10 commits into
masterfrom
millan/bit_rate_selector

Conversation

@LelsersLasers
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

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

Adds a selectable (and persisted) CAN nominal bit rate for Serial/SLCAN connections, threading the chosen rate from UI → settings → connection source → driver open.

Changes:

  • Introduces CanBusSpeed and extends ConnectionSource::Serial to carry the selected bit rate.
  • Updates the SLCAN serial driver to open the CAN channel at the selected nominal bit rate.
  • Adds a sidebar UI control to select CAN speed and persists it via settings.json.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/ui/sidebar.rs Adds CAN speed ComboBox and threads speed into Serial source selection.
src/settings.rs Persists a default CAN speed in settings.
src/connection.rs Adds CanBusSpeed and extends ConnectionSource::Serial to include it.
src/can/driver.rs Passes selected speed into SerialDriver and opens SLCAN with it.
src/app.rs Stores can_bus_speed in app state and saves/loads it via settings.
Comments suppressed due to low confidence (1)

src/app.rs:74

  • Speed is being persisted in two places (Settings.selected_speed / DAQApp.can_bus_speed and also inside selected_source for the Serial variant). This duplication makes it easy to persist/load inconsistent state (especially if only one is updated). It would be more robust to have a single source of truth (store speed only in ConnectionSource::Serial or only in Settings/DAQApp) or to explicitly reconcile them when saving/loading.
    pub fn save_settings(&self) {
        let settings = settings::Settings {
            dbc_path: self.parser.as_ref().map(|p| p.dbc_path.clone()),
            selected_source: self.selected_source.clone(),
            selected_speed: self.can_bus_speed,
            udp_port: self.udp_port,
            theme: self.theme_selection,
            pixels_per_point: self.pixels_per_point,
        };

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/sidebar.rs
Comment thread src/ui/sidebar.rs
Comment thread src/ui/sidebar.rs Outdated
Comment thread src/settings.rs
Comment thread src/connection.rs
@LelsersLasers LelsersLasers marked this pull request as ready for review May 2, 2026 18:32
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment thread src/ui/sidebar.rs
Comment thread src/ui/sidebar.rs
Comment thread src/settings.rs
Comment thread src/connection.rs
@LelsersLasers LelsersLasers force-pushed the millan/bit_rate_selector branch from 44546ad to 913c2fa Compare May 28, 2026 03:25
@irvingywang
Copy link
Copy Markdown
Member

r we waiting to test this one?

@LelsersLasers
Copy link
Copy Markdown
Member Author

We can if you want to wait, but it might be easier to merge it and then if it has problems fix it later?

@LelsersLasers LelsersLasers force-pushed the millan/bit_rate_selector branch from 913c2fa to 355aacf Compare May 30, 2026 02:53
@LelsersLasers LelsersLasers merged commit 33f8527 into master May 30, 2026
1 check passed
@LelsersLasers LelsersLasers deleted the millan/bit_rate_selector branch May 30, 2026 02:58
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.

3 participants