diff --git a/pykirdy/driver/kirdy_async.py b/pykirdy/driver/kirdy_async.py index b126d37..6b76c01 100644 --- a/pykirdy/driver/kirdy_async.py +++ b/pykirdy/driver/kirdy_async.py @@ -124,6 +124,43 @@ class Device: async def get_status_report(self): """ + Get status of all peripherals in a json object + + Example of yielded data:: + { + 'ts': 227657, # Relative Timestamp (ms) + 'laser': { + 'pwr_on': False, # Laser Power is On (True/False) + 'pwr_excursion': False, # Was Laser experienced an Overpowered Condition? (True/False) + '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) + }, + 'thermostat': { + 'pwr_on': False, # Tec Power is On (True/False) + 'pid_engaged': False, # Is Pid_Engaged. If False, it is in Constant Current Mode (True/False) + 'temp_mon_status': { # Temperature Monitor: + 'status': 'Off', # (To be revised) + 'over_temp_alarm': False # Was Laser Diode experienced an Overtemperature condition (True/False) + }, + 'temperature': 298.18344, # Temperature Readings (Degree Celsius) + 'i_set': 0.0, # Tec Current Set by User/PID Controller(A) + 'tec_i': 0.0024998188, # Tec Current Readings (A) + 'tec_v': -0.00399971 # Tec Voltage Readings (V) + } + } + """ + + response = await self._send_cmd(TARGET_DEVICE, "GetStatusReport") + if response["msg_type"] != "Acknowledge": + return response + return await self._read_response() + + async def get_settings_summary(self): + """ + Get the current settings of laser and thermostat in a json object + { 'laser': { default_pwr_on': False, # Power On Laser Diode at Startup @@ -191,12 +228,6 @@ class Device: } """ - response = await self._send_cmd(TARGET_DEVICE, "GetStatusReport") - if response["msg_type"] != "Acknowledge": - return response - return await self._read_response() - - async def get_settings_summary(self): response = await self._send_cmd(TARGET_DEVICE, "GetSettingsSummary") if response["msg_type"] != "Acknowledge": return response @@ -659,32 +690,8 @@ class Kirdy: raise NoAckRecv async def report_mode(self): - """Start reporting device status in json object - - Example of yielded data:: - { - 'ts': 227657, # Relative Timestamp (ms) - 'laser': { - 'pwr_on': False, # Laser Power is On (True/False) - 'pwr_excursion': False, # Was Laser experienced an Overpowered Condition? (True/False) - '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) - }, - 'tec': { - 'pwr_on': False, # Tec Power is On (True/False) - 'pid_engaged': False, # Is Pid_Engaged. If False, it is in Constant Current Mode (True/False) - 'temp_mon_status': { # Temperature Monitor: - 'status': 'Off', # (To be revised) - 'over_temp_alarm': False # Was Laser Diode experienced an Overtemperature condition (True/False) - }, - 'temperature': 298.18344, # Temperature Readings (K) - 'i_set': 0.0, # Tec Current Set by User/PID Controller(A) - 'tec_i': 0.0024998188, # Tec Current Readings (A) - 'tec_v': -0.00399971 # Tec Voltage Readings (V) - } - } + """ + Start reporting device status in json object """ await self.device.set_active_report_mode(True) self._report_mode_on = True