enjoyneering / HTU21D

This is an Arduino library for HTU21D, Si7021 and SHT21 Digital Humidity & Temperature Sensor
55 stars 15 forks source link

Warning compling on ESP32 #10

Closed 9a4gl closed 3 years ago

9a4gl commented 4 years ago

Probably not specific to ESP32, but I got warnings when compiling for ESP32, here is the warning: lib\HTU21D\src\HTU21D.cpp: In member function 'float HTU21D::readHumidity(HTU21D_HUMD_OPERATION_MODE)': lib\HTU21D\src\HTU21D.cpp:249:43: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: Wire.requestFrom(HTU21D_ADDRESS, 3, true); //true, stop message after transmission & releas the I2C bus ^ In file included from lib\HTU21D\src\HTU21D.h:49:0, from lib\HTU21D\src\HTU21D.cpp:32: C:\Users\tihomir.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:98:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int, int) uint8_t requestFrom(int address, int size, int sendStop); ^ C:\Users\tihomir.platformio\packages\framework-arduinoespressif32\libraries\Wire\src/Wire.h:93:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint16_t, uint8_t, bool) uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop);

Attached is zipped patch that fixes the warning. It is zipped because it didn't allow me to attach .patch file.

Created PR https://github.com/enjoyneering/HTU21D/pull/11

enjoyneering commented 3 years ago

Well, about this we have to ask Arduino ESP32 support. Why they use INTEGER if, according to the I2C standard, device addresses are limited from 0 (general call) to 255. This is BYTE (UINT8_T) zone, not INTEGER. By the way, as far as i know on 32-bit processor INTEGER = int32_t.