Skip to content

Commit

Permalink
Merge pull request #872 from quartiq/feature/shared-settings
Browse files Browse the repository at this point in the history
Refactoring application to share a singular settings structure
  • Loading branch information
jordens authored Apr 5, 2024
2 parents fd4569c + b9c5bbe commit 0a43f56
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 210 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ console.
### Changed
* Broker is no longer configured at compile time, but is maintained in device memory
* MSRV bumped to v1.66
* The static IP of stabilizer can no longer be configured at compilation time, but now uses device
memory storage instead. It is now configured via the USB port.
* The IIR (biquad) filter used for PID action has changed its serialization format.
See also the `iir_coefficients` Python CLI implementation.
* Bumped MSRV 1.66.0 -> 1.66.1
Expand Down
12 changes: 5 additions & 7 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ minimq = "0.8.0"
usb-device = "0.3.2"
usbd-serial = "0.2"
# Keep this synced with the miniconf version in py/setup.py
miniconf = "0.9.0"
miniconf = "0.9"
tca9539 = "0.2"
smoltcp-nal = { version = "0.4.1", features = ["shared-stack"]}
bbqueue = "0.5"
Expand All @@ -90,6 +90,9 @@ features = ["stm32h743v", "rt", "ethernet", "xspi", "usb_hs"]
git = "https://github.com/rust-embedded-community/usbd-serial"
rev = "ccff77578925942e40e0a2c7b6d397ad164fdedb"

[patch.crates-io.miniconf]
git = "https://github.com/quartiq/miniconf"

[features]
nightly = []
pounder_v1_0 = []
Expand Down
15 changes: 3 additions & 12 deletions book/src/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,10 @@ python -m serial <port>
```

Once you have opened the port, you can use the provided menu to update any of Stabilizers runtime
settings. All settings configured via the USB interface are only applied when Stabilizer first boots
up. Any modifications that occur after boot over the MQTT interface will occur after the initial
settings configured via USB.
settings.

> **Note:** Settings configured via USB do not take immediat effect. Instead, they will apply after
> the device is rebooted.
> **Note:** Settings configured via USB are only initial settings. Any modifications
> that occur after startup (i.e. via MQTT) will take precedent over those configured via USB. MQTT
> settings can only be persisted or retained via the MQTT broker.
> **Note:** Saving settings via the USB port only saves the initial settings. It does not take into
> account the current operational settings that may have been applied via MQTT.
> **Note:** Network settings configured via USB do not take immediate effect. Instead, they will
> apply after the device is rebooted.
## Network and DHCP

Expand Down
9 changes: 7 additions & 2 deletions book/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@


# Miniconf Run-time Settings
Stabilizer supports run-time settings configuration using MQTT.
Stabilizer supports run-time settings configuration using MQTT or the USB port.

Settings can be stored in the MQTT broker so that they are automatically applied whenever
Stabilizer reboots and connects. This is referred to as "retained" settings. Broker implementations
may optionally store these retained settings as well such that they will be reapplied between
restarts of the MQTT broker.

Stabilizer also supports storing run time settings on the device. Any configurations saved to
stabilizer via the USB port will be automatically reapplied when Stabilizer reboots.
MQTT settings retained on the broker or settings published after the device has connected to the broker override the settings saved on Stabilizer.

Settings are specific to a device. Any settings configured for one Stabilizer will not be applied
to another. Disambiguation of devices is done by using Stabilizer's MAC address.
to another. Disambiguation of devices is done by using Stabilizer's MQTT identifier, which is
defaulted to Stabilizer's MAC address.

Settings are specific to an application. If two identical settings exist for two different
applications, each application maintains its own independent value.
Expand Down
3 changes: 2 additions & 1 deletion serial-settings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ edition = "2021"

[dependencies]
miniconf = "0.9"
menu = {version = "0.4", features = ["echo"]}

menu = {git = "https://github.com/rust-embedded-community/menu", rev = "7ba884993fea57c3661d0f9d7c3cdca639a48701", features = ["echo"]}
heapless = "0.8"
embedded-io = "0.6"
yafnv = "0.1"
Loading

0 comments on commit 0a43f56

Please sign in to comment.