From e9a396f001f4f485d5f34d23be50b0ca19fe28bc Mon Sep 17 00:00:00 2001 From: linuswck Date: Thu, 15 Feb 2024 10:37:45 +0800 Subject: [PATCH] thermostat: Add abs timestamp to StatusReport --- src/thermostat/thermostat.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/thermostat/thermostat.rs b/src/thermostat/thermostat.rs index 322694e..5922991 100644 --- a/src/thermostat/thermostat.rs +++ b/src/thermostat/thermostat.rs @@ -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, i_set: ElectricCurrent,