Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Add a public getRawData() function #179

Open
redbart opened this issue Feb 8, 2021 · 1 comment
Open

Improvement: Add a public getRawData() function #179

redbart opened this issue Feb 8, 2021 · 1 comment

Comments

@redbart
Copy link

redbart commented Feb 8, 2021

I am currently doing a project with an ESP32 where I need to store and transmit data over the internet from a DHT22, it would be nice to be able to use the 4-byte raw data from the sensor, as that is a smaller size that unnecessarily storing the floats. I propose a public function that simply allows a programmer to read the raw data of the sensor. Something like:

const byte* getRawData() const { return data; }

The programmer would be responsible for calling read() prior to this (or I suppose it could be integrated into the function and a nullptr returned if it fails).

@redbart redbart changed the title Add a public getRawData() function Improvement: Add a public getRawData() function Feb 8, 2021
@Adrian-Samoticha
Copy link

I had a similar complaint a few years ago when I was using this library. I was storing the read values in integer format anyway so I needed to convert the floats back to integers. On Arduino boards with no FPU and limited program memory, this may needlessly increase program size, along with decreasing performance and overall being “less elegant”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants