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]]
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",

View File

@ -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"

View File

@ -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,

View File

@ -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,

View File

@ -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,26 +143,18 @@ 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()
}
}
}
}
#[task(priority = 1, resources=[mqtt_interface, afes, iir_ch])]
fn settings_update(mut c: settings_update::Context) {

View File

@ -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,