Adafruit_AMG88xx icon indicating copy to clipboard operation
Adafruit_AMG88xx copied to clipboard

would like to suggest way for mirroring of data for amg8833

Open jamesdanielv opened this issue 7 years ago • 1 comments

up near top: #define AMG88xx_PIXEL_MIRROR true // this changes left to righ to righ to left for things such as

replace this loop in code: void Adafruit_AMG88xx::readPixels(float *buf, uint8_t size) with this one. it just adds in a way to flip sensor direction.

void Adafruit_AMG88xx::readPixels(float *buf, uint8_t size) { uint16_t recast; float converted; uint8_t bytesToRead = min((uint8_t)(size << 1), (uint8_t)(AMG88xx_PIXEL_ARRAY_SIZE << 1)); uint8_t rawArray[bytesToRead]; this->read(AMG88xx_PIXEL_OFFSET,rawArray, bytesToRead);

for(int i=0; i<size; i++){
	uint8_t pos = i << 1;
	recast = ((uint16_t)rawArray[pos + 1] << 8) | ((uint16_t)rawArray[pos]);
	
	converted = signedMag12ToFloat(recast) * AMG88xx_PIXEL_TEMP_CONVERSION;

#if AMG88xx_PIXEL_MIRROR == false buf[i]=converted; //unflipped #endif

#if AMG88xx_PIXEL_MIRROR == true //we convert to row and colum info, and invert the columb data@ buf[(7-(i/8))*8+(i-(i/8)*8)]=converted; //flipped #endif }

}

jamesdanielv avatar Aug 22 '18 21:08 jamesdanielv

this may need to include array size data in code for future compatibility with large sensor arrays. currently only tested with 8x8 adafruit amg8833 sensor. buf[(7-(i/8))*8+(i-(i/8)*8)]=converted; //flipped

jamesdanielv avatar Aug 22 '18 21:08 jamesdanielv