Skip to content

Commit aa76c69

Browse files
authored
Try #452:
2 parents 2dfaa8d + 239ae71 commit aa76c69

8 files changed

Lines changed: 52 additions & 31 deletions

File tree

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
3+
mosquitto.conf text eol=lf

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
2-
/dsp/target
2+
/dsp/target
3+
vpy/

book/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ cargo install mdbook-linkcheck
99
```
1010

1111
To build the user manual locally, build docs for the firmware, copy them into the book source
12-
directory, and then sere the book:
12+
directory, and then serve the book:
1313
```
14-
cargo doc --no-deps -p miniconf -p stabilizer -p dsp -p ad9959
14+
cargo doc --no-deps -p miniconf -p stabilizer -p idsp -p ad9959
1515
mv target/thumbv7em-none-eabihf/doc book/src/firmware
1616
cd book
1717
mdbook serve

book/src/getting-started.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,21 @@ desired application.
2121
```bash
2222
git clone https://github.com/quartiq/stabilizer
2323
```
24-
1. Get [rustup](https://rustup.rs/)
24+
2. Get [rustup](https://rustup.rs/)
2525
* The minimum supported Rust version (MSRV) is 1.52.0
26-
1. Install target support
26+
27+
3. Install target support
2728
```bash
2829
rustup target add thumbv7em-none-eabihf
2930
```
30-
1. Build Firmware with an optionally-specified MQTT broker IP.
31+
4. Build Firmware with an optionally-specified MQTT broker IP.
3132
```bash
33+
# Bash
3234
BROKER="10.34.16.10" cargo build --release
35+
36+
# Powershell
37+
# Note: This sets the broker for all future builds as well.
38+
$env:BROKER='10.34.16.10'; cargo build --release
3339
```
3440

3541
## Uploading Firmware
@@ -51,12 +57,16 @@ cargo install cargo-binutils
5157
rustup component add llvm-tools-preview
5258
```
5359

54-
1. Generate the binary file
60+
2. Generate the binary file
5561
```bash
56-
cargo objcopy --release --bin dual-iir -- -O binary dual-iir.bin`
62+
# Bash
63+
BROKER="10.34.16.10" cargo objcopy --release --bin dual-iir -- -O binary dual-iir.bin
64+
65+
# Powershell
66+
$env:BROKER='10.34.16.10'; cargo objcopy --release --bin dual-iir -- -O binary dual-iir.bin
5767
```
5868

59-
1. Copy `dual-iir.bin` into the ST-Link drive on your computer.
69+
3. Copy `dual-iir.bin` into the ST-Link drive on your computer.
6070

6171

6272
### Alternative: Using USB
@@ -82,11 +92,15 @@ For an interactive flash experience with live logging, utilize `probe-run` as fo
8292
```bash
8393
cargo install probe-run
8494
```
85-
1. Build and run firmware on the device
95+
2. Build and run firmware on the device
8696
```bash
87-
cargo run --release --bin dual-iir
97+
# Bash
98+
BROKER="10.34.16.10" cargo run --release --bin dual-iir
99+
100+
# Powershell
101+
$Env:BROKER='10.34.16.10'; cargo run --release --bin dual-iir
88102
```
89-
1. When using debug (non `--release`) mode, decrease the sampling frequency significantly.
103+
3. When using debug (non `--release`) mode, decrease the sampling frequency significantly.
90104
The added error checking code and missing optimizations may lead to the code
91105
missing deadlines and panicing.
92106

@@ -105,12 +119,13 @@ Stabilizer utilizes a static IP address for broker configuration. Ensure the IP
105119
We recommend running Mosquitto through [Docker](https://docker.com) to easily run Mosquitto on
106120
Windows, Linux, and OSX. After docker has been installed, run the following command from
107121
the `stabilizer` repository:
108-
```
122+
```bash
123+
# Bash
109124
docker run -p 1883:1883 --name mosquitto -v `pwd`/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /mosquitto/data -v /mosquitto/log eclipse-mosquitto:2
110-
```
111125

112-
> _Note_: The above command assumes a bash shell. If using powershell, replace `` `pwd` `` with
113-
> `${pwd}`
126+
# Powershell
127+
docker run -p 1883:1883 --name mosquitto -v ${pwd}/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /mosquitto/data -v /mosquitto/log eclipse-mosquitto:2
128+
```
114129

115130
This command will create a container named `mosquitto` that can be stopped and started easily via
116131
docker.

book/src/usage.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ Settings are specific to an application. If two identical settings exist for two
1313
applications, each application maintains its own independent value.
1414

1515
## Installation
16-
Install the Miniconf configuration utilities:
16+
Install the Miniconf configuration utilities using a virtual environment:
1717
```
18-
python -m pip install git+https://github.com/quartiq/miniconf#subdirectory=miniconf-py
18+
python -m venv --system-site-packages vpy
19+
./vpy/Scripts/pip install -r scripts/requirements.txt
1920
```
2021

2122
To use `miniconf`, execute it as follows:
2223
```
23-
python -m miniconf --help
24+
./vpy/Scripts/python -m miniconf --help
2425
```
2526

2627
Miniconf also exposes a programmatic Python API, so it's possible to write automation scripting of
@@ -40,7 +41,7 @@ used:
4041
* `value` = `{"ip": [192, 168, 0, 1], "port": 4000}`
4142

4243
```
43-
python -m miniconf --broker 10.34.16.10 dt/sinara/dual-iir/00-11-22-33-44-55 stream_target='{"ip": [10, 34, 16, 123], "port": 4000}'
44+
./vpy/Scripts/python -m miniconf --broker 10.34.16.10 dt/sinara/dual-iir/00-11-22-33-44-55 stream_target='{"ip": [10, 34, 16, 123], "port": 4000}'
4445
4546
Where `10.34.16.10` is the MQTT broker address that matches the one configured in the source code and `10.34.16.123` and `4000` are the desire stream target IP and port.
4647
```

hitl/run.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111
set -eux
1212

1313
# Set up python for testing
14-
python3 -m venv --system-site-packages py-venv
15-
. py-venv/bin/activate
14+
python3 -m venv --system-site-packages vpy
1615

17-
# Install Miniconf utilities for configuring stabilizer.
18-
python3 -m pip install -e py/
19-
python3 -m pip install git+https://github.com/quartiq/miniconf#subdirectory=py/miniconf-mqtt
20-
python3 -m pip install gmqtt
16+
# Install Miniconf and other utilities for configuring stabilizer.
17+
./vpy/Scripts/pip install -r scripts/requirements.txt
2118

2219
cargo flash --chip STM32H743ZITx --elf target/thumbv7em-none-eabihf/release/dual-iir
2320

@@ -31,12 +28,12 @@ sleep 30
3128
ping -c 5 -w 20 stabilizer-hitl
3229

3330
# Test the MQTT interface.
34-
python3 -m miniconf dt/sinara/dual-iir/04-91-62-d9-7e-5f afe/0='"G2"'
35-
python3 -m miniconf dt/sinara/dual-iir/04-91-62-d9-7e-5f afe/0='"G1"' iir_ch/0/0=\
31+
./vpy/Scripts/python -m miniconf dt/sinara/dual-iir/04-91-62-d9-7e-5f afe/0='"G2"'
32+
./vpy/Scripts/python -m miniconf dt/sinara/dual-iir/04-91-62-d9-7e-5f afe/0='"G1"' iir_ch/0/0=\
3633
'{"y_min": -32767, "y_max": 32767, "y_offset": 0, "ba": [1.0, 0, 0, 0, 0]}'
3734

3835
# Test the ADC/DACs connected via loopback.
39-
python3 hitl/loopback.py dt/sinara/dual-iir/04-91-62-d9-7e-5f
36+
./vpy/Scripts/python hitl/loopback.py dt/sinara/dual-iir/04-91-62-d9-7e-5f
4037

4138
# Test the livestream capabilities
42-
python3 hitl/streaming.py dt/sinara/dual-iir/04-91-62-d9-7e-5f
39+
./vpy/Scripts/python hitl/streaming.py dt/sinara/dual-iir/04-91-62-d9-7e-5f

py/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from setuptools import setup
1+
from setuptools import setup, find_packages
22

33
setup(name='stabilizer',
4+
packages=find_packages(),
45
version='0.1',
56
description='Stabilizer Utilities',
67
author='QUARTIQ GmbH',

scripts/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
py/
2+
git+https://github.com/quartiq/miniconf#subdirectory=py/miniconf-mqtt
3+
gmqtt

0 commit comments

Comments
 (0)