Skip to content

Commit

Permalink
fix error motion apps
Browse files Browse the repository at this point in the history
  • Loading branch information
sabas1080 committed Dec 18, 2023
1 parent 09495a5 commit d9b0fb1
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
25 changes: 12 additions & 13 deletions src/MPU6050.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3140,18 +3140,17 @@ bool MPU6050_Base::writeMemoryBlock(const uint8_t *data, uint16_t dataSize, uint
setMemoryStartAddress(address);
I2Cdev::readBytes(devAddr, MPU6050_RA_MEM_R_W, chunkSize, verifyBuffer, I2Cdev::readTimeout, wireObj);
if (memcmp(progBuffer, verifyBuffer, chunkSize) != 0) {
#ifdef DEBUG
Serial.print("Block write verification error, bank ");
Serial.print(bank, DEC);
Serial.print(", address ");
Serial.print(address, DEC);
Serial.print("!\nExpected:");
for (j = 0; j < chunkSize; j++) {
Serial.print(" 0x");
if (progBuffer[j] < 16) Serial.print("0");
Serial.print(progBuffer[j], HEX);
}
Serial.print("\nReceived:");
/*Serial.print("Block write verification error, bank ");
Serial.print(bank, DEC);
Serial.print(", address ");
Serial.print(address, DEC);
Serial.print("!\nExpected:");
for (j = 0; j < chunkSize; j++) {
Serial.print(" 0x");
if (progBuffer[j] < 16) Serial.print("0");
Serial.print(progBuffer[j], HEX);
}
Serial.print("\nReceived:");
for (uint8_t j = 0; j < chunkSize; j++) {
Serial.print(" 0x");
if (verifyBuffer[i + j] < 16) Serial.print("0");
Expand Down Expand Up @@ -3403,4 +3402,4 @@ void MPU6050_Base::PrintActiveOffsets() {
Serial.print((float)offsets[3], 5); Serial.print(",\t");
Serial.print((float)offsets[4], 5); Serial.print(",\t");
Serial.print((float)offsets[5], 5); Serial.print("\n\n");
}
}
2 changes: 1 addition & 1 deletion src/MPU6050.h
Original file line number Diff line number Diff line change
Expand Up @@ -849,4 +849,4 @@ class MPU6050_Base {
typedef MPU6050_Base MPU6050;
#endif

#endif /* _MPU6050_H_ */
#endif /* _MPU6050_H_ */
2 changes: 1 addition & 1 deletion src/MPU6050_6Axis_MotionApps20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,4 @@ uint16_t MPU6050_6Axis_MotionApps20::dmpGetFIFOPacketSize() {

uint8_t MPU6050_6Axis_MotionApps20::dmpGetCurrentFIFOPacket(uint8_t *data) { // overflow proof
return(GetCurrentFIFOPacket(data, dmpPacketSize));
}
}
2 changes: 1 addition & 1 deletion src/MPU6050_6Axis_MotionApps20.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ class MPU6050_6Axis_MotionApps20 : public MPU6050_Base {

typedef MPU6050_6Axis_MotionApps20 MPU6050;

#endif /* _MPU6050_6AXIS_MOTIONAPPS20_H_ */
#endif /* _MPU6050_6AXIS_MOTIONAPPS20_H_ */
7 changes: 1 addition & 6 deletions src/MPU6050_6Axis_MotionApps612.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,9 @@ const unsigned char dmpMemory[MPU6050_DMP_CODE_SIZE] PROGMEM = {
0xA6, 0xD9, 0x00, 0xD8, 0xF1, 0xFF,
};

// this divisor is pre configured into the above image and can't be modified at this time.
#ifndef MPU6050_DMP_FIFO_RATE_DIVISOR
#define MPU6050_DMP_FIFO_RATE_DIVISOR 0x01 // The New instance of the Firmware has this as the default
#endif

// this is the most basic initialization I can create. with the intent that we access the register bytes as few times as needed to get the job done.
// for detailed descriptins of all registers and there purpose google "MPU-6000/MPU-6050 Register Map and Descriptions"
uint8_t MPU6050::dmpInitialize(uint8_t rateDivisor = 0x04, uint8_t mpuAddr = 0x68) { // Lets get it over with fast Write everything once and set it up necely
uint8_t MPU6050::dmpInitialize(uint8_t rateDivisor, uint8_t mpuAddr) { // Lets get it over with fast Write everything once and set it up necely
uint8_t val;
uint16_t ival;
// Reset procedure per instructions in the "MPU-6000/MPU-6050 Register Map and Descriptions" page 41
Expand Down
5 changes: 5 additions & 0 deletions src/MPU6050_6Axis_MotionApps612.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ THE SOFTWARE.

#include "MPU6050.h"

// this divisor is pre configured into the above image and can't be modified at this time.
#ifndef MPU6050_DMP_FIFO_RATE_DIVISOR
#define MPU6050_DMP_FIFO_RATE_DIVISOR 0x01 // The New instance of the Firmware has this as the default
#endif

class MPU6050_6Axis_MotionApps612 : public MPU6050_Base {
public:
MPU6050_6Axis_MotionApps612(uint8_t address=MPU6050_DEFAULT_ADDRESS, void *wireObj=0) : MPU6050_Base(address, wireObj) { }
Expand Down
2 changes: 1 addition & 1 deletion src/MPU6050_9Axis_MotionApps41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,4 +884,4 @@ uint8_t MPU6050_9Axis_MotionApps41::dmpReadAndProcessFIFOPacket(uint8_t numPacke
// void MPU6050_9Axis_MotionApps41::dmpOverrideQuaternion(long *q);
uint16_t MPU6050_9Axis_MotionApps41::dmpGetFIFOPacketSize() {
return dmpPacketSize;
}
}
4 changes: 2 additions & 2 deletions src/MPU6050_9Axis_MotionApps41.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MPU6050_9Axis_MotionApps41 : public MPU6050_Base {
public:
MPU6050_9Axis_MotionApps41(uint8_t address=MPU6050_DEFAULT_ADDRESS, void *wireObj=0) : MPU6050_Base(address, wireObj) { }

uint8_t dmpInitialize(uint8_t rateDivisor = MPU6050_DMP_FIFO_RATE_DIVISOR, uint8_t mpuAddr = 0x68);
uint8_t dmpInitialize();
bool dmpPacketAvailable();

uint8_t dmpSetFIFORate(uint8_t fifoRate);
Expand Down Expand Up @@ -150,4 +150,4 @@ class MPU6050_9Axis_MotionApps41 : public MPU6050_Base {

typedef MPU6050_9Axis_MotionApps41 MPU6050;

#endif /* _MPU6050_6AXIS_MOTIONAPPS41_H_ */
#endif /* _MPU6050_6AXIS_MOTIONAPPS41_H_ */

0 comments on commit d9b0fb1

Please sign in to comment.