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,7 +254,8 @@ void loop() {
ArduinoOTA.handle(); ArduinoOTA.handle();
} else { } else {
server.handleClient(); server.handleClient();
MqttCheckSubscription(); if (mode == BOOTMODE_NORMAL)
MqttCheckSubscription();
delay(CONFIG_WEB_DELAY_MS); delay(CONFIG_WEB_DELAY_MS);
nbCycle++; nbCycle++;
@ -264,20 +265,23 @@ void loop() {
SKETCH_DEBUG_PRINT(temp); SKETCH_DEBUG_PRINT(temp);
SKETCH_DEBUG_PRINT(" Pressure mB "); SKETCH_DEBUG_PRINT(" Pressure mB ");
SKETCH_DEBUG_PRINTLN(pressure); SKETCH_DEBUG_PRINTLN(pressure);
MqttPublish(temp, pressure); if (mode == BOOTMODE_NORMAL)
MqttPublish(temp, pressure);
} }
if (!DHTGetTempAndHumidity(dhtTemp, dhtHumidity)) { if (!DHTGetTempAndHumidity(dhtTemp, dhtHumidity)) {
SKETCH_DEBUG_PRINT("Current T°C "); SKETCH_DEBUG_PRINT("Current T°C ");
SKETCH_DEBUG_PRINT(dhtTemp); SKETCH_DEBUG_PRINT(dhtTemp);
SKETCH_DEBUG_PRINT(" Humidity "); SKETCH_DEBUG_PRINT(" Humidity ");
SKETCH_DEBUG_PRINTLN(dhtHumidity); SKETCH_DEBUG_PRINTLN(dhtHumidity);
MqttDhtPublish(dhtTemp, dhtHumidity); if (mode == BOOTMODE_NORMAL)
MqttDhtPublish(dhtTemp, dhtHumidity);
} }
if (!DryGetMeasure(dryness)){ if (!DryGetMeasure(dryness)){
SKETCH_DEBUG_PRINT("Current dryness "); SKETCH_DEBUG_PRINT("Current dryness ");
SKETCH_DEBUG_PRINT((dryness*100)/1024); SKETCH_DEBUG_PRINT((dryness*100)/1024);
SKETCH_DEBUG_PRINTLN("%"); SKETCH_DEBUG_PRINTLN("%");
MqttDryPublish(dryness); if (mode == BOOTMODE_NORMAL)
MqttDryPublish(dryness);
} }
nbCycle = 0; nbCycle = 0;
} }