1
0
Fork 0

gui, ld: term_status -> term_50ohm

- term_status (Is50Ohm / Not50Ohm) -> term_50ohm (On/Off)
This commit is contained in:
linuswck 2024-07-19 15:53:53 +08:00
parent 3737c2ed59
commit ec5bf1d6b6
4 changed files with 13 additions and 13 deletions

View File

@ -223,7 +223,7 @@ class Device:
'ld_i_set': 0.0, # Laser Diode Output Current (A) 'ld_i_set': 0.0, # Laser Diode Output Current (A)
'pd_i': 2.0000002e-06, # Internal Photodiode Monitor 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. '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': { 'thermostat': {
'pwr_on': False, # Tec Power is On (True/False) 'pwr_on': False, # Tec Power is On (True/False)

View File

@ -332,7 +332,7 @@ class MainWindow(QtWidgets.QMainWindow):
{'name': 'LD Current Set', 'type': 'float', 'suffix': 'A', 'siPrefix': True, 'readonly': True}, {'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 Current', 'type': 'float', 'suffix': 'A', 'siPrefix': True, 'readonly': True},
{'name': 'PD Power', 'type': 'float', 'suffix': 'W', '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': '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),
@ -818,7 +818,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.params[1].child('Readings', 'PD Power').setValue(report["pd_pwr"]) self.params[1].child('Readings', 'PD Power').setValue(report["pd_pwr"])
else: else:
self.params[1].child('Readings', 'PD Power').setValue(0) 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: except Exception as e:
logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True) logging.error(f"Params tree cannot be updated. Data:{report}", exc_info=True)

View File

@ -10,7 +10,7 @@ use uom::si::{electric_current::{ampere, milliampere},
power::milliwatt}; power::milliwatt};
use crate::{device::sys_timer::sleep, 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_current_out_ctrl_timer::LdCurrentOutCtrlTimer,
ld_pwr_exc_protector::{self, LdPwrExcProtector}, ld_pwr_exc_protector::{self, LdPwrExcProtector},
pd_mon_params}}; pd_mon_params}};
@ -66,7 +66,7 @@ pub struct StatusReport {
ld_i_set: ElectricCurrent, ld_i_set: ElectricCurrent,
pd_i: ElectricCurrent, pd_i: ElectricCurrent,
pd_pwr: Power, pd_pwr: Power,
term_status: Impedance, term_50ohm: Impedance50Ohm,
} }
pub struct LdDrive { pub struct LdDrive {
@ -210,7 +210,7 @@ impl LdDrive {
self.settings.default_pwr_on = pwr_on; 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() self.ctrl.get_lf_mod_in_impedance()
} }
@ -226,7 +226,7 @@ impl LdDrive {
ld_i_set: ld_i_set, ld_i_set: ld_i_set,
pd_i: self.get_pd_i(), pd_i: self.get_pd_i(),
pd_pwr: self.get_pd_pwr(), pd_pwr: self.get_pd_pwr(),
term_status: self.get_term_status(), term_50ohm: self.get_term_status(),
} }
} }

View File

@ -11,9 +11,9 @@ use uom::si::{electric_current::ampere,
use crate::laser_diode::max5719::{self, Dac}; use crate::laser_diode::max5719::{self, Dac};
#[derive(Deserialize, Serialize, Debug, Clone, Copy)] #[derive(Deserialize, Serialize, Debug, Clone, Copy)]
pub enum Impedance { pub enum Impedance50Ohm {
Is50Ohm, On,
Not50Ohm, Off,
} }
pub trait ChannelPins { pub trait ChannelPins {
@ -66,11 +66,11 @@ impl LdCtrl {
self.phy.current_source_short_pin.set_high(); 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() { if self.phy.termination_status_pin.is_high() {
Impedance::Is50Ohm Impedance50Ohm::On
} else { } else {
Impedance::Not50Ohm Impedance50Ohm::Off
} }
} }