adafruit/Adafruit_Sensor

sensor_t typename clash

maxgerhardt opened this issue · 3 comments

typedef struct {
char name[12]; /**< sensor name */
int32_t version; /**< version of the hardware + driver */
int32_t sensor_id; /**< unique sensor identifier */
int32_t type; /**< this sensor's type (ex. SENSOR_TYPE_LIGHT) */
float max_value; /**< maximum value of this sensor's value in SI units */
float min_value; /**< minimum value of this sensor's value in SI units */
float resolution; /**< smallest difference between two values reported by this
sensor */
int32_t min_delay; /**< min delay in microseconds between events. zero = not a
constant rate */
} sensor_t;

with its very generic sensor_t typename directly clashes with

https://github.com/espressif/arduino-esp32/blob/5f6d093d4a8a371c78acd6e1a0e7a95b7346cbec/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h#L193

A type used in the esp_camera system, aka a camera sensor. Using both these libraries in the same code file is not possible (but in split files it is).

Not sure if that should be fixed since changing the name breaks compatibility, but at least FYI for other people running into this error during development, as they did in our forum.

udif commented

Can't you avoid this in your code by encapsulating one of them in a namespace?