diff --git a/Cargo.lock b/Cargo.lock index 0999288..b0cb459 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -199,9 +199,8 @@ dependencies = [ ] [[package]] -name = "derive_stringset" +name = "derive_miniconf" version = "0.1.0" -source = "git+https://github.com/quartiq/miniconf.git?branch=develop#97ace3d8268075235cb67a2a8740d200bea1fe30" dependencies = [ "proc-macro2", "quote", @@ -402,9 +401,8 @@ dependencies = [ [[package]] name = "miniconf" version = "0.1.0" -source = "git+https://github.com/quartiq/miniconf.git?branch=develop#97ace3d8268075235cb67a2a8740d200bea1fe30" dependencies = [ - "derive_stringset", + "derive_miniconf", "heapless", "minimq", "serde", diff --git a/Cargo.toml b/Cargo.toml index f384fe9..4160253 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,8 +49,7 @@ miniconf = "0.1" generic-array = "0.14" [patch.crates-io.miniconf] -git = "https://github.com/quartiq/miniconf.git" -branch = "develop" +path = "../miniconf/" [patch.crates-io.serde-json-core] git = "https://github.com/rust-embedded-community/serde-json-core.git" diff --git a/dsp/src/iir.rs b/dsp/src/iir.rs index d323a6c..ee9639e 100644 --- a/dsp/src/iir.rs +++ b/dsp/src/iir.rs @@ -1,4 +1,4 @@ -use miniconf::StringSet; +use miniconf::MiniconfAtomic; use serde::Deserialize; use super::{abs, copysign, macc, max, min}; @@ -39,7 +39,7 @@ pub type Vec5 = [f32; 5]; /// Therefore it can trivially implement bump-less transfer. /// * Cascading multiple IIR filters allows stable and robust /// implementation of transfer functions beyond bequadratic terms. -#[derive(Copy, Clone, Debug, Default, Deserialize, StringSet)] +#[derive(Copy, Clone, Debug, Default, Deserialize, MiniconfAtomic)] pub struct IIR { pub ba: Vec5, pub y_offset: f32, diff --git a/dsp/src/iir_int.rs b/dsp/src/iir_int.rs index ef0c1dc..5ac75f5 100644 --- a/dsp/src/iir_int.rs +++ b/dsp/src/iir_int.rs @@ -1,6 +1,6 @@ use super::tools::macc_i32; use core::f64::consts::PI; -use miniconf::StringSet; +use miniconf::MiniconfAtomic; use serde::Deserialize; /// Generic vector for integer IIR filter. @@ -46,7 +46,7 @@ impl Coeff for Vec5 { /// See `dsp::iir::IIR` for general implementation details. /// Offset and limiting disabled to suit lowpass applications. /// Coefficient scaling fixed and optimized. -#[derive(Copy, Clone, Default, Debug, StringSet, Deserialize)] +#[derive(Copy, Clone, Default, Debug, MiniconfAtomic, Deserialize)] pub struct IIR { pub ba: Vec5, // pub y_offset: i32, diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs index a2279d8..9b6b24f 100644 --- a/src/bin/dual-iir.rs +++ b/src/bin/dual-iir.rs @@ -8,7 +8,7 @@ use stabilizer::hardware; use miniconf::{ embedded_nal::{IpAddr, Ipv4Addr}, - minimq, MqttInterface, StringSet, + minimq, Miniconf, MqttInterface, }; use serde::Deserialize; @@ -23,7 +23,7 @@ const SCALE: f32 = i16::MAX as _; // The number of cascaded IIR biquads per channel. Select 1 or 2! const IIR_CASCADE_LENGTH: usize = 1; -#[derive(Debug, Deserialize, StringSet)] +#[derive(Debug, Deserialize, Miniconf)] pub struct Settings { afe: [AfeGain; 2], iir_ch: [[iir::IIR; IIR_CASCADE_LENGTH]; 2], @@ -143,23 +143,15 @@ const APP: () = { let clock = c.resources.clock; loop { - let sleep = c.resources.mqtt_interface.lock(|interface| { + let _sleep = c.resources.mqtt_interface.lock(|interface| { !interface.network_stack().poll(clock.current_ms()) }); - match c - .resources + if c.resources .mqtt_interface .lock(|interface| interface.update().unwrap()) { - miniconf::Action::Continue => { - if sleep { - cortex_m::asm::wfi(); - } - } - miniconf::Action::CommitSettings => { - c.spawn.settings_update().unwrap() - } + c.spawn.settings_update().unwrap() } } } diff --git a/src/hardware/afe.rs b/src/hardware/afe.rs index 8ce1bd1..9e3674b 100644 --- a/src/hardware/afe.rs +++ b/src/hardware/afe.rs @@ -1,11 +1,11 @@ -use miniconf::StringSet; +use miniconf::Miniconf; use serde::{Deserialize, Serialize}; use core::convert::TryFrom; use enum_iterator::IntoEnumIterator; #[derive( - Copy, Clone, Debug, Serialize, Deserialize, IntoEnumIterator, StringSet, + Copy, Clone, Debug, Serialize, Deserialize, IntoEnumIterator, Miniconf, )] pub enum Gain { G1 = 0b00,