1
0
Fork 0

thermostat: Add abs timestamp to StatusReport

This commit is contained in:
linuswck 2024-02-15 10:37:45 +08:00
parent 412f5ec58b
commit e9a396f001
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use crate::thermostat::max1968::{MAX1968, AdcReadTarget, PwmPinsEnum};
use crate::thermostat::ad7172; use crate::thermostat::ad7172;
use crate::thermostat::pid_state::{PidState, PidSettings}; use crate::thermostat::pid_state::{PidState, PidSettings};
use crate::thermostat::steinhart_hart; use crate::thermostat::steinhart_hart;
use serde::{Deserialize, Serialize};
use idsp::iir::Pid; use idsp::iir::Pid;
use log::debug; use log::debug;
use uom::si::{ use uom::si::{
@ -276,6 +277,7 @@ impl Thermostat{
pub fn get_status_report(&mut self) -> StatusReport { pub fn get_status_report(&mut self) -> StatusReport {
StatusReport { StatusReport {
ts: sys_timer::now(),
pid_engaged: self.get_pid_engaged(), pid_engaged: self.get_pid_engaged(),
temperature: self.pid_ctrl_ch0.get_temperature(), temperature: self.pid_ctrl_ch0.get_temperature(),
i_set: self.tec_setting.i_set, i_set: self.tec_setting.i_set,
@ -337,8 +339,9 @@ impl Thermostat{
} }
} }
#[derive(Tree, Debug)] #[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)]
pub struct StatusReport { pub struct StatusReport {
ts: u32,
pid_engaged: bool, pid_engaged: bool,
temperature: Option<ThermodynamicTemperature>, temperature: Option<ThermodynamicTemperature>,
i_set: ElectricCurrent, i_set: ElectricCurrent,