diff --git a/src/main.rs b/src/main.rs index 06f99e4..ce36e86 100644 --- a/src/main.rs +++ b/src/main.rs @@ -627,6 +627,28 @@ const APP: () = { ], modifiable_attributes: [ + ("stabilizer/iir0/state", server::IirRequest, (|req: server::IirRequest| { + c.resources.iir_ch.lock(|iir_ch| { + if req.channel > 1 { + return Err(()); + } + + iir_ch[req.channel as usize] = req.iir; + + Ok::(req) + }) + })), + ("stabilizer/iir1/state", server::IirRequest, (|req: server::IirRequest| { + c.resources.iir_ch.lock(|iir_ch| { + if req.channel > 1 { + return Err(()); + } + + iir_ch[req.channel as usize] = req.iir; + + Ok::(req) + }) + })), ("stabilizer/afe0/gain", afe::Gain, (|gain| { Ok::<(), ()>(c.resources.afe0.set_gain(gain)) })), diff --git a/src/server.rs b/src/server.rs index c0e46cd..68edafe 100644 --- a/src/server.rs +++ b/src/server.rs @@ -18,6 +18,7 @@ use serde_json_core::{ }; use super::net; +use super::iir; #[derive(Deserialize, Serialize, Debug)] pub enum Request<'a, 'b> { @@ -25,6 +26,12 @@ pub enum Request<'a, 'b> { Write{attribute: &'a str, value: &'b str}, } +#[derive(Serialize, Deserialize)] +pub struct IirRequest { + pub channel: u8, + pub iir: iir::IIR, +} + #[derive(Serialize)] pub struct Response { code: i32,