Skip to content

Commit

Permalink
remove setting bitrate - because of PRIVILEGE
Browse files Browse the repository at this point in the history
  • Loading branch information
TuEmb committed Sep 12, 2024
1 parent 19340e1 commit c1731d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/event_handler/can_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct CanHandler<'a> {
pub iface: UsbCanSocket,
pub ui_handle: &'a Weak<AppWindow>,
pub mspc_rx: &'a Arc<Mutex<Receiver<DBC>>>,
pub bitrate: u32,
}

static mut NEW_DBC_CHECK: bool = false;
Expand All @@ -39,7 +38,6 @@ impl<'a> CanHandler<'a> {
{
let can_socket = self.open_can_socket();
let can_if = CanInterface::open(self.iface).unwrap();
let _ = can_if.set_bitrate(self.bitrate, 700);
self.process_ui_events(dbc, can_socket, can_if);
}
#[cfg(target_os = "windows")]
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ async fn main() -> io::Result<()> {
iface: &can_if,
ui_handle: &ui_handle,
mspc_rx: &rx,
bitrate: 250000,
};
loop {
can_handler.process_can_messages();
Expand Down
2 changes: 1 addition & 1 deletion ui/app.slint
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export component AppWindow inherits Window {
out: init_string;
can_sockets: can_sockets;
start(name, index) => {
start(name, index)
start(name, index);
}
}

Expand Down
8 changes: 7 additions & 1 deletion ui/init_page.slint
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export component initPage inherits Rectangle {
background: #1a1f2b;
in property <socket_info> can_sockets;
in property <string> out: "Please select CAN device to start";
callback start(string, int);
callback start(string /* name */, int /* index */);
VerticalLayout {
Rectangle {}
Text {
Expand All @@ -31,6 +31,12 @@ export component initPage inherits Rectangle {
current-value: can_sockets.name[0];
}
}
// bitrate_box := ComboBox {
// model: ["1 Mbit/s", "800 kbit/s", "500 kbit/s", "250 kbit/s", "200 kbit/s", "125 kbit/s",
// "100 kbit/s", "95.238 kbit/s", "83.333 kbit/s", "50 kbit/s", "47.619 kbit/s",
// "40 kbit/s", "33.333 kbit/s", "20 kbit/s", "10 kbit/s", "5 kbit/s"];
// current-value: "250 kbit/s";
// }
Button {
text: "start";
clicked => {
Expand Down

0 comments on commit c1731d4

Please sign in to comment.