From 41841b500106fdcfaef32cbab6b0a72c7bb8d8a3 Mon Sep 17 00:00:00 2001 From: caternuson Date: Thu, 20 Feb 2020 15:32:50 -0800 Subject: [PATCH 1/4] remove ready-wait --- adafruit_adt7410.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/adafruit_adt7410.py b/adafruit_adt7410.py index 30ef04a..0fe0790 100644 --- a/adafruit_adt7410.py +++ b/adafruit_adt7410.py @@ -80,15 +80,11 @@ def __init__(self, i2c_bus, address=0x48): _id = (self._read_register(_ADT7410_ID)[0]) & 0xF8 if _id != 0xC8: raise ValueError("Unable to find ADT7410 at i2c address " + str(hex(address))) - # Perform a software reset - self._write_register(_ADT7410_SWRST) - time.sleep(0.01) + self._reset() @property def temperature(self): """The temperature in celsius""" - while not self.ready: - pass temp = self._read_register(_ADT7410_TEMPMSB, 2) return struct.unpack('>h', temp)[0] / 128 @@ -106,6 +102,11 @@ def configuration(self): def configuration(self, val): return self._write_register(_ADT7410_CONFIG, val) + def _reset(self): + """Perform a software reset""" + self._write_register(_ADT7410_SWRST) + time.sleep(0.5) + def _read_register(self, addr, num=1): self._buf[0] = addr with self.i2c_device as i2c: From 9cd1ef3995a77830ee6645e7431c11321480b298 Mon Sep 17 00:00:00 2001 From: caternuson Date: Thu, 20 Feb 2020 15:46:17 -0800 Subject: [PATCH 2/4] unprivate reset --- adafruit_adt7410.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_adt7410.py b/adafruit_adt7410.py index 0fe0790..ec31e0d 100644 --- a/adafruit_adt7410.py +++ b/adafruit_adt7410.py @@ -80,7 +80,7 @@ def __init__(self, i2c_bus, address=0x48): _id = (self._read_register(_ADT7410_ID)[0]) & 0xF8 if _id != 0xC8: raise ValueError("Unable to find ADT7410 at i2c address " + str(hex(address))) - self._reset() + self.reset() @property def temperature(self): @@ -102,7 +102,7 @@ def configuration(self): def configuration(self, val): return self._write_register(_ADT7410_CONFIG, val) - def _reset(self): + def reset(self): """Perform a software reset""" self._write_register(_ADT7410_SWRST) time.sleep(0.5) From d6402215d9798c327610f4d6805389519adff616 Mon Sep 17 00:00:00 2001 From: caternuson Date: Fri, 21 Feb 2020 07:43:31 -0800 Subject: [PATCH 3/4] change to checkout@v2 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11ce574..7293b2f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: run: | python3 --version - name: Checkout Current Repo - uses: actions/checkout@v1 + uses: actions/checkout@v2 with: submodules: true - name: Checkout tools repo From a7d0f0f4098d4c274a3ce875e4d70b0397aedd73 Mon Sep 17 00:00:00 2001 From: caternuson Date: Fri, 21 Feb 2020 07:53:37 -0800 Subject: [PATCH 4/4] back to v1 then --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7293b2f..11ce574 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: run: | python3 --version - name: Checkout Current Repo - uses: actions/checkout@v2 + uses: actions/checkout@v1 with: submodules: true - name: Checkout tools repo