@@ -6,7 +6,6 @@ extern crate preferences;
66extern crate serde;
77
88use std:: cmp:: max;
9- use std:: path:: PathBuf ;
109use std:: sync:: mpsc:: { Receiver , Sender } ;
1110use std:: sync:: { mpsc, Arc , RwLock } ;
1211use std:: thread;
@@ -17,7 +16,7 @@ use preferences::AppInfo;
1716
1817use crate :: data:: { DataContainer , Packet } ;
1918use crate :: gui:: { load_gui_settings, print_to_console, MyApp , Print , RIGHT_PANEL_WIDTH } ;
20- use crate :: io:: save_to_csv;
19+ use crate :: io:: { save_to_csv, FileOptions } ;
2120use crate :: serial:: { load_serial_settings, serial_thread, Device } ;
2221
2322mod data;
@@ -33,13 +32,6 @@ const APP_INFO: AppInfo = AppInfo {
3332const PREFS_KEY : & str = "config/gui" ;
3433const PREFS_KEY_SERIAL : & str = "config/serial_devices" ;
3534
36- /// A set of options for saving data to a CSV file.
37- #[ derive( Debug ) ]
38- pub struct CsvOptions {
39- file_path : PathBuf ,
40- save_absolute_time : bool ,
41- }
42-
4335fn split ( payload : & str ) -> Vec < f32 > {
4436 let mut split_data: Vec < & str > = vec ! [ ] ;
4537 for s in payload. split ( ':' ) {
@@ -57,7 +49,7 @@ fn main_thread(
5749 print_lock : Arc < RwLock < Vec < Print > > > ,
5850 raw_data_rx : Receiver < Packet > ,
5951 names_rx : Receiver < Vec < String > > ,
60- save_rx : Receiver < CsvOptions > ,
52+ save_rx : Receiver < FileOptions > ,
6153 clear_rx : Receiver < bool > ,
6254) {
6355 // reads data from mutex, samples and saves if needed
@@ -152,7 +144,7 @@ fn main() {
152144 let print_lock = Arc :: new ( RwLock :: new ( vec ! [ Print :: Empty ] ) ) ;
153145 let connected_lock = Arc :: new ( RwLock :: new ( false ) ) ;
154146
155- let ( save_tx, save_rx) : ( Sender < CsvOptions > , Receiver < CsvOptions > ) = mpsc:: channel ( ) ;
147+ let ( save_tx, save_rx) : ( Sender < FileOptions > , Receiver < FileOptions > ) = mpsc:: channel ( ) ;
156148 let ( send_tx, send_rx) : ( Sender < String > , Receiver < String > ) = mpsc:: channel ( ) ;
157149 let ( clear_tx, clear_rx) : ( Sender < bool > , Receiver < bool > ) = mpsc:: channel ( ) ;
158150 let ( names_tx, names_rx) : ( Sender < Vec < String > > , Receiver < Vec < String > > ) = mpsc:: channel ( ) ;
0 commit comments