rm ld soft current limit

This commit is contained in:
linuswck 2024-07-25 15:53:00 +08:00
parent aae89256c3
commit 20c3d42dd7
5 changed files with 1 additions and 46 deletions

View File

@ -71,9 +71,7 @@ async def ld_thermostat_cfg(kirdy: Kirdy):
await kirdy.laser.set_default_pwr_on(False)
await kirdy.thermostat.set_default_pwr_on(False)
# The laser diode output current range is bounded by this software limit setting
await kirdy.laser.set_i(0)
await kirdy.laser.set_i_soft_limit(30.0 / 1000)
# Configure the laser diode output power limit and photodiode parameters
# Exceeding the measured power limit triggers overpower protection alarm.

View File

@ -33,7 +33,6 @@ class CmdList:
LdTermsShort = _dt.none
LdTermsOpen = _dt.none
SetI = _dt.f32
SetISoftLimit = _dt.f32
SetPdResponsitivity = _dt.f32
SetPdDarkCurrent = _dt.f32
SetLdPwrLimit = _dt.f32
@ -253,10 +252,6 @@ class Device:
'value': 0.0, # Value Set
'max': 0.3 # Max Value Settable
,
'ld_drive_current_limit': { # Laser Diode Software Current Limit(A)
'value': 0.3, # Value Set
'max': 0.3 # Max Value Settable
,
'pd_mon_params': { # Laser Diode Software Current Limit(A)
'responsitivity': None, # Value Set
'i_dark': 0.0 # Max Value Settable
@ -386,13 +381,6 @@ class Laser:
- i: A
"""
return await self._send_cmd(self._cmd._target, self._cmd.SetI, i)
async def set_i_soft_limit(self, i_limit):
"""
Set laser diode software output current limit
- i_limit: A
"""
return await self._send_cmd(self._cmd._target, self._cmd.SetISoftLimit, i_limit)
async def set_pd_mon_responsitivity(self, responsitivity):
"""

View File

@ -343,8 +343,6 @@ class MainWindow(QtWidgets.QMainWindow):
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
{'name': 'LD Current Set', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 1),
'suffix': 'A', 'siPrefix': True, 'lock': False, 'target': 'laser', 'action': 'set_i'},
{'name': 'LD Current Set Soft Limit', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 1),
'suffix': 'A', 'siPrefix': True, 'lock': False, 'target': 'laser', 'action': 'set_i_soft_limit'},
{'name': 'LD Terminals Short', 'type': 'bool', 'value': False, 'lock': False, 'target': 'laser', 'action': 'set_ld_terms_short'},
{'name': 'Default Power On', 'type': 'bool', 'value': False, 'lock': False, 'target': 'laser', 'action': 'set_default_pwr_on'},
]},
@ -772,7 +770,6 @@ class MainWindow(QtWidgets.QMainWindow):
settings = settings['laser']
with QSignalBlocker(self.params[1]):
self.params[1].child('Output Config', 'LD Current Set').setValuewithLock(settings["ld_drive_current"]['value'])
self.params[1].child('Output Config', 'LD Current Set Soft Limit').setValuewithLock(settings["ld_drive_current_limit"]['value'])
self.params[1].child('Output Config', 'LD Terminals Short').setValuewithLock(settings["ld_terms_short"])
self.params[1].child('Output Config', 'Default Power On').setValuewithLock(settings["default_pwr_on"])
self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').setValuewithLock(settings["ld_pwr_limit"])

View File

@ -39,7 +39,6 @@ struct Settings {
pwr_on: bool,
default_pwr_on: bool,
ld_drive_current: ElectricCurrent,
ld_drive_current_limit: ElectricCurrent,
pd_mon_params: pd_mon_params::Parameters,
ld_pwr_limit: Power,
ld_terms_short: bool,
@ -51,7 +50,6 @@ impl Default for Settings {
pwr_on: false,
default_pwr_on: false,
ld_drive_current: ElectricCurrent::new::<milliampere>(0.0),
ld_drive_current_limit: ElectricCurrent::new::<milliampere>(0.0),
pd_mon_params: pd_mon_params::Parameters::default(),
ld_pwr_limit: Power::new::<milliwatt>(0.0),
ld_terms_short: false,
@ -97,15 +95,10 @@ impl LdDrive {
Settings::LD_DRIVE_TRANSIMPEDANCE,
Settings::DAC_OUT_V_MAX,
);
self.set_ld_drive_current_limit(Settings::LD_CURRENT_MAX);
LdCurrentOutCtrlTimer::reset();
self.ld_short();
}
pub fn set_ld_drive_current_limit(&mut self, i_limit: ElectricCurrent) {
self.settings.ld_drive_current_limit = i_limit.min(Settings::LD_CURRENT_MAX);
}
pub fn ld_short(&mut self) {
self.ctrl.ld_short_enable();
self.settings.ld_terms_short = true;
@ -153,7 +146,7 @@ impl LdDrive {
}
pub fn ld_set_i(&mut self, i: ElectricCurrent) {
self.settings.ld_drive_current = i.min(self.settings.ld_drive_current_limit);
self.settings.ld_drive_current = i.min(Settings::LD_CURRENT_MAX);
LdCurrentOutCtrlTimer::set_target_i_and_listen_irq(self.settings.ld_drive_current, self.ctrl.get_i_set());
}
@ -238,10 +231,6 @@ impl LdDrive {
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_mon_params: settings.pd_mon_params,
ld_pwr_limit: settings.ld_pwr_limit,
ld_terms_short: settings.ld_terms_short,
@ -251,7 +240,6 @@ impl LdDrive {
pub fn load_settings_from_summary(&mut self, settings: LdSettingsSummary) {
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_mon_params = settings.pd_mon_params;
self.settings.ld_pwr_limit = settings.ld_pwr_limit;
self.settings.default_pwr_on = settings.default_pwr_on;
@ -276,7 +264,6 @@ impl LdDrive {
pub struct LdSettingsSummary {
default_pwr_on: bool,
ld_drive_current: LdSettingsSummaryField<ElectricCurrent>,
ld_drive_current_limit: LdSettingsSummaryField<ElectricCurrent>,
pd_mon_params: pd_mon_params::Parameters,
ld_pwr_limit: Power,
ld_terms_short: bool,

View File

@ -83,7 +83,6 @@ enum LdCmdEnum {
LdTermsShort,
LdTermsOpen,
SetI,
SetISoftLimit,
// PD Mon Related
SetPdResponsitivity,
SetPdDarkCurrent,
@ -420,20 +419,6 @@ pub fn execute_cmd(
);
}
},
Some(LdCmdEnum::SetISoftLimit) => match cmd.json.data_f32 {
Some(val) => {
send_response(buffer, ResponseEnum::Acknowledge, None, socket);
laser.set_ld_drive_current_limit(ElectricCurrent::new::<ampere>(val))
}
None => {
send_response(
buffer,
ResponseEnum::InvalidDatatype,
Some(ERR_MSG_MISSING_DATA_F32),
socket,
);
}
},
Some(LdCmdEnum::SetPdResponsitivity) => match cmd.json.data_f32 {
Some(val) => {
send_response(buffer, ResponseEnum::Acknowledge, None, socket);