MQTT nun mit PubSub
Grafik etwas angepasst
This commit is contained in:
21
src/main.cpp
21
src/main.cpp
@@ -75,16 +75,15 @@ void setup() {
|
||||
connectToWifi();
|
||||
|
||||
// Start MQTT
|
||||
setupMQTT();
|
||||
connectToMqtt();
|
||||
Serial.println("MQTT started");
|
||||
|
||||
setup_mqtt();
|
||||
|
||||
timeinfo = gettheTime(NTPREADTIME);
|
||||
showDateTime(timeinfo);
|
||||
|
||||
bmeReadtimer = millis();
|
||||
|
||||
drawChart();
|
||||
showResetTime(timeinfo);
|
||||
|
||||
/*
|
||||
// Register print function for debugging
|
||||
@@ -108,15 +107,21 @@ void loop() {
|
||||
if (millis() - bmeReadtimer > bmeReadTime) {
|
||||
bmeReadtimer = millis();
|
||||
bmedata = readBME280();
|
||||
publishMQTTmessage(bmedata.temp, bmedata.hum);
|
||||
doPublish(bmedata.temp+arcTemp.value_offset, bmedata.hum+arcHum.value_offset);
|
||||
}
|
||||
if (millis() - updatetimer > updateTime) {
|
||||
updatetimer = millis();
|
||||
updatechartData(bmedata.temp, bmedata.hum);
|
||||
setValuetoArc(arcTemp, bmedata.temp);
|
||||
setValuetoArc(arcHum, bmedata.hum);
|
||||
updatechartData(bmedata.temp+arcTemp.value_offset, bmedata.hum+arcHum.value_offset);
|
||||
setValuetoArc(arcTemp, bmedata.temp+arcTemp.value_offset);
|
||||
setValuetoArc(arcHum, bmedata.hum+arcHum.value_offset);
|
||||
}
|
||||
|
||||
if (!client.connected())
|
||||
{
|
||||
reconnect();
|
||||
}
|
||||
client.loop();
|
||||
|
||||
lv_task_handler(); // let the GUI do its work
|
||||
lv_tick_inc(5); // tell LVGL how much time has passed
|
||||
delay(5); // let this time pass
|
||||
|
||||
Reference in New Issue
Block a user