tobiasschuerg / MH-Z-CO2-Sensors

Arduino imeplementation for CO2 sensors of the MH-Z series (Intelligent Infrared CO2 Module)
MIT License
77 stars 40 forks source link

getLastTemperature using isReady #6

Closed mariusebastian closed 6 years ago

mariusebastian commented 6 years ago

getLastTemperature returns not ready (-5) if it is called immediately after readCO2UART. This happens because getLastTemperature() calls isReady() which will return false if called too often compared to the MHZxxx_RESPONSE_TIME. It should not be necessary to add a delay between reading uart value and returning the 4th byte og said value.

It should not be necessary to call isReady() in getLastTemperature() as it only returns pre stored values. Propose to remove the call or call isPreHeating() instead.

mariusebastian commented 6 years ago

included this in a pull request instead

tobiasschuerg commented 6 years ago

Thanks for the PR!