Browse Source

Use MQTT only in normal mode

gpiosensors
Mathieu Maret 5 years ago
parent
commit
d49e0a5fff
  1. 12
      WifiControlSensor/WifiControlSensor.ino

12
WifiControlSensor/WifiControlSensor.ino

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

Loading…
Cancel
Save