-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBME280Sensor.cpp
39 lines (33 loc) · 900 Bytes
/
BME280Sensor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "BME280Sensor.h"
#ifdef MYS_TOOLKIT_DEBUG
extern HardwareSerial MYS_TOOLKIT_SERIAL;
#endif
namespace mys_toolkit {
bool BME280Sensor::begin_()
{
auto success = bmeSensor_.begin();
#ifdef MYS_TOOLKIT_DEBUG
if(success){
MYS_TOOLKIT_SERIAL.println("Found BME280 sensor");
logMsg("Found BME280 sensor");
}
else {
MYS_TOOLKIT_SERIAL.println("Could not find BME280 sensor!");
logMsg("Could not find BME280 sensor!");
}
#endif
return success;
}
unsigned long BME280Sensor::update_()
{
humidity_.update(bmeSensor_.hum());
temperature_.update(bmeSensor_.temp());
return SLEEP_TIME;
}
BME280Sensor::BME280Sensor(uint8_t humSensorId, uint8_t tempSensorId,
float humTreshold, float tempTreshold)
: humidity_(humSensorId, V_HUM, S_HUM, humTreshold),
temperature_(tempSensorId, V_TEMP, S_TEMP, tempTreshold)
{
}
} //mys_toolkit