Browse Source

remove printValues()

main
Hendrik Langer 5 years ago
parent
commit
638f8af729
  1. 67
      src/main.cpp

67
src/main.cpp

@ -260,6 +260,9 @@ void getSensorMeasurements() {
sensor_readings.temperature = bme280.readTemperature();
sensor_readings.humidity = bme280.readHumidity();
sensor_readings.pressure_raw = bme280.readPressure();
ESP_LOGI(TAG, "Temperature : %8.2f °C", sensor_readings.temperature);
ESP_LOGI(TAG, "Pressure (Raw): %8.2f Pa", sensor_readings.pressure_raw);
ESP_LOGI(TAG, "Humidity : %8.2f %", sensor_readings.humidity);
}
if (sensors_active.bme680) {
bme680.endReading(); // ToDo
@ -268,6 +271,10 @@ void getSensorMeasurements() {
sensor_readings.humidity = bme680.humidity;
sensor_readings.pressure_raw = bme680.pressure;
sensor_readings.voc = bme680.gas_resistance;
ESP_LOGI(TAG, "Temperature : %8.2f °C", sensor_readings.temperature);
ESP_LOGI(TAG, "Pressure (Raw): %8.2f Pa", sensor_readings.pressure_raw);
ESP_LOGI(TAG, "Humidity : %8.2f %", sensor_readings.humidity);
ESP_LOGI(TAG, "VOC : %5lu kOhm", sensor_readings.voc);
} else {
Serial.println("Failed to perform reading :(");
}
@ -295,6 +302,9 @@ void getSensorMeasurements() {
sensor_readings.uvi = uv.readUVI();
sensor_readings.uva = uv.readUVA();
sensor_readings.uvb = uv.readUVB();
ESP_LOGI(TAG, "UVI : %8.2f", sensor_readings.uvi);
ESP_LOGI(TAG, "UVA : %8.2f", sensor_readings.uva);
ESP_LOGI(TAG, "UVB : %8.2f", sensor_readings.uvb);
}
if (sensors_active.light) {
@ -315,6 +325,7 @@ void getSensorMeasurements() {
Serial.println(F("Setting MTReg to default value for normal light environment"));
}
}
ESP_LOGI(TAG, "Lux : %8.2f lx", sensor_readings.lux);
}
if (sensors_active.sds) {
@ -322,12 +333,18 @@ void getSensorMeasurements() {
if (pm.isOk()) {
sensor_readings.pm10 = pm.pm10;
sensor_readings.pm25 = pm.pm25;
ESP_LOGI(TAG, "PM10 : %8.2f µg/m³", sensor_readings.pm10);
ESP_LOGI(TAG, "PM2.5 : %8.2f µg/m³", sensor_readings.pm25);
}
}
sensor_readings.battery = analogRead(_VBAT);
sensor_readings.rssi = WiFi.RSSI();
ESP_LOGI(TAG, "RSSI : %5d dBm", sensor_readings.rssi);
ESP_LOGI(TAG, "Battery : %5d ", sensor_readings.battery);
ESP_LOGI(TAG, "Heap : %5lu", ESP.getFreeHeap());
sensor_readings.lastUpdate = millis();
}
@ -565,55 +582,6 @@ void displayValues() {
}
void printValues() {
if (sensors_active.bme280 || sensors_active.bme680) {
#define SEALEVELPRESSURE_HPA (1013.25)
Serial.print("Temperature = ");
Serial.print(sensor_readings.temperature);
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(sensor_readings.pressure);
Serial.println(" hPa");
Serial.print("Pressure [RAW] = ");
Serial.print(sensor_readings.pressure_raw / 100.0F);
Serial.println(" hPa");
Serial.print("Humidity = ");
Serial.print(sensor_readings.humidity);
Serial.println(" %");
}
if (sensors_active.bme680) {
Serial.print("VOC = ");
Serial.print(sensor_readings.voc / 1000.0F);
Serial.println(" kOhm");
}
Serial.println();
if (sensors_active.uv) {
Serial.print("UV Index reading: "); Serial.println(sensor_readings.uvi);
Serial.print("Raw UVA reading: "); Serial.println(sensor_readings.uva);
Serial.print("Raw UVB reading: "); Serial.println(sensor_readings.uvb);
Serial.println();
}
if (sensors_active.sds) {
Serial.print("PM2.5 = ");
Serial.print(sensor_readings.pm25);
Serial.print(", PM10 = ");
Serial.println(sensor_readings.pm10);
}
Serial.print("RSSI: "); Serial.println(sensor_readings.rssi);
Serial.print("Battery: "); Serial.println(sensor_readings.battery);
Serial.print("Free HEAP: "); Serial.println(ESP.getFreeHeap());
}
void sendValues() {
/* send values MQTT */
if (sensors_active.bme280 || sensors_active.bme680) {
@ -848,7 +816,6 @@ void loop()
getSensorMeasurements();
displayValues();
printValues();
sendValues();
int runtime = millis()/1000;

Loading…
Cancel
Save