From 20c3d42dd7309217bb7910bf9d5cc3365dc724c6 Mon Sep 17 00:00:00 2001 From: linuswck Date: Thu, 25 Jul 2024 15:53:00 +0800 Subject: [PATCH] rm ld soft current limit --- pykirdy/asyncio_exmaple.py | 2 -- pykirdy/driver/kirdy_async.py | 12 ------------ pykirdy/kirdy_qt.py | 3 --- src/laser_diode/laser_diode.rs | 15 +-------------- src/net/cmd_handler.rs | 15 --------------- 5 files changed, 1 insertion(+), 46 deletions(-) diff --git a/pykirdy/asyncio_exmaple.py b/pykirdy/asyncio_exmaple.py index 58cd27a..f3e09ec 100644 --- a/pykirdy/asyncio_exmaple.py +++ b/pykirdy/asyncio_exmaple.py @@ -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. diff --git a/pykirdy/driver/kirdy_async.py b/pykirdy/driver/kirdy_async.py index 71bbe8f..b2b4bd1 100644 --- a/pykirdy/driver/kirdy_async.py +++ b/pykirdy/driver/kirdy_async.py @@ -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): """ diff --git a/pykirdy/kirdy_qt.py b/pykirdy/kirdy_qt.py index d8129ab..bc81b3f 100644 --- a/pykirdy/kirdy_qt.py +++ b/pykirdy/kirdy_qt.py @@ -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"]) diff --git a/src/laser_diode/laser_diode.rs b/src/laser_diode/laser_diode.rs index 6eca9e8..456863e 100644 --- a/src/laser_diode/laser_diode.rs +++ b/src/laser_diode/laser_diode.rs @@ -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::(0.0), - ld_drive_current_limit: ElectricCurrent::new::(0.0), pd_mon_params: pd_mon_params::Parameters::default(), ld_pwr_limit: Power::new::(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, - ld_drive_current_limit: LdSettingsSummaryField, pd_mon_params: pd_mon_params::Parameters, ld_pwr_limit: Power, ld_terms_short: bool, diff --git a/src/net/cmd_handler.rs b/src/net/cmd_handler.rs index 3b3601d..0523aab 100644 --- a/src/net/cmd_handler.rs +++ b/src/net/cmd_handler.rs @@ -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::(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);