-
Notifications
You must be signed in to change notification settings - Fork 26
Update to new build process and turn on lint. #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 161 of adafruit _amg88xx.py still uses I2c.read_into instead of i2c.readinto
I haven't tested these changes on device yet. Please only merge you test it or I follow up later to say its tested. For adafruit/circuitpython#475
Just rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Library and test code not functional at the moment. Questions/quick-fix-change listed in-line.
for row in amg.pixels: | ||
#pad to 1 decimal place | ||
print(['{0:.1f}'.format(temp) for temp in row]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently fails on this line with TypeError: 'float' object not iterable
. Was able to resolve with changes to adafruit_amg88xx.py
- change and explanation are listed with that file.
As-is, for row in amg.pixels:
is returning a float instead of a list of floats.
adafruit_amg88xx.py
Outdated
Temperatures are stored in a two dimensional list where the first index is the row and | ||
the second is the column. The first row is on the side closest to the writing on the | ||
sensor.""" | ||
retbuf = [[0]*_PIXEL_ARRAY_WIDTH] * _PIXEL_ARRAY_HEIGHT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worked with @caternuson to change this section to an option that worked. Looks like this:
retbuf = []
buf = bytearray(3)
with self.i2c_device as i2c:
for row in range(0, _PIXEL_ARRAY_HEIGHT):
rowbuf = []
for col in range(0, _PIXEL_ARRAY_WIDTH):
i = row * _PIXEL_ARRAY_HEIGHT + col
buf[0] = _PIXEL_OFFSET + (i << 1)
i2c.write(buf, end=1, stop=False)
i2c.readinto(buf, start=1)
raw = (buf[2] << 8) | buf[1]
converted = _signed_12bit_to_float(raw) * _PIXEL_TEMP_CONVERSION
rowbuf.append(converted)
retbuf.append(rowbuf)
return retbuf
This was a quick-fix to test it and can probably be written better.
Couple of questions: The init to all zeros - what was the thought behind this? Since you pre-allocated the buffer, did you intend to directly index things instead of using .append
? such as retbuf[row][col] = converted
or something like that. Essentially we were trying to figure out what you're wanting to do with your changes. Could you please clarify?
Thanks much!
Great catch! I did intend on directly indexing. I wanted to pre-allocate to minimize the heap churn. With append we end up growing our allocation every few additions. The multiply can be smarter. Should be fixed now but I didn't test it. |
Tested successfully. Good work! |
I haven't tested these changes on device yet. Please only merge you test it or I follow up later to say its tested.
For adafruit/circuitpython#475