Skip to content

Commit

Permalink
Fix ICM20948 PacketBundling and LastData
Browse files Browse the repository at this point in the history
The delay in sendData() makes at somepoint that the packetbundling does not work correctly. The ICM works without delay on ESP8266, ESP32-C3, ESP32-S2
Also added the LastData Flag for get info
  • Loading branch information
unlogisch04 committed Nov 12, 2023
1 parent b744c53 commit da1a49f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/sensors/icm20948sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void ICM20948Sensor::motionLoop()
cntbuf = 0;
cntrounds = 0;
}
*/
*/
}

void ICM20948Sensor::readFIFOToEnd()
Expand All @@ -104,9 +104,8 @@ void ICM20948Sensor::readFIFOToEnd()

void ICM20948Sensor::sendData()
{
if(newFusedRotation && lastDataSent + 7 < millis())
if(newFusedRotation)
{
lastDataSent = millis();
newFusedRotation = false;

#if(USE_6_AXIS)
Expand Down Expand Up @@ -320,6 +319,7 @@ void ICM20948Sensor::startMotionLoop()
{
lastData = millis();
working = true;
hadData = true;
}

void ICM20948Sensor::checkSensorTimeout()
Expand Down
1 change: 0 additions & 1 deletion src/sensors/icm20948sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class ICM20948Sensor : public Sensor
private:
void calculateAccelerationWithoutGravity(Quat *quaternion);
unsigned long lastData = 0;
unsigned long lastDataSent = 0;
int bias_save_counter = 0;
bool hasdata = false;
// Performance test
Expand Down

0 comments on commit da1a49f

Please sign in to comment.