Comments (8)
Added value is too small
from dhtnew.
i would love a full integer version of the lib. Why on earth would one waste so a single byte too much for a horribly inaccurate sensor. Just ask the user of the lib to divide by 10.
There are some alternative libs, but none as feature rich as this one.
from dhtnew.
Thanks for this question.
I understand that a full integer version would same RAM and more importantly it would not need (to include) the floating point library.
Leaving the divide by 10 to the user is one strategy, the other is doing it in the library and
- round T and H to appropriate integers
- return Integer and decimal part separately
- or let user divide.
For sake if usability rounding in the lib seems to fit the integer approach best if one wants to keep the interface as much the same as possible..
Two strategies, a derived class or a stand alone class.with its own repo.
@ilikegitlab
How would you name the new integer class?
from dhtnew.
@ilikegitlab
Created a new library - under development - https://github.com/RobTillaart/DHTINT
Build of the examples looks good, so please verify if this works for you.
from dhtnew.
If problems arise, please open an issue under - https://github.com/RobTillaart/DHTINT
from dhtnew.
@RobTillaart
thanks! That was fast. I would indeed have called it exactly that!
I wonder though: is it not tedious to maintain a completely different branch for this? I would probably have made DHTnew use ints internally and #ifdeffed float/int as an option. But its your call! and it perfect for my current project.
from dhtnew.
The library is experimental and it might merge in the future sometime. As I maintain ~150 libraries one more or less isn't such a big deal, especially because DHTNEW is pretty stable.
Using #ifdef is also an option but I prefer a separate class above (user configured) conditional code as it is more explicit for beginners why the behavior / accuracy changes.
Furthermore this allowed me to use an explicit example to see the difference in footprint, if the example still would do
Serial.println(dht.teperature(), 2);
even if the function would return an int the floating point library would still be #included.
Offset
There is one point that caught my attention and which is not resolved in the code.
I would still like to set an offset in tenth of degrees (by multiplying by 10 perhaps) to be able to calibrate more accurately.
That would also imply that the values, the offset and div 10 should be done later as now.
Now I have whole degrees as offset, it won't affect rounding, but I think it is possible to do better.
Think I should open an issue for that .
from dhtnew.
done - RobTillaart/DHTINT#2
from dhtnew.
Related Issues (20)
- Still problems with measuring negative values (AM2301) HOT 4
- Sensors getting stuck at a certain value HOT 37
- Fix negative temperature below -25.5°C HOT 1
- Humidity values higher than 100% HOT 17
- F_CPU not defined for Arduino Nano RP2040 Connect HOT 3
- read() hangs with MkrWiFi + MkrConnector Board HOT 66
- DTH11 gets too short start impulse HOT 16
- setTempOffset and setHumOffset HOT 3
- Support for SonOff Si7021 HOT 10
- ESP32 error HOT 13
- Test sketch HOT 4
- Si7021 by Sonoff HOT 16
- DHT22 registers as type 70 in 0.4.14 HOT 12
- Support for DS18B20 HOT 3
- Sonoff Si7021 gives wrong temperature and humidity HOT 5
- Compiler warning, conversion float to double HOT 7
- Ticker compatibility HOT 12
- Add support for the AM2320, AM2321 and AM2322.
- consider an enhancement to be able to compile this lib directly under espressif/platformio without Arduino layer HOT 4
- Parallel processing of multiple Sensors HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhtnew.