Removing support for configuring IIR state

This commit is contained in:
Ryan Summers 2021-02-17 17:56:18 +01:00
parent a55b30e6c4
commit 63a2220fa0

View File

@ -26,8 +26,6 @@ const IIR_CASCADE_LENGTH: usize = 1;
#[derive(Debug, Deserialize, StringSet)] #[derive(Debug, Deserialize, StringSet)]
pub struct Settings { pub struct Settings {
afe: [AfeGain; 2], afe: [AfeGain; 2],
update_state: bool,
iir_state: [[iir::Vec5; IIR_CASCADE_LENGTH]; 2],
iir_ch: [[iir::IIR; IIR_CASCADE_LENGTH]; 2], iir_ch: [[iir::IIR; IIR_CASCADE_LENGTH]; 2],
} }
@ -35,8 +33,6 @@ impl Default for Settings {
fn default() -> Self { fn default() -> Self {
Self { Self {
afe: [AfeGain::G1, AfeGain::G1], afe: [AfeGain::G1, AfeGain::G1],
update_state: false,
iir_state: [[[0.; 5]; IIR_CASCADE_LENGTH]; 2],
iir_ch: [[iir::IIR::new(1., -SCALE, SCALE); IIR_CASCADE_LENGTH]; 2], iir_ch: [[iir::IIR::new(1., -SCALE, SCALE); IIR_CASCADE_LENGTH]; 2],
} }
} }
@ -168,18 +164,13 @@ const APP: () = {
} }
} }
#[task(priority = 1, resources=[mqtt_interface, afes, iir_ch, iir_state])] #[task(priority = 1, resources=[mqtt_interface, afes, iir_ch])]
fn settings_update(mut c: settings_update::Context) { fn settings_update(mut c: settings_update::Context) {
let settings = &c.resources.mqtt_interface.settings; let settings = &c.resources.mqtt_interface.settings;
// Update the IIR channels. // Update the IIR channels.
c.resources.iir_ch.lock(|iir| *iir = settings.iir_ch); c.resources.iir_ch.lock(|iir| *iir = settings.iir_ch);
// Update the IIR states only if explicitly requested.
if settings.update_state {
c.resources.iir_state.lock(|iir| *iir = settings.iir_state);
}
// Update AFEs // Update AFEs
c.resources.afes.0.set_gain(settings.afe[0]); c.resources.afes.0.set_gain(settings.afe[0]);
c.resources.afes.1.set_gain(settings.afe[1]); c.resources.afes.1.set_gain(settings.afe[1]);