-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from sunsided/feature/disk-dump
Add support for dumping data to disk
- Loading branch information
Showing
29 changed files
with
591 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.csv filter=lfs diff=lfs merge=lfs -text | ||
*.bin filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/target | ||
*.log | ||
*.raw | ||
*.gz |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,72 @@ | ||
use clap::Parser; | ||
use std::path::PathBuf; | ||
|
||
use clap::{Parser, Subcommand}; | ||
|
||
use crate::utils::version; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(author, version = version(), about)] | ||
#[command(propagate_version = true)] | ||
pub struct Cli { | ||
#[arg( | ||
global = true, | ||
short, | ||
long, | ||
value_name = "FLOAT", | ||
help = "Tick rate, i.e. number of ticks per second", | ||
default_value_t = 1.0 | ||
value_name = "PORT", | ||
help = "The port name", | ||
default_value = "/dev/ttyACM0" | ||
)] | ||
pub port: String, | ||
|
||
#[arg( | ||
global = true, | ||
short, | ||
long, | ||
value_name = "BAUD_RATE", | ||
help = "The baud rate", | ||
default_value_t = 1_000_000 | ||
)] | ||
pub tick_rate: f64, | ||
pub baud: u32, | ||
|
||
#[command(subcommand)] | ||
pub command: Commands, | ||
} | ||
|
||
#[derive(Subcommand, Debug)] | ||
pub enum Commands { | ||
Ui(UiCommand), | ||
Dump(Dump), | ||
} | ||
|
||
/// Runs a UI to visualize the incoming data stream. | ||
#[derive(Parser, Debug)] | ||
pub struct UiCommand { | ||
#[arg( | ||
short, | ||
long, | ||
value_name = "FLOAT", | ||
help = "Frame rate, i.e. number of frames per second", | ||
default_value_t = 60.0 | ||
default_value_t = 30.0 | ||
)] | ||
pub frame_rate: f64, | ||
} | ||
|
||
/// Dumps received data to disk. | ||
#[derive(Parser, Debug)] | ||
pub struct Dump { | ||
#[arg( | ||
short, | ||
long, | ||
value_name = "RAW_FILE", | ||
help = "The file in which to store raw data" | ||
)] | ||
pub raw: Option<PathBuf>, | ||
|
||
#[arg( | ||
short, | ||
long, | ||
value_name = "DIRECTORY", | ||
help = "The directory in which to store data" | ||
)] | ||
pub dir: PathBuf, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.