Git Product home page Git Product logo

tiny_sht4x's Introduction

tiny_sht4x

A library to interface with Sensirion SHT4x sensors without floats or divisions

I put this library together as I needed to use an SHT40 sensor on an ATTiny414 which has a very limited 256B of SRAM as well as 4KB of flash.
The basic example without Serial compiles to an additional 93 bytes of SRAM and 1282 bytes of code. While this isn't great, it fits. If anyone wants to further optimize it, be my guest :)

tiny_sht4x's People

Contributors

duckle29 avatar

Watchers

 avatar

tiny_sht4x's Issues

delay.h: No such file or directory

I've got the following error during compilation for espressif 32

.pio\libdeps\esp32dev\tiny_sht4x\src\sht4x.h:3:24: fatal error: util/delay.h: No such file or directory

Here is my platformio.ini

[platformio]
default_envs = esp32dev

[env]
upload_speed = 921600
monitor_speed = 115200
lib_ldf_mode = deep+
lib_compat_mode = strict

lib_deps =
    duckle/tiny_sht4x @ ^1.0.3

No error checking

Hi
This looks like an interesting library and I was about to use it in my project; however it currently has no error checking. If no response was received by getResponse() within the timeout, the contents of the buffer is still processed as if a response was obtained. That buffer is uninitialised, so it will contain unpredictable data, and consequently unpredictable (but possibly feasible) values will be returned by get_temp() and get_humi().
May I suggest that both get_response() and poll_temp_humi() should have a bool return type, and return false in the event of a timeout, so that this can be identified by the caller. Also m_temp_ticks and m_humi_ticks should be initialised to zero, in case get_temp()/get_humi() are called despite a bad read (or no read) so that you don't just get some random value back.
Thanks!
Ben

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.