GithubHelp home page GithubHelp logo

Comments (8)

RobTillaart avatar RobTillaart commented on July 24, 2024 1

Read on the Arduino forum long ago that code in the constructor has the risk that not all hardware is initialized when constructor is executed and can cause unwanted side effects (aka crash). So initializing a variable to 42 is ok, but checking complexer IO e.g. I2C depends on when the Wire constructor is executed.

Satisfied with the library? Missing things?
Otherwise you may close the issue.

from sht31.

RobTillaart avatar RobTillaart commented on July 24, 2024

Hi Oscar,

Thanks for the issue, I'm rather busy at the moment so it can take a few days before diving into this.

from sht31.

RobTillaart avatar RobTillaart commented on July 24, 2024

Is there any error message?

from sht31.

oscarbaselga avatar oscarbaselga commented on July 24, 2024

Thanks for your quick response Rob!

No, there is no error message. The expected behavior is to print a debug message but it is not appearing. What is happening is that my ESP32 is interrupted by the watchdog:

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:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4

from sht31.

RobTillaart avatar RobTillaart commented on July 24, 2024

When commenting sht (declared as SHT31 sht;) calls, the rest of the code continues working.

This remark is ambiguous as sht is used multiple times.

Which line is commented?

Note: I have no hardware to setup an equivalent, so I depend on your testing.

from sht31.

oscarbaselga avatar oscarbaselga commented on July 24, 2024

I was referring to these lines: bool sht_begin = sht.begin(SHT31_ADDRESS); and sht.reset(); of the previous code.
The rest of the code is independent from SHT31 library, as it only prints some debug messages.

from sht31.

RobTillaart avatar RobTillaart commented on July 24, 2024

Can you create a minimal sketch that fails? As I have not enough clues yet.

I am using packages\esp32\hardware\esp32\1.0.6 in my tests (and I need to keep that config )

from sht31.

oscarbaselga avatar oscarbaselga commented on July 24, 2024

My fault!! It is already fixed. I do not know the reason but moving this code...

Wire.begin();
bool sht_begin = sht.begin(SHT31_ADDRESS);
sht.reset();
Wire.setClock(100000);

...out of the constructor, it works properly.
It is weird that with arduino-esp32 v1.0.6 worked but not with v2.0.5.

Thank you for your support, I will remove this issue after you read it so as not to mess up the repository.

from sht31.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.