From ba2b3ed0c8faff18905dd7191eea24653fdf8667 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 31 May 2022 16:18:23 -0400 Subject: added aquisition of Freq from hardware --- qolab/hardware/rf_generator/qol_lmx2487.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'qolab/hardware/rf_generator/qol_lmx2487.py') diff --git a/qolab/hardware/rf_generator/qol_lmx2487.py b/qolab/hardware/rf_generator/qol_lmx2487.py index 2c9e121..c81b71b 100644 --- a/qolab/hardware/rf_generator/qol_lmx2487.py +++ b/qolab/hardware/rf_generator/qol_lmx2487.py @@ -1,6 +1,7 @@ from qolab.hardware.basic import BasicInstrument from qolab.hardware.rf_generator import RFGenerator import serial +import re class QOL_LMX2487(RFGenerator): @@ -52,10 +53,12 @@ class QOL_LMX2487(RFGenerator): @BasicInstrument.tsdb_append def getFreqFixed(self): - """ - getFreqFixed unable to get frequency from hardware. - So we use value from previews setFreqFixed. - """ + # talking to hardware is slow, so we use cached value if we can + if self._FreqFixed is None: + resp = self.sendSerialCmd('getFreq()') + m = re.search('[0-9.]+', resp) + if m is not None: + self._FreqFixed = float(m.group()) return self._FreqFixed -- cgit v1.2.3