update for fh5-common changes

This commit is contained in:
Alex Janka 2022-08-10 09:59:27 +10:00
parent 536cdd9ba2
commit 20ac7ccf95
3 changed files with 8 additions and 9 deletions

1
Cargo.lock generated
View file

@ -130,6 +130,7 @@ dependencies = [
name = "fh5-common" name = "fh5-common"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"chrono",
"serde", "serde",
] ]

@ -1 +1 @@
Subproject commit 5c51da0747206cc8e404fc566a95b5befa94911c Subproject commit 9ac07ca5051e8ed5dce86b2363721823732dff83

View file

@ -1,4 +1,4 @@
use fh5_common::Telemetry; use fh5_common::{Filename, Telemetry};
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::net::UdpSocket; use std::net::UdpSocket;
@ -111,15 +111,13 @@ fn main() {
} }
// open file for this race // open file for this race
// filename format: timestamp _ car class _ car ordinal // filename format: timestamp _ car class _ car ordinal
let name = Filename::new_filename(
deserialised.car_performance_index,
deserialised.car_ordinal,
);
writer = csv::Writer::from_writer( writer = csv::Writer::from_writer(
options options
.open(folder_path.join(format!( .open(folder_path.join(format!("{}{}", name.get_string(), ".csv",)))
"{}_{}_{}{}",
&Local::now().format("%Y-%m-%d_%H-%M").to_string(),
deserialised.car_performance_index,
deserialised.car_ordinal,
".csv",
)))
.expect("couldnt open file"), .expect("couldnt open file"),
); );
} else { } else {