* added possibility to set Range, to enable/disable Autocalibrate and to calibrate maually ( see Datasheet v 1.2 : https://www.winsen-sensor.com/d/files/MH-Z14A.pdf
* Update MHZ.cpp
* Update MHZ.cpp
* Update MHZ.h
added calibrate Span, for complete functionality but commented out , due to professional use (req. constant atmosphere with 2k, 5k or 10k ppm CO2.).
corrected the bugs in MHZ.cpp also.
* Update MHZ.cpp
Added comments for Sensors with specific firmware.
Co-authored-by: Christoph Schultz <christoph@schultz1-christoph.de>
The literals for the preheating time are interpreted as int.
On Arduino Uno an int is 2 bytes in size, ranging from -32,768 to 32,767. Therefore, the calculated number of 3*60*1000=180000 does not fit in.
Added upper L to force the literal to long.
The datasheet clearly says that the CO2 level is 2000x(th-2ms)/(th+tl+4ms), so I think here it should say 2000 too. At least that resulted in way better results for me.
Prevent "...Status maybe not OK.." from always being printed when debug is on.
Changed the is !isReady check to isPreHeating when getting the latest temperature. The isReady check prevents the function from returing the pre stored temperature within MHZxxx_RESPONSE_TIME after the UART data has been requested. This is an unnecessary restriction.
Instead of just creating an issue that the library uses a lot of memory, I wanted to save you some work instead.
I have not tested this code, but i have double checked it.