RobTillaart/SHT31_SW

Demo sketch fails to compile

Closed this issue · 17 comments

I'm trying to test this - and the SHT85 library

I installed this library, with dependencies but examples/SHT31_demo/SHT31_demo.ino fails to compile

I'm using esp32->LOLIN Wemos D1 mini, but this also fails to compile if I tried Arduino Uno

SHT31_SW.h seems to be looking for SHT31.h which doesn't appear to be present

Note that the SHT85 demos also failed to compile - for different reasons see RobTillaart/SHT85#26

In file included from /private/var/folders/h7/r6nsnp591vq9t17_q33mks_c0000gn/T/.arduinoIDE-unsaved2024820-15193-1hk34uu.tyqqf/sketch_sep20a/sketch_sep20a.ino:9:0:
/Users/mitra/Documents/Arduino/libraries/SHT31_SW/SHT31_SW.h:20:10: fatal error: SHT31.h: No such file or directory
 #include "SHT31.h"
          ^~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

Thanks for the question, will try to come back to it later tiday.

@mitra42

From the readme.md file,
you need to install some other libraries this lib depends upon.
Then the error message should not pop up. You might need to close all instances of the IDE.

image

OK - the problem seems to be that the Ardunio IDE only recognizes the need for AsyncDelay and Softwire
Screenshot 2024-09-21 at 8 20 02 AM

I can confirm that the SHT31_SW demo compiles once I installed SHT31 - I see that [HT31_SW](https://github.com/RobTillaart/SHT31_SW/tree/master)/.arduino-ci.yml has

  libraries:
    - "SoftWire"
    - "AsyncDelay"
    - "SHT31"

So maybe thats a more recent fix that hasn't got into the version on Arduino IDE which is 0.3.0

@mitra42
Good catch, in fact it is missing in the library.properties file

name=SHT31_SW
version=0.3.0
author=Rob Tillaart <rob.tillaart@gmail.com>, Gunter Haug
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for the I2C SHT31 temperature and humidity sensor
paragraph=SoftWire,I2C,SHT30,SHT31,SHT35,SHT85
category=Sensors
url=https://github.com/RobTillaart/SHT31_SW
architectures=*
includes=SHT31_SW.h
depends=SoftWire,AsyncDelay    <<<<<<<<<<<<<<<<< missing

Will make a patch version later today, other duties are calling :)

@mitra42
Released version 0.3.1 with dependencies updated - both library.properties and library.json
Should be available in lib manager normally within ~8 hrs.

This compiles fine - I'm testing with a SHT30 - and I have no independent way of knowing the shield is working - I get the following errors when running it.


wdt reset
load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v00044930
~ld
������'�{��o<��$�l`��c����|�r��l�o���o��l`���{�d�l����SHT31_demo.ino

It stays in this loop resetting.

I will focus on the other issue (SHT85) first, trying to debug both code bases mostly gives interference.

The reboot loop is interesting ....

Yes - it looped at that point.

@mitra42

This compiles fine - I'm testing with a SHT30 - and I have no independent way of knowing the shield is working - I get the following errors when running it.

The shield is working with the SHT85 library by changing the address to 0x45 in the demo sketches.
Have you applied that change here already?

Yes, I did - and if the address is wrong the result is different, it just returns invalid data.

Just before it goes into the reboot loop there should be an exception code.
something like in this picture:

image

Well that was fun .... I wasn't able to repeat teh Exception but I was able to brick my ESP8266 !

Problem, I think, was that along with needing a switch to

#define SHT31_ADDRESS   0x45

the demo sketch uses
SoftWire sw(6, 7); // sda, scl

While on the Lolin SHT30 shield it needs to be
SoftWire sw(4, 5); // sda, scl

Its super annoying that there is no board Ifdef's to allow the demo to work on multiple platforms by ifdefing that line.

Its now working for me - and since I can't repeat the bug, maybe we should close this.

As an FYI for anyone else who hits the infamous esptool``timed out waiting for packet header none of the reinstalls, version changes in the many reports on the net worked for me, the problem seemed to be the esp8266 was doing something bad on pins 6 and 7 blocking reflashing. The fix was to unplug serial, hit Upload, then just at the end of the compile plug back in - the flashing process then gets a chance to do the upload before the sketch bricks it again.

Its super annoying that there is no board Ifdef's to allow the demo to work on multiple platforms by ifdefing that line.

Yes that has always been a point of attention / concern. There are several hundreds of boards in the Arduino ecosystem. Almost all boards expose pins that are also used internally or conditionally which might lead to conflicts. E.g. the standard UNO has a LED with a resistor on pin 13, so it will behave (electrically) slightly differently compared to the other pins. Also pin 0,1 are used for Serial, however if you do not use Serial, they are free for other IO uses except during upload / download of a sketch.
In short, it is impossible to test and verify the libraries for even a small subset.


Its now working for me - and since I can't repeat the bug, maybe we should close this.

The original problem is solved, you can read the sensor now, so yes the issue can be closed. (will do)
If new problems pop up, feel free to open a new issue.

Yes - and even when tested, its not possible to #ifdef it into the code to reflect what you've discovered. Usually its painless, but this time it bricked my board.