Correct indentation and coding style
This commit is contained in:
parent
f36d572070
commit
11bf7f6389
1 changed files with 17 additions and 18 deletions
|
@ -55,10 +55,10 @@ U8G2LOG u8g2log;
|
||||||
* @param humidity [%RH]
|
* @param humidity [%RH]
|
||||||
*/
|
*/
|
||||||
uint32_t getAbsoluteHumidity(float temperature, float humidity) {
|
uint32_t getAbsoluteHumidity(float temperature, float humidity) {
|
||||||
// approximation formula from Sensirion SGP30 Driver Integration chapter 3.15
|
// approximation formula from Sensirion SGP30 Driver Integration chapter 3.15
|
||||||
const float absoluteHumidity = 216.7f * ((humidity / 100.0f) * 6.112f * exp((17.62f * temperature) / (243.12f + temperature)) / (273.15f + temperature)); // [g/m^3]
|
const float absoluteHumidity = 216.7f * ((humidity / 100.0f) * 6.112f * exp((17.62f * temperature) / (243.12f + temperature)) / (273.15f + temperature)); // [g/m^3]
|
||||||
const uint32_t absoluteHumidityScaled = static_cast<uint32_t>(1000.0f * absoluteHumidity); // [mg/m^3]
|
const uint32_t absoluteHumidityScaled = static_cast<uint32_t>(1000.0f * absoluteHumidity); // [mg/m^3]
|
||||||
return absoluteHumidityScaled;
|
return absoluteHumidityScaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
@ -96,28 +96,25 @@ void setup() {
|
||||||
//Init BME280 sensor
|
//Init BME280 sensor
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
while(!bme.begin())
|
while(!bme.begin()) {
|
||||||
{
|
|
||||||
u8g2log.print("Could not find BME280 sensor!\n");
|
u8g2log.print("Could not find BME280 sensor!\n");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(bme.chipModel())
|
switch(bme.chipModel()) {
|
||||||
{
|
case BME280::ChipModel_BME280:
|
||||||
case BME280::ChipModel_BME280:
|
u8g2log.print("Found BME280 sensor! Success.\n");
|
||||||
u8g2log.print("Found BME280 sensor! Success.\n");
|
break;
|
||||||
break;
|
case BME280::ChipModel_BMP280:
|
||||||
case BME280::ChipModel_BMP280:
|
u8g2log.print("Found BMP280 sensor! No Humidity available.\n");
|
||||||
u8g2log.print("Found BMP280 sensor! No Humidity available.\n");
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
u8g2log.print("Found UNKNOWN sensor! Error!\n");
|
||||||
u8g2log.print("Found UNKNOWN sensor! Error!\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Init SGP30 sensor
|
//Init SGP30 sensor
|
||||||
while(!sgp.begin())
|
while(!sgp.begin()) {
|
||||||
{
|
|
||||||
u8g2log.print("Could not find SGP30 sensor!\n");
|
u8g2log.print("Could not find SGP30 sensor!\n");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
@ -199,3 +196,5 @@ void loop() {
|
||||||
delay(60000);
|
delay(60000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// vim: set ts=2 sw=2 et:
|
||||||
|
|
Loading…
Reference in a new issue