Fix indent in DHT

This commit is contained in:
Mathieu Maret 2016-07-08 01:02:01 +02:00
parent 406eaaa24e
commit 2515e577a6
1 changed files with 10 additions and 10 deletions

View File

@ -1,28 +1,28 @@
#ifdef CONFIG_ENABLE_DHT #ifdef CONFIG_ENABLE_DHT
#include "sensor_DHT.h" #include "sensor_DHT.h"
int DHTSetup(int pin){ int DHTSetup(int pin){
dht = new DHT(pin, DHTTYPE); dht = new DHT(pin, DHTTYPE);
dht->begin(); dht->begin();
return 0; return 0;
} }
int DHTGetTempAndHumidity(float &t, float &h){ int DHTGetTempAndHumidity(float &t, float &h){
if(!DHTIsConnected()) if(!DHTIsConnected())
goto err; goto err;
t = dht->readTemperature(); t = dht->readTemperature();
h = dht->readHumidity(); h = dht->readHumidity();
if(isnan(t) || isnan(h)) if(isnan(t) || isnan(h))
goto err; goto err;
return 0; return 0;
err: err:
t=0; t=0;
h=0; h=0;
return -1; return -1;
} }
bool DHTIsConnected(){ bool DHTIsConnected(){
//No way to know if connected //No way to know if connected
//Check at least if initialized //Check at least if initialized
return dht != NULL; return dht != NULL;
} }
#endif #endif