Skip to content

Commit 11fa672

Browse files
authored
Merge pull request #116 from hacknus/fix-sample-rate-issue
Fix sample rate issue
2 parents 93c5419 + be3f696 commit 11fa672

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ All notable changes to the `Serial Monitor` crate will be documented in this fil
44

55
# Unreleased 0.3.x
66

7+
* Fixed sample rate issue
78
* ...
89

9-
# Unreleased 0.3.4
10+
# 0.3.4
1011

1112
* implement option to self-update the application
1213

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ simultaneously.
1313

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

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

src/gui.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,7 @@ impl MyApp {
332332
}
333333

334334
if self.data.loaded_from_file && self.file_opened {
335-
if let Ok(labels) =
336-
self.load_names_rx.recv_timeout(Duration::from_millis(10))
337-
{
335+
if let Ok(labels) = self.load_names_rx.try_recv() {
338336
self.labels = labels;
339337
self.colors = (0..max(self.labels.len(), 1))
340338
.map(|i| COLORS[i % COLORS.len()])

src/main.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::cmp::max;
99
use std::path::PathBuf;
1010
use std::sync::mpsc::{Receiver, Sender};
1111
use std::sync::{mpsc, Arc, RwLock};
12-
use std::time::Duration;
1312
use std::{env, thread};
1413

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

6766
loop {
68-
if let Ok(cl) = clear_rx.recv_timeout(Duration::from_millis(1)) {
67+
if let Ok(cl) = clear_rx.try_recv() {
6968
if cl {
7069
data = DataContainer::default();
7170
failed_format_counter = 0;
7271
}
7372
}
7473
if !file_opened {
75-
if let Ok(packet) = raw_data_rx.recv_timeout(Duration::from_millis(1)) {
74+
if let Ok(packet) = raw_data_rx.try_recv() {
7675
data.loaded_from_file = false;
7776
if !packet.payload.is_empty() {
7877
sync_tx.send(true).expect("unable to send sync tx");
@@ -104,7 +103,7 @@ fn main_thread(
104103
}
105104
}
106105
}
107-
if let Ok(fp) = load_rx.recv_timeout(Duration::from_millis(10)) {
106+
if let Ok(fp) = load_rx.try_recv() {
108107
if let Some(file_ending) = fp.extension() {
109108
match file_ending.to_str().unwrap() {
110109
"csv" => {
@@ -145,7 +144,7 @@ fn main_thread(
145144
*write_guard = data.clone();
146145
}
147146

148-
if let Ok(csv_options) = save_rx.recv_timeout(Duration::from_millis(1)) {
147+
if let Ok(csv_options) = save_rx.try_recv() {
149148
match save_to_csv(&data, &csv_options) {
150149
Ok(_) => {
151150
log::info!("saved data file to {:?} ", csv_options.file_path);

0 commit comments

Comments
 (0)