From 0a992c1dc8e82b7a55280f8a87bf6d6c5b24798f Mon Sep 17 00:00:00 2001 From: linuswck Date: Fri, 5 Apr 2024 15:37:44 +0800 Subject: [PATCH] ld: pd_responsitivity -> pd_mon_params --- src/laser_diode/laser_diode.rs | 22 +++++++++---------- src/laser_diode/mod.rs | 2 +- ...{pd_responsitivity.rs => pd_mon_params.rs} | 0 src/net/cmd_handler.rs | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) rename src/laser_diode/{pd_responsitivity.rs => pd_mon_params.rs} (100%) diff --git a/src/laser_diode/laser_diode.rs b/src/laser_diode/laser_diode.rs index 94faa2f..df46529 100644 --- a/src/laser_diode/laser_diode.rs +++ b/src/laser_diode/laser_diode.rs @@ -5,7 +5,7 @@ use uom::si::electric_current::ampere; use uom::si::power::milliwatt; use crate::laser_diode::ld_ctrl::{LdCtrl, Impedance}; use crate::laser_diode::ld_pwr_exc_protector::{LdPwrExcProtector, self}; -use crate::laser_diode::pd_responsitivity; +use crate::laser_diode::pd_mon_params; use crate::laser_diode::ld_current_out_ctrl_timer::LdCurrentOutCtrlTimer; use core::marker::PhantomData; use crate::device::sys_timer::sleep; @@ -54,7 +54,7 @@ struct Settings { default_pwr_on: bool, ld_drive_current: ElectricCurrent, ld_drive_current_limit: ElectricCurrent, - pd_responsitivity: pd_responsitivity::Parameters, + pd_mon_params: pd_mon_params::Parameters, ld_pwr_limit: Power, } @@ -65,7 +65,7 @@ impl Default for Settings { default_pwr_on: false, ld_drive_current: ElectricCurrent::new::(0.0), ld_drive_current_limit: ElectricCurrent::new::(0.0), - pd_responsitivity: pd_responsitivity::Parameters::default(), + pd_mon_params: pd_mon_params::Parameters::default(), ld_pwr_limit: Power::new::(0.0), } } @@ -140,7 +140,7 @@ impl LdDrive{ } pub fn get_pd_pwr(&mut self) -> Power { - self.settings.pd_responsitivity.get_ld_pwr_from_ld_i(LdPwrExcProtector::get_status().v * Settings::PD_MON_TRANSCONDUCTANCE) + self.settings.pd_mon_params.get_ld_pwr_from_ld_i(LdPwrExcProtector::get_status().v * Settings::PD_MON_TRANSCONDUCTANCE) } pub fn ld_set_i(&mut self, i: ElectricCurrent){ @@ -170,16 +170,16 @@ impl LdDrive{ LdPwrExcProtector::clear_alarm_status(); } - pub fn set_pd_responsitivity(&mut self, responsitivity: pd_responsitivity::ResponsitivityUnit){ - self.settings.pd_responsitivity.set(responsitivity); + pub fn set_pd_responsitivity(&mut self, responsitivity: pd_mon_params::ResponsitivityUnit){ + self.settings.pd_mon_params.set(responsitivity); } pub fn set_pd_dark_current(&mut self, i_dark: ElectricCurrent){ - self.settings.pd_responsitivity.set_i_dark(i_dark); + self.settings.pd_mon_params.set_i_dark(i_dark); } pub fn set_ld_power_limit(&mut self, pwr_limit: Power){ - LdPwrExcProtector::set_trigger_threshold_v(self.settings.pd_responsitivity + LdPwrExcProtector::set_trigger_threshold_v(self.settings.pd_mon_params .get_ld_i_from_ld_pwr(pwr_limit) / Settings::PD_MON_TRANSCONDUCTANCE ); self.settings.ld_pwr_limit = pwr_limit; @@ -219,7 +219,7 @@ impl LdDrive{ default_pwr_on: self.settings.default_pwr_on, ld_drive_current: LdSettingsSummaryField { value: settings.ld_drive_current, max: Settings::LD_CURRENT_MAX}, ld_drive_current_limit: LdSettingsSummaryField { value: settings.ld_drive_current_limit, max: Settings::LD_CURRENT_MAX}, - pd_responsitivity: settings.pd_responsitivity, + pd_mon_params: settings.pd_mon_params, ld_pwr_limit: settings.ld_pwr_limit, } } @@ -228,7 +228,7 @@ impl LdDrive{ self.power_down(); self.settings.ld_drive_current = settings.ld_drive_current.value; self.settings.ld_drive_current_limit = settings.ld_drive_current_limit.value; - self.settings.pd_responsitivity = settings.pd_responsitivity; + self.settings.pd_mon_params = settings.pd_mon_params; self.settings.ld_pwr_limit = settings.ld_pwr_limit; if settings.default_pwr_on { @@ -244,7 +244,7 @@ pub struct LdSettingsSummary { default_pwr_on: bool, ld_drive_current: LdSettingsSummaryField, ld_drive_current_limit: LdSettingsSummaryField, - pd_responsitivity: pd_responsitivity::Parameters, + pd_mon_params: pd_mon_params::Parameters, ld_pwr_limit: Power, } diff --git a/src/laser_diode/mod.rs b/src/laser_diode/mod.rs index 0cca298..80e17aa 100644 --- a/src/laser_diode/mod.rs +++ b/src/laser_diode/mod.rs @@ -1,6 +1,6 @@ pub mod ld_ctrl; pub mod max5719; pub mod laser_diode; -pub mod pd_responsitivity; +pub mod pd_mon_params; pub mod ld_pwr_exc_protector; pub mod ld_current_out_ctrl_timer; diff --git a/src/laser_diode/pd_responsitivity.rs b/src/laser_diode/pd_mon_params.rs similarity index 100% rename from src/laser_diode/pd_responsitivity.rs rename to src/laser_diode/pd_mon_params.rs diff --git a/src/net/cmd_handler.rs b/src/net/cmd_handler.rs index a357a02..5b9cf3a 100644 --- a/src/net/cmd_handler.rs +++ b/src/net/cmd_handler.rs @@ -10,7 +10,7 @@ use uom::si::{ }; use crate::{laser_diode::{laser_diode::{ LdDrive, LdSettingsSummary, StatusReport as LdStatusReport}, - pd_responsitivity::ResponsitivityUnit + pd_mon_params::ResponsitivityUnit }, net::net, thermostat::{ad7172::FilterType, thermostat::{StatusReport as TecStatusReport, TempAdcFilter}}