Skip to content

Commit

Permalink
Try to increment files for telemetry
Browse files Browse the repository at this point in the history
Raspberry doesn't have access to internet and so can't NTP itself. Thus
it stays at the same time at each reboot making the telemetry recording
overwrite eachother.
  • Loading branch information
BlackYoup committed Jun 12, 2020
1 parent e197a1b commit 704850f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ plotters = {version = "0.2.12", default_features = false, features = ["image_enc
conrod_glium = "0.69"
conrod_winit = "0.69"
conrod_core = "0.69"
makair-telemetry = { git = "https://github.com/makers-for-life/makair-telemetry", features = ["env_logger"], rev = "dc21d8165061d60522da27c95adcc7cba7a84a94" }
makair-telemetry = { git = "https://github.com/makers-for-life/makair-telemetry", features = ["env_logger"], rev = "aa08cc7814cc4076f653951900e34c7d76cf814f" }
rn2903 = { git = "https://github.com/waxzce/lora-rust-rn2903-rn2483.git", rev = "b086057ba096920abef3870ad0cefa2c80a343e2", optional = true }
sysfs_gpio = { version = "0.5", optional = true }

Expand Down
7 changes: 5 additions & 2 deletions src/display/drawer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,13 @@ impl<'a> DisplayDrawer<'a> {
match &APP_ARGS.mode {
crate::Mode::Port { port, output_dir } => {
let optional_file_buffer = output_dir.as_ref().map(|dir| {
let file_count: Vec<std::io::Result<std::fs::DirEntry>> =
std::fs::read_dir(dir).expect("Should read dir").collect();
let path = format!(
"{}/{}.record",
"{}/{}-{}.record",
&dir,
chrono::Local::now().format("%Y%m%d-%H%M%S")
chrono::Local::now().format("%Y%m%d-%H%M%S"),
file_count.len() + 1
);
let file = std::fs::File::create(&path)
.unwrap_or_else(|_| panic!("could not create file '{}'", &path));
Expand Down

0 comments on commit 704850f

Please sign in to comment.