diff --git a/src/main.cpp b/src/main.cpp index df682c9..06d9707 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,6 +31,10 @@ #include "icons.h" +extern "C" { +uint8_t temprature_sens_read(); +} + static const char* TAG = "MAIN"; WiFiMulti wifiMulti; @@ -156,7 +160,12 @@ void sendValues() { mqtt.publish(topic_temperature.c_str(), temperature, strlen(temperature)); mqtt.publish(topic_humidity.c_str(), humidity, strlen(humidity)); mqtt.publish(topic_pressure.c_str(), pressure, strlen(pressure)); -} + } else { + String topic_temperature = String("thomas/sensor/") + ota.getMAC() + String("/temperature"); + float esp32_temperature = (temprature_sens_read() - 32) / 1.8; + char temperature[8]; sprintf(temperature, "%.2f", esp32_temperature-29.40); + mqtt.publish(topic_temperature.c_str(), temperature, strlen(temperature)); + } if (uv_active) { String topic_uvi = String("thomas/sensor/") + ota.getMAC() + String("/uvi"); @@ -288,7 +297,7 @@ void loop() ESP_LOGD(TAG, "loop()"); /* Do an e-paper display refresh every 2 minutes */ - if (millis() - lastDisplayUpdate >= 2*60*1000) { + if (millis() - lastDisplayUpdate >= 1*60*1000) { lastDisplayUpdate = millis(); display.setFullWindow(); display.setRotation(1); @@ -314,6 +323,9 @@ void loop() display.print(bme.readPressure() / 100.0F); display.println(" hPa"); } else { + display.print("Temperatur: "); + float esp32_temperature = (temprature_sens_read() - 32) / 1.8; + display.println(esp32_temperature-29.40); display.println("kein BME280"); }