Skip to content

Commit 6a4ce56

Browse files
committed
Fix preallocaiton to not duplicate row references.
1 parent f231eb9 commit 6a4ce56

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

adafruit_amg88xx.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def pixels(self):
149149
Temperatures are stored in a two dimensional list where the first index is the row and
150150
the second is the column. The first row is on the side closest to the writing on the
151151
sensor."""
152-
retbuf = [[0]*_PIXEL_ARRAY_WIDTH] * _PIXEL_ARRAY_HEIGHT
152+
retbuf = [[0]*_PIXEL_ARRAY_WIDTH for _ in range(_PIXEL_ARRAY_HEIGHT)]
153153
buf = bytearray(3)
154154

155155
with self.i2c_device as i2c:
@@ -161,7 +161,6 @@ def pixels(self):
161161
i2c.readinto(buf, start=1)
162162

163163
raw = (buf[2] << 8) | buf[1]
164-
converted = _signed_12bit_to_float(raw) * _PIXEL_TEMP_CONVERSION
165-
retbuf.append(converted)
164+
retbuf[row][col] = _signed_12bit_to_float(raw) * _PIXEL_TEMP_CONVERSION
166165

167166
return retbuf

0 commit comments

Comments
 (0)