Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The DEBUG build no longer compiles #80

Closed
benpeart opened this issue Mar 1, 2024 · 4 comments
Closed

The DEBUG build no longer compiles #80

benpeart opened this issue Mar 1, 2024 · 4 comments
Labels
Arduino IDE Using Arduino IDE Feedback Improvements or additions

Comments

@benpeart
Copy link
Contributor

benpeart commented Mar 1, 2024

If you attempt to compile with the DEBUG macro defined, the library does not compile with the error:

.pio\libdeps\debug\MPU6050\src\MPU6050_9Axis_MotionApps41.cpp: In member function 'uint8_t MPU6050_9Axis_MotionApps41::dmpInitialize()':
.pio\libdeps\debug\MPU6050\src\MPU6050_9Axis_MotionApps41.cpp:366:17: error: 'productID' was not declared in this scope
     DEBUG_PRINT(productID);

I have submitted a pull request that contains a two-part fix. The first part is to fix the compile error by commenting out the offending DEBUG_PRINT line. The second/better fix is to update the DEBUG_PRINT macros so that the structure of the macros ensures that the code is always validated at compile time but is not called when DEBUG is undefined. This will prevent stale debug code from accumulating when the debug version is not regularly compiled.

@AndreaZGuz
Copy link

Hello @benpeart !

Could you please tell me which example are you trying to compile?
Also, what board are you selecting to compile the .ino file you want to run?

Thank you.

@AndreaZGuz AndreaZGuz added Feedback Improvements or additions Arduino IDE Using Arduino IDE labels Mar 1, 2024
@benpeart
Copy link
Contributor Author

benpeart commented Mar 1, 2024

I was using MPU6050_6Axis_MotionApps20.h but any example that tries to build with the DEBUG flag set will have this error. If you look the cause is trivial - someone commented out the line in MPU6050_9Axis_MotionApps41.cpp that declares the productID variable but forgot to comment out the DEBUG_PRINT line that uses it.

I've submitted pull request #81 that fixes this with both a simple fix (comment out the line that tries to use productID) and a more robust fix that should prevent these types of errors in the future.

@AndreaZGuz
Copy link

Thank you @benpeart for the comments.

Currently, the .ino examples do not have issues during compilation when DEBUG is defined, but you have a point regarding the productID definition.
Your pull request will be checked.

Is there another issue we can help you with?

@AndreaZGuz
Copy link

Hi @benpeart !

If there are no more questions or issues we can help you with right now, we will close the query.
Our colleagues in the dev team will take a look at your pull request.

Please contact us again if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arduino IDE Using Arduino IDE Feedback Improvements or additions
Projects
None yet
Development

No branches or pull requests

2 participants