Browse Source

display values from mqtt

ir
Hendrik Langer 5 years ago
parent
commit
11f84d4f72
  1. 55
      src/main.cpp

55
src/main.cpp

@ -232,7 +232,7 @@ void displayValues() {
display.print("Humidity"); display.print("Humidity");
display.setFont(&FreeSansBold9pt7b); display.setFont(&FreeSansBold9pt7b);
display.setCursor(70,y_offset+40); display.setCursor(70,y_offset+40);
display.printf("%.1f %", sensor_readings.humidity); display.printf("%.1f", sensor_readings.humidity);
// Pressure // Pressure
display.drawRect(130,y_offset+10,66,50,GxEPD_BLACK); display.drawRect(130,y_offset+10,66,50,GxEPD_BLACK);
@ -241,7 +241,7 @@ void displayValues() {
display.print("Pressure"); display.print("Pressure");
display.setFont(&FreeSansBold9pt7b); display.setFont(&FreeSansBold9pt7b);
display.setCursor(135,y_offset+40); display.setCursor(135,y_offset+40);
display.printf("%.1f\%", sensor_readings.pressure / 100.0F); display.printf("%.1f", sensor_readings.pressure / 100.0F);
// Other // Other
display.drawRect(195,y_offset+10,56,122-10,GxEPD_BLACK); display.drawRect(195,y_offset+10,56,122-10,GxEPD_BLACK);
@ -250,23 +250,62 @@ void displayValues() {
display.setCursor(200,y_offset+15); display.setCursor(200,y_offset+15);
display.println("VOC:"); display.println("VOC:");
display.setCursor(200,y_offset+25); display.setCursor(200,y_offset+25);
display.printf("%.1f %", sensor_readings.voc); display.printf("%.1f", sensor_readings.voc / 1000.0F);
// PM // PM
float pm10, pm25;
if (sds_active) {
pm10 = sensor_readings.pm10;
pm25 = sensor_readings.pm25;
} else if (std::isnormal(sensors_a4cf1211c3e4.pm10) || std::isnormal(sensors_a4cf1211c3e4.pm25)) {
pm10 = sensors_a4cf1211c3e4.pm10;
pm25 = sensors_a4cf1211c3e4.pm25;
} else if (std::isnormal(sensors_246f28d1fa5c.pm10) || std::isnormal(sensors_246f28d1fa5c.pm25)) {
pm10 = sensors_246f28d1fa5c.pm10;
pm25 = sensors_246f28d1fa5c.pm25;
} else if (std::isnormal(sensors_246f28d1a080.pm10) || std::isnormal(sensors_246f28d1a080.pm25)) {
pm10 = sensors_246f28d1a080.pm10;
pm25 = sensors_246f28d1a080.pm25;
} else {
pm10 = 0.0;
pm25 = 0.0;
}
display.setCursor(200,y_offset+45); display.setCursor(200,y_offset+45);
display.println("PM10 / 2.5:"); display.println("PM10 / 2.5:");
display.setCursor(200,y_offset+55); display.setCursor(200,y_offset+55);
display.printf("%.1f %", sensor_readings.pm10); display.printf("%.1f", pm10);
display.setCursor(200,y_offset+65); display.setCursor(200,y_offset+65);
display.printf("%.1f %", sensor_readings.pm25); display.printf("%.1f", pm25);
// UV // UV
float uvi, uva, uvb;
if (uv_active) {
uvi = sensor_readings.uvi;
uva = sensor_readings.uva;
uvb = sensor_readings.uvb;
} else if (std::isnormal(sensors_a4cf1211c3e4.uvi) || std::isnormal(sensors_a4cf1211c3e4.uva) || std::isnormal(sensors_a4cf1211c3e4.uvb)) {
uvi = sensors_a4cf1211c3e4.uvi;
uva = sensors_a4cf1211c3e4.uva;
uvb = sensors_a4cf1211c3e4.uvb;
} else if (std::isnormal(sensors_246f28d1fa5c.uvi) || std::isnormal(sensors_246f28d1fa5c.uva) || std::isnormal(sensors_246f28d1fa5c.uvb)) {
uvi = sensors_246f28d1fa5c.uvi;
uva = sensors_246f28d1fa5c.uva;
uvb = sensors_246f28d1fa5c.uvb;
} else if (std::isnormal(sensors_246f28d1a080.uvi) || std::isnormal(sensors_246f28d1a080.uva) || std::isnormal(sensors_246f28d1a080.uvb)) {
uvi = sensors_246f28d1a080.uvi;
uva = sensors_246f28d1a080.uva;
uvb = sensors_246f28d1a080.uvb;
} else {
uvi = 0.0;
uva = 0.0;
uvb = 0.0;
}
display.setCursor(200,y_offset+85); display.setCursor(200,y_offset+85);
display.println("UV Index/A/B:"); display.println("UV Index/A/B:");
display.setCursor(200,y_offset+95); display.setCursor(200,y_offset+95);
display.printf("%.1f %", sensor_readings.uvi); display.printf("%.1f", uvi);
display.setCursor(200,y_offset+105); display.setCursor(200,y_offset+105);
display.printf("%.1f %", sensor_readings.uva); display.printf("%.1f", uva);
display.setCursor(200,y_offset+115); display.setCursor(200,y_offset+115);
display.printf("%.1f %", sensor_readings.uvb); display.printf("%.1f", uvb);
// other nodes // other nodes
display.setFont(NULL); display.setFont(NULL);

Loading…
Cancel
Save