thermostat: Report temp_setpoint in degree celsius

This commit is contained in:
linuswck 2024-04-02 15:22:52 +08:00
parent 09863353cd
commit 4288d465c9
2 changed files with 5 additions and 5 deletions

View File

@ -148,7 +148,7 @@ class Device:
'status': 'Off', # (To be revised)
'over_temp_alarm': False # Was Laser Diode experienced an Overtemperature condition (True/False)
},
'temperature': 298.18344, # Temperature Readings (Degree Celsius)
'temperature': 25.03344, # Temperature Readings (Degree Celsius)
'i_set': 0.0, # Tec Current Set by User/PID Controller(A)
'tec_i': 0.0024998188, # Tec Current Readings (A)
'tec_v': -0.00399971 # Tec Voltage Readings (V)
@ -191,7 +191,7 @@ class Device:
'thermostat': {
'default_pwr_on': True, # Power on Thermostat at Startup
'pid_engaged': True, # True: PID Control Mode | False Constant Current Mode
'temperature_setpoint': 298.15, # Temperature Setpoint (Degree Celsius)
'temperature_setpoint': 25.0, # Temperature Setpoint (Degree Celsius)
'tec_settings': {
'i_set': { # Current TEC Current Set by PID Controller/User
'value': 0.04330516, # Value Set

View File

@ -126,7 +126,7 @@ pub struct Thermostat {
pub struct ThermostatSettingsSummary {
default_pwr_on: bool,
pid_engaged: bool,
temperature_setpoint: ThermodynamicTemperature,
temperature_setpoint: f32,
tec_settings: TecSettingSummary,
pid_params: PidParams,
temp_adc_settings: TempAdcFilter,
@ -484,7 +484,7 @@ impl Thermostat{
ThermostatSettingsSummary {
default_pwr_on: self.tec_settings.default_pwr_on,
pid_engaged: self.get_pid_engaged(),
temperature_setpoint: self.pid_ctrl_ch0.get_pid_setpoint(),
temperature_setpoint: self.pid_ctrl_ch0.get_pid_setpoint().get::<degree_celsius>(),
tec_settings: self.get_tec_settings(),
pid_params: self.get_pid_settings(),
temp_adc_settings: TempAdcFilter{
@ -533,7 +533,7 @@ impl Thermostat{
self.set_pid_engaged(settings.pid_engaged);
self.pid_ctrl_ch0.apply_pid_params(settings.pid_params);
self.set_temperature_setpoint(settings.temperature_setpoint);
self.set_temperature_setpoint(ThermodynamicTemperature::new::<degree_celsius>(settings.temperature_setpoint));
if !settings.pid_engaged {
self.set_i(settings.tec_settings.i_set.value);
}