From f9323e938a79d8891eb36fb964e9234a40953884 Mon Sep 17 00:00:00 2001 From: caternuson Date: Wed, 28 Jul 2021 18:19:08 -0700 Subject: [PATCH 1/2] convert _READ_CMD to bytes --- adafruit_sgp40.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/adafruit_sgp40.py b/adafruit_sgp40.py index a9ecf10..9fc1df1 100644 --- a/adafruit_sgp40.py +++ b/adafruit_sgp40.py @@ -38,16 +38,18 @@ _WORD_LEN = 2 # no point in generating this each time -_READ_CMD = [ - 0x26, - 0x0F, - 0x80, - 0x00, - 0xA2, - 0x66, - 0x66, - 0x93, -] # Generated from temp 25c, humidity 50% +_READ_CMD = bytes( + [ + 0x26, + 0x0F, + 0x80, + 0x00, + 0xA2, + 0x66, + 0x66, + 0x93, + ] +) # Generated from temp 25c, humidity 50% class SGP40: From 75c296f1d769765ff0bf26f232c7197a90e737b6 Mon Sep 17 00:00:00 2001 From: caternuson Date: Thu, 29 Jul 2021 11:25:48 -0700 Subject: [PATCH 2/2] change to byte string --- adafruit_sgp40.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/adafruit_sgp40.py b/adafruit_sgp40.py index 9fc1df1..65ab39c 100644 --- a/adafruit_sgp40.py +++ b/adafruit_sgp40.py @@ -37,19 +37,10 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SGP40.git" _WORD_LEN = 2 + # no point in generating this each time -_READ_CMD = bytes( - [ - 0x26, - 0x0F, - 0x80, - 0x00, - 0xA2, - 0x66, - 0x66, - 0x93, - ] -) # Generated from temp 25c, humidity 50% +# Generated from temp 25c, humidity 50% +_READ_CMD = b"\x26\x0F\x80\x00\xA2\x66\x66\x93" class SGP40: