m5stack / M5StickC-Plus

M5StickCPlus Arduino Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CoulombCounter not working

lilalukas opened this issue · comments

The CoulombCounter seems not to work, because the Read32bit-Function only reads 2 instead of 4 bytes:

uint32_t AXP192::Read32bit( uint8_t Addr )
{
	uint32_t ReData = 0;
	Wire1.beginTransmission(0x34);
	Wire1.write(Addr);
	Wire1.endTransmission();
	Wire1.requestFrom(0x34, 4);          //2 replaced by 4 --> works fine
	for( int i = 0 ; i < 4 ; i++ )
	{
		ReData <<= 8;
		ReData |= Wire1.read();
	}
	return ReData;
}
commented

Thank you for your help, we have solved this problem, you can update the local library to try