1
0
Fork 0

ld: pd_responsitivity -> pd_mon_params

This commit is contained in:
linuswck 2024-04-05 15:37:44 +08:00
parent ae74455f94
commit 0a992c1dc8
4 changed files with 13 additions and 13 deletions

View File

@ -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::<milliampere>(0.0),
ld_drive_current_limit: ElectricCurrent::new::<milliampere>(0.0),
pd_responsitivity: pd_responsitivity::Parameters::default(),
pd_mon_params: pd_mon_params::Parameters::default(),
ld_pwr_limit: Power::new::<milliwatt>(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<ElectricCurrent>,
ld_drive_current_limit: LdSettingsSummaryField<ElectricCurrent>,
pd_responsitivity: pd_responsitivity::Parameters,
pd_mon_params: pd_mon_params::Parameters,
ld_pwr_limit: Power,
}

View File

@ -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;

View File

@ -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}}