From ec5bf1d6b64ae92931f276ba186c33868d50648a Mon Sep 17 00:00:00 2001 From: linuswck Date: Fri, 19 Jul 2024 15:53:53 +0800 Subject: [PATCH] gui, ld: term_status -> term_50ohm - term_status (Is50Ohm / Not50Ohm) -> term_50ohm (On/Off) --- pykirdy/driver/kirdy_async.py | 2 +- pykirdy/kirdy_qt.py | 4 ++-- src/laser_diode/laser_diode.rs | 8 ++++---- src/laser_diode/ld_ctrl.rs | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pykirdy/driver/kirdy_async.py b/pykirdy/driver/kirdy_async.py index aba9b94..71bbe8f 100644 --- a/pykirdy/driver/kirdy_async.py +++ b/pykirdy/driver/kirdy_async.py @@ -223,7 +223,7 @@ class Device: 'ld_i_set': 0.0, # Laser Diode Output Current (A) 'pd_i': 2.0000002e-06, # Internal Photodiode Monitor current (A) 'pd_pwr': None, # Power Readings from Internal Photodiode (W). Return None if pd_mon parameter(s) are not defined. - 'term_status': 'Is50Ohm' # Is the Low Frequency Modulation Input's Impedance 50 Ohm? (Is50Ohm/Not50Ohm) + 'term_50ohm': 'Is50Ohm' # Is the Low Frequency Modulation Input's Impedance 50 Ohm? (On/Off) }, 'thermostat': { 'pwr_on': False, # Tec Power is On (True/False) diff --git a/pykirdy/kirdy_qt.py b/pykirdy/kirdy_qt.py index d19ed95..7d35aa6 100644 --- a/pykirdy/kirdy_qt.py +++ b/pykirdy/kirdy_qt.py @@ -332,7 +332,7 @@ class MainWindow(QtWidgets.QMainWindow): {'name': 'LD Current Set', 'type': 'float', 'suffix': 'A', 'siPrefix': True, 'readonly': True}, {'name': 'PD Current', 'type': 'float', 'suffix': 'A', 'siPrefix': True, 'readonly': True}, {'name': 'PD Power', 'type': 'float', 'suffix': 'W', 'siPrefix': True, 'readonly': True}, - {'name': 'LF Mod Impedance', 'type': 'list', 'limits': ['Is50Ohm', 'Not50Ohm'], 'readonly': True} + {'name': 'LF Mod Termination (50 Ohm)', 'type': 'list', 'limits': ['On', 'Off'], 'readonly': True} ]}, {'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [ {'name': 'LD Current Set', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 1), @@ -818,7 +818,7 @@ class MainWindow(QtWidgets.QMainWindow): self.params[1].child('Readings', 'PD Power').setValue(report["pd_pwr"]) else: self.params[1].child('Readings', 'PD Power').setValue(0) - self.params[1].child('Readings', 'LF Mod Impedance').setValue(report["term_status"]) + self.params[1].child('Readings', 'LF Mod Termination (50 Ohm)').setValue(report["term_50ohm"]) except Exception as e: logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True) diff --git a/src/laser_diode/laser_diode.rs b/src/laser_diode/laser_diode.rs index 797712b..6eca9e8 100644 --- a/src/laser_diode/laser_diode.rs +++ b/src/laser_diode/laser_diode.rs @@ -10,7 +10,7 @@ use uom::si::{electric_current::{ampere, milliampere}, power::milliwatt}; use crate::{device::sys_timer::sleep, - laser_diode::{ld_ctrl::{Impedance, LdCtrl}, + laser_diode::{ld_ctrl::{Impedance50Ohm, LdCtrl}, ld_current_out_ctrl_timer::LdCurrentOutCtrlTimer, ld_pwr_exc_protector::{self, LdPwrExcProtector}, pd_mon_params}}; @@ -66,7 +66,7 @@ pub struct StatusReport { ld_i_set: ElectricCurrent, pd_i: ElectricCurrent, pd_pwr: Power, - term_status: Impedance, + term_50ohm: Impedance50Ohm, } pub struct LdDrive { @@ -210,7 +210,7 @@ impl LdDrive { self.settings.default_pwr_on = pwr_on; } - pub fn get_term_status(&mut self) -> Impedance { + pub fn get_term_status(&mut self) -> Impedance50Ohm { self.ctrl.get_lf_mod_in_impedance() } @@ -226,7 +226,7 @@ impl LdDrive { ld_i_set: ld_i_set, pd_i: self.get_pd_i(), pd_pwr: self.get_pd_pwr(), - term_status: self.get_term_status(), + term_50ohm: self.get_term_status(), } } diff --git a/src/laser_diode/ld_ctrl.rs b/src/laser_diode/ld_ctrl.rs index 270ce55..b6b5544 100644 --- a/src/laser_diode/ld_ctrl.rs +++ b/src/laser_diode/ld_ctrl.rs @@ -11,9 +11,9 @@ use uom::si::{electric_current::ampere, use crate::laser_diode::max5719::{self, Dac}; #[derive(Deserialize, Serialize, Debug, Clone, Copy)] -pub enum Impedance { - Is50Ohm, - Not50Ohm, +pub enum Impedance50Ohm { + On, + Off, } pub trait ChannelPins { @@ -66,11 +66,11 @@ impl LdCtrl { self.phy.current_source_short_pin.set_high(); } - pub fn get_lf_mod_in_impedance(&mut self) -> Impedance { + pub fn get_lf_mod_in_impedance(&mut self) -> Impedance50Ohm { if self.phy.termination_status_pin.is_high() { - Impedance::Is50Ohm + Impedance50Ohm::On } else { - Impedance::Not50Ohm + Impedance50Ohm::Off } }