adafruit / Adafruit_Si7021

Arduino library for Adafruit Si7021
34 stars 28 forks source link

Remove incorrect ESP32 customization #6

Closed stickbreaker closed 6 years ago

stickbreaker commented 6 years ago

I2C ReSTART operations on ESP32 are queued and not executed until an i2c transaction with a STOP is processed. To indicate this queuing, Wire.endTransmission(false); or Wire.requestFrom(id,size,false); returns I2C_ERROR_CONTINUE. The prior revision of this library added ReSTART error checking, BUT, did not use ReSTART operations. So the error detection code was falsely detecting success as an error.

ladyada commented 6 years ago

thanks did you check this on an ESP32?

stickbreaker commented 6 years ago

I just went through the code looking at the error detection, ReSTART usage. This code only uses ReSTART once, in the uint16_t Adafruit_Si7021::_readRegister16(uint8_t reg)() function, it does not do any error detection, so the issue is mute.

I don't have one of these sensors, so I cannot test the code. I just corrected the visible errors. I do not know if the code should use ReSTART (Wire.endTransmission(false)) to correctly utilize the hardware, but I do know that Wire.endTransmission() will never return I2C_ERROR_CONTINUE as a success code.

Chuck.

7h30n3 commented 6 years ago

thanks did you check this on an ESP32?

I tested it on an NodeMCU 32S and it works now.

Just one more thing. I noticed that the latest version you can download from the library manager in the Arduino IDE is just 1.0.1. So at first I was a little confused why the github version has so many more lines of code.

ladyada commented 6 years ago

thanks @7h30n3 ! we'll bump and do a release

quito96 commented 5 years ago

Hi layada, i use the latest @file Adafruit_Si7021.h v1.1 but i there is no communication between my esp32 and the original Adafruit SI7021 Modul.

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1100 load:0x40078000,len:10088 load:0x40080400,len:6380 entry 0x400806a4 Contact Si7021 test! [V][esp32-hal-i2c.c:1483] i2cInit(): num=0 sda=21 scl=22 freq=0 [V][esp32-hal-i2c.c:1677] i2cSetFrequency(): freq=100000Hz [V][esp32-hal-i2c.c:1692] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=100000Hz [V][esp32-hal-i2c.c:1698] i2cSetFrequency(): Fifo delta=1 Did not find Si7021 sensor!

How can i fix this issue?

BR

ChuckVanzant commented 5 years ago

@quito96, try using the latest release (November, 2018) from GitHub. Include the .h and .cpp files.

quito96 commented 5 years ago

Hi Chuck, i use the latest release from git hub .

quito96 commented 5 years ago

sorry, the problem was a defective esp32….