Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

temp calc for negative numbers not correct #4

Closed
kw123 opened this issue Jan 12, 2018 · 1 comment
Closed

temp calc for negative numbers not correct #4

kw123 opened this issue Jan 12, 2018 · 1 comment
Assignees

Comments

@kw123
Copy link

kw123 commented Jan 12, 2018

the calculation for the pixel values is not correct.
the adafruit spec sheet from panasonic states: https://cdn-learn.adafruit.com/assets/assets/000/043/261/original/Grid-EYE_SPECIFICATIONS%28Reference%29.pdf?1498680225
on page 14

""(11) Temperature Register
Register for reading only to indicate temperature data per 1 pixel.
Temperature Data of each pixel is 12 bit data and 2 byte data.
1 LSB has 12 bit resolution (11 bit + sign) which is equivalent to 0.25℃
and it is indicated as two's complement form.""

the correct conversion should be:

def twoCompl12(self, val):
       if  0x7FF & val == val:
           return float(val)
       else:
           return float(val-4096 )

for the thermistor it is correct

def signedMag12ToFloat(self, val):
       #take first 11 bits as absolute val
       if  0x7FF & val == val:
           return float(val)
       else:
           return  - float(0x7FF & val)

Panasonic has apparently used 2 different forms to do negative numbers for the thermistor and the pixels.

This was tested with ice and in the freezer: the new formula seems to show the proper numbers, using the posted python formulas one gets wrong numbers for negative C surfaces

Karl

@deanm1278
Copy link
Contributor

fixed! thank you!
847541b

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants