From 291037945de3f4b696d93a0dde0f705bf2a025b6 Mon Sep 17 00:00:00 2001
From: Federico Lolli <federico.lolli@skywarder.eu>
Date: Thu, 21 Mar 2024 19:18:43 +0100
Subject: [PATCH] Updated README

---
 README.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 91 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index dbe01c9..a7697b9 100644
--- a/README.md
+++ b/README.md
@@ -19,10 +19,22 @@ In brief, ARPIST is a tool for simulating the transmission of telemetry data fro
 
 #### Host-side
 
-If you want to install ARPIST (host tool) on your machine, you can do it with the following command:
+If you want to install just ARPIST (host tool) on your machine, you can do it with the following command:
 
 ```bash
-cargo install --git ssh://git@git.skywarder.eu/federico.lolli/arpist.git
+cargo install -F tdl --git ssh://git@git.skywarder.eu/federico.lolli/arpist.git
+```
+
+If you plan instead to install also the board-side tool, you can clone first the repository:
+
+```bash
+git clone --recurse-submodules ssh://git@git.skywarder.eu/federico.lolli/arpist.git
+```
+
+And then install it with the following commands
+
+```bash
+cargo install -F tdl --path ./on-host
 ```
 
 #### Board-side
@@ -31,6 +43,11 @@ If you want to install ARPIST (board tool) on your board, you can do it with the
 
 ```bash
 git clone --recurse-submodules ssh://git@git.skywarder.eu/federico.lolli/arpist.git
+```
+
+Then you can move to the `on-device` directory and build it with the following command:
+
+```bash
 cd arpist/on-device
 ./sbs -f arpist-device-sender
 ```
@@ -76,18 +93,85 @@ To flash the sender, if you want to test on a receiver board, you can flash a du
 
 ARPIST needs a board with a radio module connected to a serial port to work. The board must have a specific entrypoint flashed _(please refer to the installation paragraph above for this)_.
 
-Once the board has the correct entrypoint flashed and is connected to the serial port, you can run ARPIST (host-side) with the following command (here we assume that the executable is in scope, if not, you can use the full path to the executable):
+Once the board has the correct entrypoint flashed and is connected to the serial port, you can run ARPIST (host-side) as follows, after installing it.
+
+The most common use case is to parse a CSV file containing telemetry data and send it to the board. You can do it with the following command:
 
 ```bash
-arpist --port <serial_port> <telemetry_file>
+arpist csv <telemetry_file>
 ```
 
-Where `<serial_port>` is the serial port where the board is connected and `<telemetry_file>` is the file containing the telemetry data to send to the board.
+**NOTE**: by default ARPIST will wait for a synchronization signal from the board before sending further data. If you want to disable this behavior, you can use the `--no-sync` option (or just the short `-n` flag).
+
+```bash
+arpist -n csv <telemetry_file>
+```
 
-To have a more detailed debug output, you can pass the environment variable `RUST_LOG` with the value `debug`:
+By adding the `--verbose` option (or just the short `-v` flag), you can enable the verbose mode, which will print the sent packets to the standard output.
 
 ```bash
-RUST_LOG=debug arpist --port <serial_port> <telemetry_file>
+arpist -v csv <telemetry_file>
 ```
 
 **NOTE**: if a single STM32 compatible board is connected to the serial port, ARPIST will automatically detect it and use it, so you can omit the `--port <serial_port>` option.
+
+### TDL Integration
+
+If you want to send telemetry data to the board from a TDL file, you can do it with the following command:
+
+```bash
+arpist tdl --lat <latitude> --lon <longitude> --alt <altitude> <tdl_file>
+```
+
+Keep in mind that the `--lat`, `--lon` and `--alt` options are mandatory and must be specified in order to send the telemetry data to the board with the correct initial GPS position fix.
+
+### Detailed Usage
+
+```
+Usage: arpist [OPTIONS] <COMMAND>
+
+Commands:
+  tdl   build mavlink packets from a TDL file
+  csv   parse mavlink packets from a CSV file
+  help  Print this message or the help of the given subcommand(s)
+
+Options:
+  -p, --port <PORT>            The serial port to use
+  -b, --baud-rate <BAUD_RATE>  baud rate [default: 115200]
+  -n, --no-sync                disable SYNC MODE (wait for a sync signal from the device before proceding)
+  -v, --verbose                The log level
+  -h, --help                   Print help
+```
+
+CSV and TDL commands have their own options and arguments:
+
+Here the CSV command usage:
+
+```
+parse mavlink packets from a CSV file
+
+Usage: arpist csv <CSV_FILE>
+
+Arguments:
+  <CSV_FILE>  The CSV file to read from
+
+Options:
+  -h, --help  Print help
+```
+
+And here the TDL command usage:
+
+```
+build mavlink packets from a TDL file
+
+Usage: arpist tdl --lat <LAT> --lon <LON> --alt <ALT> <TDL_FILE>
+
+Arguments:
+  <TDL_FILE>  The TDL file to read from
+
+Options:
+  -n, --lat <LAT>  initial GPS latitude
+  -e, --lon <LON>  initial GPS longitude
+  -u, --alt <ALT>  initial GPS altitude
+  -h, --help       Print help
+```
-- 
GitLab