laser: Short LD terminals when ld pwr is off
This commit is contained in:
parent
6ad41c8502
commit
227d9d4877
@ -71,7 +71,6 @@ pub fn bootup(
|
|||||||
let current_source = LdCtrl::new(current_source_phy);
|
let current_source = LdCtrl::new(current_source_phy);
|
||||||
let mut laser = LdDrive::new(current_source, perif.ADC3, perif.TIM2.counter(&clocks), pd_mon_phy);
|
let mut laser = LdDrive::new(current_source, perif.ADC3, perif.TIM2.counter(&clocks), pd_mon_phy);
|
||||||
laser.setup();
|
laser.setup();
|
||||||
laser.ld_open();
|
|
||||||
laser.ld_set_i(ElectricCurrent::new::<ampere>(0.0));
|
laser.ld_set_i(ElectricCurrent::new::<ampere>(0.0));
|
||||||
laser.set_pd_i_limit(ElectricCurrent::new::<milliampere>(2.5));
|
laser.set_pd_i_limit(ElectricCurrent::new::<milliampere>(2.5));
|
||||||
laser.set_pd_mon_calibrated_vdda(thermostat.get_calibrated_vdda());
|
laser.set_pd_mon_calibrated_vdda(thermostat.get_calibrated_vdda());
|
||||||
|
@ -99,22 +99,33 @@ impl LdDrive {
|
|||||||
Settings::DAC_OUT_V_MAX,
|
Settings::DAC_OUT_V_MAX,
|
||||||
);
|
);
|
||||||
LdCurrentOutCtrlTimer::reset();
|
LdCurrentOutCtrlTimer::reset();
|
||||||
self.ld_short();
|
self.ctrl.ld_short_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ld_short(&mut self) {
|
pub fn ld_short(&mut self) {
|
||||||
|
if LdPwrExcProtector::get_status().pwr_engaged {
|
||||||
self.ctrl.ld_short_enable();
|
self.ctrl.ld_short_enable();
|
||||||
|
}
|
||||||
self.settings.ld_terms_short = true;
|
self.settings.ld_terms_short = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ld_open(&mut self) {
|
pub fn ld_open(&mut self) {
|
||||||
|
if LdPwrExcProtector::get_status().pwr_engaged {
|
||||||
self.ctrl.ld_short_disable();
|
self.ctrl.ld_short_disable();
|
||||||
|
}
|
||||||
self.settings.ld_terms_short = false;
|
self.settings.ld_terms_short = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn power_up(&mut self) {
|
pub fn power_up(&mut self) {
|
||||||
let prev_i_set = self.settings.ld_drive_current;
|
let prev_i_set = self.settings.ld_drive_current;
|
||||||
LdCurrentOutCtrlTimer::reset();
|
LdCurrentOutCtrlTimer::reset();
|
||||||
|
|
||||||
|
if self.settings.ld_terms_short {
|
||||||
|
self.ctrl.ld_short_enable();
|
||||||
|
} else {
|
||||||
|
self.ctrl.ld_short_disable();
|
||||||
|
}
|
||||||
|
|
||||||
let _ = self.ctrl.set_i(
|
let _ = self.ctrl.set_i(
|
||||||
ElectricCurrent::new::<milliampere>(0.0),
|
ElectricCurrent::new::<milliampere>(0.0),
|
||||||
Settings::LD_DRIVE_TRANSIMPEDANCE,
|
Settings::LD_DRIVE_TRANSIMPEDANCE,
|
||||||
@ -132,6 +143,8 @@ impl LdDrive {
|
|||||||
pub fn power_down(&mut self) {
|
pub fn power_down(&mut self) {
|
||||||
LdPwrExcProtector::pwr_off();
|
LdPwrExcProtector::pwr_off();
|
||||||
self.settings.pwr_on = false;
|
self.settings.pwr_on = false;
|
||||||
|
// Short the laser diode terminals at power off state for electrical protection
|
||||||
|
self.ctrl.ld_short_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_pd_i(&mut self) -> ElectricCurrent {
|
pub fn get_pd_i(&mut self) -> ElectricCurrent {
|
||||||
|
Loading…
Reference in New Issue
Block a user