1
0
forked from M-Labs/kirdy

thermostat: Add abs timestamp to StatusReport

This commit is contained in:
linuswck 2024-02-15 10:37:45 +08:00
parent 412f5ec58b
commit e9a396f001

View File

@ -6,6 +6,7 @@ use crate::thermostat::max1968::{MAX1968, AdcReadTarget, PwmPinsEnum};
use crate::thermostat::ad7172;
use crate::thermostat::pid_state::{PidState, PidSettings};
use crate::thermostat::steinhart_hart;
use serde::{Deserialize, Serialize};
use idsp::iir::Pid;
use log::debug;
use uom::si::{
@ -276,6 +277,7 @@ impl Thermostat{
pub fn get_status_report(&mut self) -> StatusReport {
StatusReport {
ts: sys_timer::now(),
pid_engaged: self.get_pid_engaged(),
temperature: self.pid_ctrl_ch0.get_temperature(),
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 {
ts: u32,
pid_engaged: bool,
temperature: Option<ThermodynamicTemperature>,
i_set: ElectricCurrent,