|
@ -51,15 +51,15 @@ XD0OTA ota("esp32-weatherstation"); |
|
|
XD0MQTT mqtt; |
|
|
XD0MQTT mqtt; |
|
|
|
|
|
|
|
|
struct __attribute__((packed)) sensor_readings_t { |
|
|
struct __attribute__((packed)) sensor_readings_t { |
|
|
float temperature = 0.0; // °C
|
|
|
float temperature = NAN; // °C
|
|
|
float humidity = 0.0; // %H
|
|
|
float humidity = NAN; // %H
|
|
|
float pressure = 0.0; // Pa
|
|
|
float pressure = NAN; // Pa
|
|
|
uint32_t voc = 0; // Ohm
|
|
|
uint32_t voc = 0; // Ohm
|
|
|
float pm10 = 0.0; // µg/m³
|
|
|
float pm10 = NAN; // µg/m³
|
|
|
float pm25 = 0.0; // µg/m³
|
|
|
float pm25 = NAN; // µg/m³
|
|
|
float uvi = 0.0; |
|
|
float uvi = NAN; |
|
|
float uva = 0.0; |
|
|
float uva = NAN; |
|
|
float uvb = 0.0; |
|
|
float uvb = NAN; |
|
|
float temperature_max = NAN; // °C
|
|
|
float temperature_max = NAN; // °C
|
|
|
float temperature_min = NAN; // °C
|
|
|
float temperature_min = NAN; // °C
|
|
|
} sensor_readings; |
|
|
} sensor_readings; |
|
@ -266,18 +266,18 @@ void displayValues() { |
|
|
if (sds_active) { |
|
|
if (sds_active) { |
|
|
pm10 = sensor_readings.pm10; |
|
|
pm10 = sensor_readings.pm10; |
|
|
pm25 = sensor_readings.pm25; |
|
|
pm25 = sensor_readings.pm25; |
|
|
} else if (std::isnormal(sensors_a4cf1211c3e4.pm10) || std::isnormal(sensors_a4cf1211c3e4.pm25)) { |
|
|
} else if (!isnan(sensors_a4cf1211c3e4.pm10) || !isnan(sensors_a4cf1211c3e4.pm25)) { |
|
|
pm10 = sensors_a4cf1211c3e4.pm10; |
|
|
pm10 = sensors_a4cf1211c3e4.pm10; |
|
|
pm25 = sensors_a4cf1211c3e4.pm25; |
|
|
pm25 = sensors_a4cf1211c3e4.pm25; |
|
|
} else if (std::isnormal(sensors_246f28d1fa5c.pm10) || std::isnormal(sensors_246f28d1fa5c.pm25)) { |
|
|
} else if (!isnan(sensors_246f28d1fa5c.pm10) || !isnan(sensors_246f28d1fa5c.pm25)) { |
|
|
pm10 = sensors_246f28d1fa5c.pm10; |
|
|
pm10 = sensors_246f28d1fa5c.pm10; |
|
|
pm25 = sensors_246f28d1fa5c.pm25; |
|
|
pm25 = sensors_246f28d1fa5c.pm25; |
|
|
} else if (std::isnormal(sensors_246f28d1a080.pm10) || std::isnormal(sensors_246f28d1a080.pm25)) { |
|
|
} else if (!isnan(sensors_246f28d1a080.pm10) || !isnan(sensors_246f28d1a080.pm25)) { |
|
|
pm10 = sensors_246f28d1a080.pm10; |
|
|
pm10 = sensors_246f28d1a080.pm10; |
|
|
pm25 = sensors_246f28d1a080.pm25; |
|
|
pm25 = sensors_246f28d1a080.pm25; |
|
|
} else { |
|
|
} else { |
|
|
pm10 = 0.0; |
|
|
pm10 = NAN; |
|
|
pm25 = 0.0; |
|
|
pm25 = NAN; |
|
|
} |
|
|
} |
|
|
display.setCursor(200,y_offset+45); |
|
|
display.setCursor(200,y_offset+45); |
|
|
display.println("PM10 / 2.5:"); |
|
|
display.println("PM10 / 2.5:"); |
|
@ -291,22 +291,22 @@ void displayValues() { |
|
|
uvi = sensor_readings.uvi; |
|
|
uvi = sensor_readings.uvi; |
|
|
uva = sensor_readings.uva; |
|
|
uva = sensor_readings.uva; |
|
|
uvb = sensor_readings.uvb; |
|
|
uvb = sensor_readings.uvb; |
|
|
} else if (std::isnormal(sensors_a4cf1211c3e4.uvi) || std::isnormal(sensors_a4cf1211c3e4.uva) || std::isnormal(sensors_a4cf1211c3e4.uvb)) { |
|
|
} else if (!isnan(sensors_a4cf1211c3e4.uvi) || !isnan(sensors_a4cf1211c3e4.uva) || !isnan(sensors_a4cf1211c3e4.uvb)) { |
|
|
uvi = sensors_a4cf1211c3e4.uvi; |
|
|
uvi = sensors_a4cf1211c3e4.uvi; |
|
|
uva = sensors_a4cf1211c3e4.uva; |
|
|
uva = sensors_a4cf1211c3e4.uva; |
|
|
uvb = sensors_a4cf1211c3e4.uvb; |
|
|
uvb = sensors_a4cf1211c3e4.uvb; |
|
|
} else if (std::isnormal(sensors_246f28d1fa5c.uvi) || std::isnormal(sensors_246f28d1fa5c.uva) || std::isnormal(sensors_246f28d1fa5c.uvb)) { |
|
|
} else if (!isnan(sensors_246f28d1fa5c.uvi) || !isnan(sensors_246f28d1fa5c.uva) || !isnan(sensors_246f28d1fa5c.uvb)) { |
|
|
uvi = sensors_246f28d1fa5c.uvi; |
|
|
uvi = sensors_246f28d1fa5c.uvi; |
|
|
uva = sensors_246f28d1fa5c.uva; |
|
|
uva = sensors_246f28d1fa5c.uva; |
|
|
uvb = sensors_246f28d1fa5c.uvb; |
|
|
uvb = sensors_246f28d1fa5c.uvb; |
|
|
} else if (std::isnormal(sensors_246f28d1a080.uvi) || std::isnormal(sensors_246f28d1a080.uva) || std::isnormal(sensors_246f28d1a080.uvb)) { |
|
|
} else if (!isnan(sensors_246f28d1a080.uvi) || !isnan(sensors_246f28d1a080.uva) || !isnan(sensors_246f28d1a080.uvb)) { |
|
|
uvi = sensors_246f28d1a080.uvi; |
|
|
uvi = sensors_246f28d1a080.uvi; |
|
|
uva = sensors_246f28d1a080.uva; |
|
|
uva = sensors_246f28d1a080.uva; |
|
|
uvb = sensors_246f28d1a080.uvb; |
|
|
uvb = sensors_246f28d1a080.uvb; |
|
|
} else { |
|
|
} else { |
|
|
uvi = 0.0; |
|
|
uvi = NAN; |
|
|
uva = 0.0; |
|
|
uva = NAN; |
|
|
uvb = 0.0; |
|
|
uvb = NAN; |
|
|
} |
|
|
} |
|
|
display.setCursor(200,y_offset+85); |
|
|
display.setCursor(200,y_offset+85); |
|
|
display.println("UV Index/A/B:"); |
|
|
display.println("UV Index/A/B:"); |
|
@ -532,12 +532,9 @@ void loop() |
|
|
lastDisplayUpdate = millis(); |
|
|
lastDisplayUpdate = millis(); |
|
|
|
|
|
|
|
|
getSensorMeasurements(); |
|
|
getSensorMeasurements(); |
|
|
|
|
|
|
|
|
displayValues(); |
|
|
displayValues(); |
|
|
|
|
|
|
|
|
printValues(); |
|
|
printValues(); |
|
|
sendValues(); |
|
|
sendValues(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(wifiMulti.run() != WL_CONNECTED) { |
|
|
if(wifiMulti.run() != WL_CONNECTED) { |
|
|