Add cmdline-flag handling.

For now, just interface settings for the stage control:

```
target/release/hostcontrol --help
Usage: hostcontrol [OPTIONS]

Options:
      --stage-device <STAGE_DEVICE>  Interface to talk to movement stage [default: /dev/ttyACM0]
      --tty-speed <TTY_SPEED>        Speed of the stage device (bps) [default: 115200]
  -h, --help                         Print help
  -V, --version                      Print version
```

Signed-off-by: Henner Zeller <h.zeller@acm.org>
This commit is contained in:
Henner Zeller 2026-03-08 08:35:36 +01:00
parent f65cc9236b
commit 7d8337bd5e
3 changed files with 63 additions and 1 deletions

View file

@ -1,10 +1,24 @@
use std::{thread::sleep, time::Duration};
use clap::Parser;
mod stage;
#[derive(clap::Parser, Debug)]
#[command(version, about, long_about = None)]
struct CliArgs {
/// Interface to talk to movement stage
#[arg(long, default_value="/dev/ttyACM0")]
stage_device: String,
/// Speed of the stage device (bps)
#[arg(long, default_value="115200")]
tty_speed: u32,
}
fn main() {
let args = CliArgs::parse();
env_logger::init();
let stage_io = stage::StageIO::new("/dev/ttyACM0", 115200).unwrap();
let stage_io = stage::StageIO::new(&args.stage_device, args.tty_speed).unwrap();
let mut s = stage::Stage::new(stage_io, 1.12).unwrap();
let origin = nalgebra::vector![3000.0, 0.0, -6000.0];
//println!("{}", s.version().unwrap());