Commit 551916a6 authored by Melroy van den Berg's avatar Melroy van den Berg

Add comments

parent 7595b0db
Pipeline #1073 passed with stages
in 14 seconds
......@@ -80,7 +80,9 @@ int Controller::OpenI2C() {
return i2c_fd;
}
/**
* \brief Initialize Temp/Humid/Pressure sensor
*/
void Controller::InitTempSensor(int i2c_fd) {
bme280_settings settings;
// Set indoor settings
......@@ -107,10 +109,16 @@ void Controller::InitTempSensor(int i2c_fd) {
SetAbsoluteHumidity();
}
/**
* \brief Initialize CO2 sensor
*/
void Controller::InitCO2Sensor() {
this->mhz19b = new MHZ19B();
}
/**
* \brief Initialize fine dust sensor
*/
void Controller::InitDustSensor() {
this->pmsa = new PMSA003();
if(!pmsa->Init()) {
......@@ -119,6 +127,9 @@ void Controller::InitDustSensor() {
// Wait 30 secs from sleep mode, before stable
}
/**
* \brief Initialize TVOC Gas sensor
*/
void Controller::InitGasSensor(int i2c_fd) {
this->sgp = new SGP30(i2c_fd);
// Select the sensor on the bus
......@@ -139,8 +150,13 @@ void Controller::InitGasSensor(int i2c_fd) {
// TODO: first 20 seconds after init, returns fixed values (so should be ignored)
}
/**
* \brief Get a single temperature/humidity reading, calculate absolute humidity and store it
*/
void Controller::SetAbsoluteHumidity() {
// TODO: Select sensor on I2C bus?
if(!bme->Select()) {
throw std::runtime_error("Could not select the temp/humid/pressure sensor!\n");
}
bme->SetSensorMode(BME280_FORCED_MODE);
// 1/60Hz = 60000 ms
......@@ -227,7 +243,7 @@ bool Controller::GasReading() {
if(!sgp->Select()) {
throw std::runtime_error("Could not select the gas sensor!\n");
}
int counter = 0;
while(counter < 40) {
// Do measurement
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment