Adding support for modifying IIR state
This commit is contained in:
parent
7cb18cf197
commit
df5dcb3dc1
22
src/main.rs
22
src/main.rs
|
@ -627,6 +627,28 @@ const APP: () = {
|
||||||
],
|
],
|
||||||
|
|
||||||
modifiable_attributes: [
|
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::<server::IirRequest, ()>(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::<server::IirRequest, ()>(req)
|
||||||
|
})
|
||||||
|
})),
|
||||||
("stabilizer/afe0/gain", afe::Gain, (|gain| {
|
("stabilizer/afe0/gain", afe::Gain, (|gain| {
|
||||||
Ok::<(), ()>(c.resources.afe0.set_gain(gain))
|
Ok::<(), ()>(c.resources.afe0.set_gain(gain))
|
||||||
})),
|
})),
|
||||||
|
|
|
@ -18,6 +18,7 @@ use serde_json_core::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::net;
|
use super::net;
|
||||||
|
use super::iir;
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
#[derive(Deserialize, Serialize, Debug)]
|
||||||
pub enum Request<'a, 'b> {
|
pub enum Request<'a, 'b> {
|
||||||
|
@ -25,6 +26,12 @@ pub enum Request<'a, 'b> {
|
||||||
Write{attribute: &'a str, value: &'b str},
|
Write{attribute: &'a str, value: &'b str},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct IirRequest {
|
||||||
|
pub channel: u8,
|
||||||
|
pub iir: iir::IIR,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct Response {
|
pub struct Response {
|
||||||
code: i32,
|
code: i32,
|
||||||
|
|
Loading…
Reference in New Issue