i2cdevlib icon indicating copy to clipboard operation
i2cdevlib copied to clipboard

unclear macro definition

Open brand17 opened this issue 3 years ago • 0 comments

I see strange definitions in the lines 109-113 of the header https://github.com/jrowberg/i2cdevlib/blob/master/ESP32_ESP-IDF/components/MPU6050/MPU6050_6Axis_MotionApps20.h

#define HEX "f"
#define DEBUG_PRINT(x) printf("%d", x)
#define DEBUG_PRINTF(x, y) Serial.print(x, y)
#define DEBUG_PRINTLN(x) printf("%s\n", x)
#define DEBUG_PRINTLNF(x, y) printf("%#06x%s\n", x, y)

There are a lot of calls like DEBUG_PRINTLNF(getIntStatus(), HEX); in the library.

As a result "f" is concatenated to the real getIntStatus() value.

For example, if the status is 1 - I see: "Current interrupt status - 0x0001f".

It is misleading.

What is a purpose of such behaviour?

brand17 avatar Jul 02 '22 15:07 brand17