From 86ab211b84c132e61becc294acfff87e1751908d Mon Sep 17 00:00:00 2001
From: Martin Braun <martin.braun@ettus.com>
Date: Mon, 17 Aug 2020 13:06:42 +0200
Subject: python: power cal: Minor fixes to power cal code

- Fix some typos
- Fix incorrect arg name for RFSGPowerGenerator.enable()
- Fix case where incorrect args would cause an uncaught TypeError. Now,
  if USRP is chose as signal generator, but fails to find one, a proper
  error is shown.
---
 host/python/uhd/usrp/cal/meas_device.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'host/python')

diff --git a/host/python/uhd/usrp/cal/meas_device.py b/host/python/uhd/usrp/cal/meas_device.py
index 15c82e55f..913096a95 100644
--- a/host/python/uhd/usrp/cal/meas_device.py
+++ b/host/python/uhd/usrp/cal/meas_device.py
@@ -281,7 +281,11 @@ class USRPPowerGenerator(SignalGeneratorBase):
 
     def __init__(self, options):
         super().__init__(options)
-        self._usrp = uhd.usrp.MultiUSRP(options.get('args'))
+        usrp_args = options.get('args')
+        if not usrp_args:
+            raise RuntimeError(
+                "Must specify args for USRP measurement device!")
+        self._usrp = uhd.usrp.MultiUSRP(usrp_args)
         self._rate = float(options.get('rate', 5e6))
         self._lo_offset = float(options.get('lo_offset', 0))
         self._chan = int(options.get('chan', 0))
@@ -305,7 +309,7 @@ class USRPPowerGenerator(SignalGeneratorBase):
         else:
             print("[SigGen] Stopping tone generator.")
             self._tone_gen.stop()
-        time.sleep(0.1) # Give it some time to spin or down
+        time.sleep(0.1) # Give it some time to spin down
 
     def set_frequency(self, freq):
         """
@@ -342,11 +346,11 @@ class RFSGPowerGenerator(SignalGeneratorBase):
         super().__init__(options)
         self.device = RFSGDevice(options)
 
-    def enable(self, enb=True):
+    def enable(self, enable=True):
         """
         Turn tone generation on and off
         """
-        self.device.enable(enb)
+        self.device.enable(enable)
 
     def set_frequency(self, freq):
         """
-- 
cgit v1.2.3