Skip to content

Commit 4736165

Browse files
committed
Revert "only use one clone"
This reverts commit 270b296.
1 parent b1c21c5 commit 4736165

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/main.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,19 @@ fn main_thread(
9696
sync_tx.send(true).expect("unable to send sync tx");
9797
data.raw_traffic.push(packet.clone());
9898

99-
let text = console_text(show_timestamps, show_sent_cmds, &packet);
99+
if let Some(text) = console_text(show_timestamps, show_sent_cmds, &packet) {
100+
// append prints
101+
if let Ok(mut gui_data) = data_lock.write() {
102+
gui_data.prints.push(text);
103+
}
104+
}
100105

101106
let split_data = split(&packet.payload);
102107
if data.dataset.is_empty() || failed_format_counter > 10 {
103108
// resetting dataset
104109
data.time = vec![];
105110
data.dataset = vec![vec![]; max(split_data.len(), 1)];
106111
if let Ok(mut gui_data) = data_lock.write() {
107-
// append prints
108-
if let Some(text) = text {
109-
gui_data.prints.push(text);
110-
}
111112
gui_data.plots = (0..max(split_data.len(), 1))
112113
.map(|i| (format!("Column {i}"), vec![]))
113114
.collect();
@@ -126,10 +127,6 @@ fn main_thread(
126127

127128
// appending data for GUI thread
128129
if let Ok(mut gui_data) = data_lock.write() {
129-
// append prints
130-
if let Some(text) = text {
131-
gui_data.prints.push(text);
132-
}
133130
// append plot-points
134131
for ((_label, graph), data_i) in
135132
gui_data.plots.iter_mut().zip(&data.dataset)
@@ -258,7 +255,7 @@ fn main_thread(
258255
}
259256
}
260257
}
261-
default(Duration::from_millis(1)) => {
258+
default(Duration::from_millis(10)) => {
262259
// occasionally push data to GUI
263260
}
264261
}

0 commit comments

Comments
 (0)