Move TempAdcFilter struct def to Thermostat

This commit is contained in:
linuswck 2024-03-04 15:38:55 +08:00
parent df939eb9a3
commit adfa4f5fa3
2 changed files with 13 additions and 11 deletions

View File

@ -13,7 +13,7 @@ use crate::{laser_diode::{laser_diode::{
pd_responsitivity::ResponsitivityUnit pd_responsitivity::ResponsitivityUnit
}, },
net::net, 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::thermostat::{Thermostat, ThermostatSettingsSummary};
use crate::thermostat::pid_state::PidSettings::*; use crate::thermostat::pid_state::PidSettings::*;
@ -97,15 +97,6 @@ pub struct Cmd {
json: CmdJsonObj json: CmdJsonObj
} }
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)]
pub struct TempAdcFilter{
filter_type: FilterType,
sinc5sinc1odr: Option<SingleChODR>,
sinc3odr: Option<SingleChODR>,
sinc5sinc1postfilter: Option<PostFilter>,
sinc3fineodr: Option<f64>
}
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Tree)] #[derive(Deserialize, Serialize, Copy, Clone, Debug, Tree)]
pub struct StatusReport { pub struct StatusReport {
ts: u32, ts: u32,

View File

@ -3,7 +3,7 @@ use core::marker::PhantomData;
use crate::sys_timer; use crate::sys_timer;
use crate::thermostat::ad5680; use crate::thermostat::ad5680;
use crate::thermostat::max1968::{MAX1968, AdcReadTarget, PwmPinsEnum}; 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::pid_state::{PidState, PidSettings, Parameters as PidParams};
use crate::thermostat::temp_mon::{TempMon, TempStatus, TempMonSettings}; use crate::thermostat::temp_mon::{TempMon, TempStatus, TempMonSettings};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -26,6 +26,17 @@ pub const R_SENSE: ElectricalResistance = ElectricalResistance {
value: 0.05, value: 0.05,
}; };
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)]
pub struct TempAdcFilter{
pub filter_type: FilterType,
pub sinc5sinc1odr: Option<SingleChODR>,
pub sinc3odr: Option<SingleChODR>,
pub sinc5sinc1postfilter: Option<PostFilter>,
pub sinc3fineodr: Option<f32>,
pub rate: Option<f32>,
}
#[derive(Deserialize, Serialize, Clone, Copy, Debug, Tree)] #[derive(Deserialize, Serialize, Clone, Copy, Debug, Tree)]
pub struct TecSettings { pub struct TecSettings {
pub pwr_on: bool, pub pwr_on: bool,