Updating miniconf dependencies

This commit is contained in:
Ryan Summers 2021-03-01 14:46:12 +01:00
parent 46fb62e802
commit c553e72df4
6 changed files with 14 additions and 25 deletions

6
Cargo.lock generated
View File

@ -199,9 +199,8 @@ dependencies = [
] ]
[[package]] [[package]]
name = "derive_stringset" name = "derive_miniconf"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/quartiq/miniconf.git?branch=develop#97ace3d8268075235cb67a2a8740d200bea1fe30"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -402,9 +401,8 @@ dependencies = [
[[package]] [[package]]
name = "miniconf" name = "miniconf"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/quartiq/miniconf.git?branch=develop#97ace3d8268075235cb67a2a8740d200bea1fe30"
dependencies = [ dependencies = [
"derive_stringset", "derive_miniconf",
"heapless", "heapless",
"minimq", "minimq",
"serde", "serde",

View File

@ -49,8 +49,7 @@ miniconf = "0.1"
generic-array = "0.14" generic-array = "0.14"
[patch.crates-io.miniconf] [patch.crates-io.miniconf]
git = "https://github.com/quartiq/miniconf.git" path = "../miniconf/"
branch = "develop"
[patch.crates-io.serde-json-core] [patch.crates-io.serde-json-core]
git = "https://github.com/rust-embedded-community/serde-json-core.git" git = "https://github.com/rust-embedded-community/serde-json-core.git"

View File

@ -1,4 +1,4 @@
use miniconf::StringSet; use miniconf::MiniconfAtomic;
use serde::Deserialize; use serde::Deserialize;
use super::{abs, copysign, macc, max, min}; use super::{abs, copysign, macc, max, min};
@ -39,7 +39,7 @@ pub type Vec5 = [f32; 5];
/// Therefore it can trivially implement bump-less transfer. /// Therefore it can trivially implement bump-less transfer.
/// * Cascading multiple IIR filters allows stable and robust /// * Cascading multiple IIR filters allows stable and robust
/// implementation of transfer functions beyond bequadratic terms. /// 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 struct IIR {
pub ba: Vec5, pub ba: Vec5,
pub y_offset: f32, pub y_offset: f32,

View File

@ -1,6 +1,6 @@
use super::tools::macc_i32; use super::tools::macc_i32;
use core::f64::consts::PI; use core::f64::consts::PI;
use miniconf::StringSet; use miniconf::MiniconfAtomic;
use serde::Deserialize; use serde::Deserialize;
/// Generic vector for integer IIR filter. /// Generic vector for integer IIR filter.
@ -46,7 +46,7 @@ impl Coeff for Vec5 {
/// See `dsp::iir::IIR` for general implementation details. /// See `dsp::iir::IIR` for general implementation details.
/// Offset and limiting disabled to suit lowpass applications. /// Offset and limiting disabled to suit lowpass applications.
/// Coefficient scaling fixed and optimized. /// Coefficient scaling fixed and optimized.
#[derive(Copy, Clone, Default, Debug, StringSet, Deserialize)] #[derive(Copy, Clone, Default, Debug, MiniconfAtomic, Deserialize)]
pub struct IIR { pub struct IIR {
pub ba: Vec5, pub ba: Vec5,
// pub y_offset: i32, // pub y_offset: i32,

View File

@ -8,7 +8,7 @@ use stabilizer::hardware;
use miniconf::{ use miniconf::{
embedded_nal::{IpAddr, Ipv4Addr}, embedded_nal::{IpAddr, Ipv4Addr},
minimq, MqttInterface, StringSet, minimq, Miniconf, MqttInterface,
}; };
use serde::Deserialize; 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! // The number of cascaded IIR biquads per channel. Select 1 or 2!
const IIR_CASCADE_LENGTH: usize = 1; const IIR_CASCADE_LENGTH: usize = 1;
#[derive(Debug, Deserialize, StringSet)] #[derive(Debug, Deserialize, Miniconf)]
pub struct Settings { pub struct Settings {
afe: [AfeGain; 2], afe: [AfeGain; 2],
iir_ch: [[iir::IIR; IIR_CASCADE_LENGTH]; 2], iir_ch: [[iir::IIR; IIR_CASCADE_LENGTH]; 2],
@ -143,23 +143,15 @@ const APP: () = {
let clock = c.resources.clock; let clock = c.resources.clock;
loop { loop {
let sleep = c.resources.mqtt_interface.lock(|interface| { let _sleep = c.resources.mqtt_interface.lock(|interface| {
!interface.network_stack().poll(clock.current_ms()) !interface.network_stack().poll(clock.current_ms())
}); });
match c if c.resources
.resources
.mqtt_interface .mqtt_interface
.lock(|interface| interface.update().unwrap()) .lock(|interface| interface.update().unwrap())
{ {
miniconf::Action::Continue => { c.spawn.settings_update().unwrap()
if sleep {
cortex_m::asm::wfi();
}
}
miniconf::Action::CommitSettings => {
c.spawn.settings_update().unwrap()
}
} }
} }
} }

View File

@ -1,11 +1,11 @@
use miniconf::StringSet; use miniconf::Miniconf;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use core::convert::TryFrom; use core::convert::TryFrom;
use enum_iterator::IntoEnumIterator; use enum_iterator::IntoEnumIterator;
#[derive( #[derive(
Copy, Clone, Debug, Serialize, Deserialize, IntoEnumIterator, StringSet, Copy, Clone, Debug, Serialize, Deserialize, IntoEnumIterator, Miniconf,
)] )]
pub enum Gain { pub enum Gain {
G1 = 0b00, G1 = 0b00,