From adfa4f5fa3ccc13fa24f18160bd38e7ce7d395e5 Mon Sep 17 00:00:00 2001 From: linuswck Date: Mon, 4 Mar 2024 15:38:55 +0800 Subject: [PATCH] Move TempAdcFilter struct def to Thermostat --- src/net/cmd_handler.rs | 11 +---------- src/thermostat/thermostat.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/net/cmd_handler.rs b/src/net/cmd_handler.rs index 5ade379..6826d52 100644 --- a/src/net/cmd_handler.rs +++ b/src/net/cmd_handler.rs @@ -13,7 +13,7 @@ use crate::{laser_diode::{laser_diode::{ pd_responsitivity::ResponsitivityUnit }, net::net, - thermostat::{ad7172::{FilterType, PostFilter, SingleChODR}, thermostat::StatusReport as TecStatusReport} + thermostat::{ad7172::FilterType, thermostat::{StatusReport as TecStatusReport, TempAdcFilter}} }; use crate::thermostat::thermostat::{Thermostat, ThermostatSettingsSummary}; use crate::thermostat::pid_state::PidSettings::*; @@ -97,15 +97,6 @@ pub struct Cmd { json: CmdJsonObj } -#[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)] -pub struct TempAdcFilter{ - filter_type: FilterType, - sinc5sinc1odr: Option, - sinc3odr: Option, - sinc5sinc1postfilter: Option, - sinc3fineodr: Option -} - #[derive(Deserialize, Serialize, Copy, Clone, Debug, Tree)] pub struct StatusReport { ts: u32, diff --git a/src/thermostat/thermostat.rs b/src/thermostat/thermostat.rs index 7b761b8..3942258 100644 --- a/src/thermostat/thermostat.rs +++ b/src/thermostat/thermostat.rs @@ -3,7 +3,7 @@ use core::marker::PhantomData; use crate::sys_timer; use crate::thermostat::ad5680; use crate::thermostat::max1968::{MAX1968, AdcReadTarget, PwmPinsEnum}; -use crate::thermostat::ad7172; +use crate::thermostat::ad7172::{self, FilterType, PostFilter, SingleChODR}; use crate::thermostat::pid_state::{PidState, PidSettings, Parameters as PidParams}; use crate::thermostat::temp_mon::{TempMon, TempStatus, TempMonSettings}; use serde::{Deserialize, Serialize}; @@ -26,6 +26,17 @@ pub const R_SENSE: ElectricalResistance = ElectricalResistance { value: 0.05, }; +#[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)] +pub struct TempAdcFilter{ + pub filter_type: FilterType, + pub sinc5sinc1odr: Option, + pub sinc3odr: Option, + pub sinc5sinc1postfilter: Option, + pub sinc3fineodr: Option, + pub rate: Option, +} + + #[derive(Deserialize, Serialize, Clone, Copy, Debug, Tree)] pub struct TecSettings { pub pwr_on: bool,