-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
There is a mistake in the read function. The following line is wrong:
self._adc_out = value / 128 # Restore to 24-bit signed integer value
It should be divided by 256 because it needs to be shifted with 8 bits not 7.
Also this method is not the ideal method to convert the raw data. It would be more efficient like this:
raw = (self._adc_out_2 << 16) | (self._adc_out_1 << 8) | self._adc_out_0
# Sign-extend 24-bit to Python int
if raw & 0x800000: # if sign bit set
raw -= 1 << 24
return raw
The original creater also told me that it is a mistake see screenshot

Metadata
Metadata
Assignees
Labels
No labels