Use MQTT only in normal mode

This commit is contained in:
Mathieu Maret 2016-11-15 22:49:04 +01:00
parent d6a2be13e1
commit d49e0a5fff

View File

@ -254,6 +254,7 @@ void loop() {
ArduinoOTA.handle();
} else {
server.handleClient();
if (mode == BOOTMODE_NORMAL)
MqttCheckSubscription();
delay(CONFIG_WEB_DELAY_MS);
@ -264,6 +265,7 @@ void loop() {
SKETCH_DEBUG_PRINT(temp);
SKETCH_DEBUG_PRINT(" Pressure mB ");
SKETCH_DEBUG_PRINTLN(pressure);
if (mode == BOOTMODE_NORMAL)
MqttPublish(temp, pressure);
}
if (!DHTGetTempAndHumidity(dhtTemp, dhtHumidity)) {
@ -271,12 +273,14 @@ void loop() {
SKETCH_DEBUG_PRINT(dhtTemp);
SKETCH_DEBUG_PRINT(" Humidity ");
SKETCH_DEBUG_PRINTLN(dhtHumidity);
if (mode == BOOTMODE_NORMAL)
MqttDhtPublish(dhtTemp, dhtHumidity);
}
if (!DryGetMeasure(dryness)){
SKETCH_DEBUG_PRINT("Current dryness ");
SKETCH_DEBUG_PRINT((dryness*100)/1024);
SKETCH_DEBUG_PRINTLN("%");
if (mode == BOOTMODE_NORMAL)
MqttDryPublish(dryness);
}
nbCycle = 0;