Skip to content

Fix sample rate issue #116

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 4 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ All notable changes to the `Serial Monitor` crate will be documented in this fil

# Unreleased 0.3.x

* Fixed sample rate issue
* ...

# Unreleased 0.3.4
# 0.3.4

* implement option to self-update the application

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ simultaneously.

[Binary bundles](https://github.com/hacknus/serial-monitor-rust/releases) are available for Linux, macOS and Windows.

Running the apple silicon binary may result to the message "Serial Monitor is damaged and cannot be opened.", to get
Running the apple silicon binary (serial-monitor-aarch64-apple-darwin.app) may result to the message "Serial Monitor is
damaged and cannot be opened.", to get
around this you first need to run:
`xattr -rd com.apple.quarantine Serial\ Monitor.app`

Expand Down
4 changes: 1 addition & 3 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,7 @@ impl MyApp {
}

if self.data.loaded_from_file && self.file_opened {
if let Ok(labels) =
self.load_names_rx.recv_timeout(Duration::from_millis(10))
{
if let Ok(labels) = self.load_names_rx.try_recv() {
self.labels = labels;
self.colors = (0..max(self.labels.len(), 1))
.map(|i| COLORS[i % COLORS.len()])
Expand Down
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::cmp::max;
use std::path::PathBuf;
use std::sync::mpsc::{Receiver, Sender};
use std::sync::{mpsc, Arc, RwLock};
use std::time::Duration;
use std::{env, thread};

use crate::data::{DataContainer, Packet};
Expand Down Expand Up @@ -65,14 +64,14 @@ fn main_thread(
let mut file_opened = false;

loop {
if let Ok(cl) = clear_rx.recv_timeout(Duration::from_millis(1)) {
if let Ok(cl) = clear_rx.try_recv() {
if cl {
data = DataContainer::default();
failed_format_counter = 0;
}
}
if !file_opened {
if let Ok(packet) = raw_data_rx.recv_timeout(Duration::from_millis(1)) {
if let Ok(packet) = raw_data_rx.try_recv() {
data.loaded_from_file = false;
if !packet.payload.is_empty() {
sync_tx.send(true).expect("unable to send sync tx");
Expand Down Expand Up @@ -104,7 +103,7 @@ fn main_thread(
}
}
}
if let Ok(fp) = load_rx.recv_timeout(Duration::from_millis(10)) {
if let Ok(fp) = load_rx.try_recv() {
if let Some(file_ending) = fp.extension() {
match file_ending.to_str().unwrap() {
"csv" => {
Expand Down Expand Up @@ -145,7 +144,7 @@ fn main_thread(
*write_guard = data.clone();
}

if let Ok(csv_options) = save_rx.recv_timeout(Duration::from_millis(1)) {
if let Ok(csv_options) = save_rx.try_recv() {
match save_to_csv(&data, &csv_options) {
Ok(_) => {
log::info!("saved data file to {:?} ", csv_options.file_path);
Expand Down