diff --git a/radicl/info.py b/radicl/info.py index e6f4989..a2e04c6 100644 --- a/radicl/info.py +++ b/radicl/info.py @@ -244,7 +244,9 @@ def __gt__(self, other): if v > ov: result = True break - + elif v < ov: + result = False + break return result def __repr__(self): diff --git a/radicl/interface.py b/radicl/interface.py index 46c5e47..01fd817 100644 --- a/radicl/interface.py +++ b/radicl/interface.py @@ -6,7 +6,6 @@ from os.path import abspath, dirname, expanduser, isdir import pandas as pd -from matplotlib import pyplot as plt from termcolor import colored from study_lyte.io import write_csv diff --git a/radicl/probe.py b/radicl/probe.py index 368d792..b9fcc78 100644 --- a/radicl/probe.py +++ b/radicl/probe.py @@ -44,13 +44,13 @@ def __init__(self, ext_api: RAD_API=None, debug=False): self.debug = debug self.api:RAD_API = ext_api - self.available_devices = [] + self.available_devices = None self.log = get_logger(__name__, debug=self.debug) def update_devices(self): self.log.info("Scanning for COM ports...") - self._available_devices = find_kw_port(['STMicroelectronics', 'STM32']) + self.available_devices = find_kw_port(['STMicroelectronics', 'STM32']) @property def serial_number(self): @@ -60,11 +60,18 @@ def serial_number(self): @property def multiple_devices_available(self): - return len(self.available_devices) > 1 + result = False + if self.available_devices is not None: + result = len(self.available_devices) > 1 + return result @property def no_devices_available(self): - return len(self.available_devices) == 0 + """ Returns True if no devices are available, False otherwise""" + result = True + if self.available_devices is not None: + result = len(self.available_devices) == 0 + return result def connect(self, device=None): """ Attempt to establish a connection with the probe""" diff --git a/tests/test_info.py b/tests/test_info.py index 9ff1ef8..9a13b97 100644 --- a/tests/test_info.py +++ b/tests/test_info.py @@ -58,7 +58,10 @@ def test_firmware_ge(self, fw1, fw2, expected): ('0.2', '0.2', False), ('0.0.0.2', '0.0.0.1', True), ('0.0.0.1', '0.0.0.2', False), - + ('1.45.2.1', '1.46.5', False), + ('1.46.2.1', '1.46.1.1', True), + ('1.46.2.1', '1.46.2.2', False), + ('1.46.2.1', '2', False), ]) def test_firmware_gt(self, fw1, fw2, expected): comparison = (fw1 > fw2)