rm ld soft current limit
This commit is contained in:
parent
aae89256c3
commit
20c3d42dd7
|
@ -71,9 +71,7 @@ async def ld_thermostat_cfg(kirdy: Kirdy):
|
||||||
await kirdy.laser.set_default_pwr_on(False)
|
await kirdy.laser.set_default_pwr_on(False)
|
||||||
await kirdy.thermostat.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(0)
|
||||||
await kirdy.laser.set_i_soft_limit(30.0 / 1000)
|
|
||||||
|
|
||||||
# Configure the laser diode output power limit and photodiode parameters
|
# Configure the laser diode output power limit and photodiode parameters
|
||||||
# Exceeding the measured power limit triggers overpower protection alarm.
|
# Exceeding the measured power limit triggers overpower protection alarm.
|
||||||
|
|
|
@ -33,7 +33,6 @@ class CmdList:
|
||||||
LdTermsShort = _dt.none
|
LdTermsShort = _dt.none
|
||||||
LdTermsOpen = _dt.none
|
LdTermsOpen = _dt.none
|
||||||
SetI = _dt.f32
|
SetI = _dt.f32
|
||||||
SetISoftLimit = _dt.f32
|
|
||||||
SetPdResponsitivity = _dt.f32
|
SetPdResponsitivity = _dt.f32
|
||||||
SetPdDarkCurrent = _dt.f32
|
SetPdDarkCurrent = _dt.f32
|
||||||
SetLdPwrLimit = _dt.f32
|
SetLdPwrLimit = _dt.f32
|
||||||
|
@ -253,10 +252,6 @@ class Device:
|
||||||
'value': 0.0, # Value Set
|
'value': 0.0, # Value Set
|
||||||
'max': 0.3 # Max Value Settable
|
'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)
|
'pd_mon_params': { # Laser Diode Software Current Limit(A)
|
||||||
'responsitivity': None, # Value Set
|
'responsitivity': None, # Value Set
|
||||||
'i_dark': 0.0 # Max Value Settable
|
'i_dark': 0.0 # Max Value Settable
|
||||||
|
@ -387,13 +382,6 @@ class Laser:
|
||||||
"""
|
"""
|
||||||
return await self._send_cmd(self._cmd._target, self._cmd.SetI, i)
|
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):
|
async def set_pd_mon_responsitivity(self, responsitivity):
|
||||||
"""
|
"""
|
||||||
Configure the photodiode monitor responsitivity parameter
|
Configure the photodiode monitor responsitivity parameter
|
||||||
|
|
|
@ -343,8 +343,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
|
||||||
{'name': 'LD Current Set', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 1),
|
{'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'},
|
'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': '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'},
|
{'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']
|
settings = settings['laser']
|
||||||
with QSignalBlocker(self.params[1]):
|
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').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', '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('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"])
|
self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').setValuewithLock(settings["ld_pwr_limit"])
|
||||||
|
|
|
@ -39,7 +39,6 @@ struct Settings {
|
||||||
pwr_on: bool,
|
pwr_on: bool,
|
||||||
default_pwr_on: bool,
|
default_pwr_on: bool,
|
||||||
ld_drive_current: ElectricCurrent,
|
ld_drive_current: ElectricCurrent,
|
||||||
ld_drive_current_limit: ElectricCurrent,
|
|
||||||
pd_mon_params: pd_mon_params::Parameters,
|
pd_mon_params: pd_mon_params::Parameters,
|
||||||
ld_pwr_limit: Power,
|
ld_pwr_limit: Power,
|
||||||
ld_terms_short: bool,
|
ld_terms_short: bool,
|
||||||
|
@ -51,7 +50,6 @@ impl Default for Settings {
|
||||||
pwr_on: false,
|
pwr_on: false,
|
||||||
default_pwr_on: false,
|
default_pwr_on: false,
|
||||||
ld_drive_current: ElectricCurrent::new::<milliampere>(0.0),
|
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(),
|
pd_mon_params: pd_mon_params::Parameters::default(),
|
||||||
ld_pwr_limit: Power::new::<milliwatt>(0.0),
|
ld_pwr_limit: Power::new::<milliwatt>(0.0),
|
||||||
ld_terms_short: false,
|
ld_terms_short: false,
|
||||||
|
@ -97,15 +95,10 @@ impl LdDrive {
|
||||||
Settings::LD_DRIVE_TRANSIMPEDANCE,
|
Settings::LD_DRIVE_TRANSIMPEDANCE,
|
||||||
Settings::DAC_OUT_V_MAX,
|
Settings::DAC_OUT_V_MAX,
|
||||||
);
|
);
|
||||||
self.set_ld_drive_current_limit(Settings::LD_CURRENT_MAX);
|
|
||||||
LdCurrentOutCtrlTimer::reset();
|
LdCurrentOutCtrlTimer::reset();
|
||||||
self.ld_short();
|
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) {
|
pub fn ld_short(&mut self) {
|
||||||
self.ctrl.ld_short_enable();
|
self.ctrl.ld_short_enable();
|
||||||
self.settings.ld_terms_short = true;
|
self.settings.ld_terms_short = true;
|
||||||
|
@ -153,7 +146,7 @@ impl LdDrive {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ld_set_i(&mut self, i: ElectricCurrent) {
|
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());
|
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,
|
value: settings.ld_drive_current,
|
||||||
max: Settings::LD_CURRENT_MAX,
|
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,
|
pd_mon_params: settings.pd_mon_params,
|
||||||
ld_pwr_limit: settings.ld_pwr_limit,
|
ld_pwr_limit: settings.ld_pwr_limit,
|
||||||
ld_terms_short: settings.ld_terms_short,
|
ld_terms_short: settings.ld_terms_short,
|
||||||
|
@ -251,7 +240,6 @@ impl LdDrive {
|
||||||
pub fn load_settings_from_summary(&mut self, settings: LdSettingsSummary) {
|
pub fn load_settings_from_summary(&mut self, settings: LdSettingsSummary) {
|
||||||
self.power_down();
|
self.power_down();
|
||||||
self.settings.ld_drive_current = settings.ld_drive_current.value;
|
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.pd_mon_params = settings.pd_mon_params;
|
||||||
self.settings.ld_pwr_limit = settings.ld_pwr_limit;
|
self.settings.ld_pwr_limit = settings.ld_pwr_limit;
|
||||||
self.settings.default_pwr_on = settings.default_pwr_on;
|
self.settings.default_pwr_on = settings.default_pwr_on;
|
||||||
|
@ -276,7 +264,6 @@ impl LdDrive {
|
||||||
pub struct LdSettingsSummary {
|
pub struct LdSettingsSummary {
|
||||||
default_pwr_on: bool,
|
default_pwr_on: bool,
|
||||||
ld_drive_current: LdSettingsSummaryField<ElectricCurrent>,
|
ld_drive_current: LdSettingsSummaryField<ElectricCurrent>,
|
||||||
ld_drive_current_limit: LdSettingsSummaryField<ElectricCurrent>,
|
|
||||||
pd_mon_params: pd_mon_params::Parameters,
|
pd_mon_params: pd_mon_params::Parameters,
|
||||||
ld_pwr_limit: Power,
|
ld_pwr_limit: Power,
|
||||||
ld_terms_short: bool,
|
ld_terms_short: bool,
|
||||||
|
|
|
@ -83,7 +83,6 @@ enum LdCmdEnum {
|
||||||
LdTermsShort,
|
LdTermsShort,
|
||||||
LdTermsOpen,
|
LdTermsOpen,
|
||||||
SetI,
|
SetI,
|
||||||
SetISoftLimit,
|
|
||||||
// PD Mon Related
|
// PD Mon Related
|
||||||
SetPdResponsitivity,
|
SetPdResponsitivity,
|
||||||
SetPdDarkCurrent,
|
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(LdCmdEnum::SetPdResponsitivity) => match cmd.json.data_f32 {
|
||||||
Some(val) => {
|
Some(val) => {
|
||||||
send_response(buffer, ResponseEnum::Acknowledge, None, socket);
|
send_response(buffer, ResponseEnum::Acknowledge, None, socket);
|
||||||
|
|
Loading…
Reference in New Issue