Disable more code when bmp is not enabled

This commit is contained in:
Mathieu Maret 2016-04-06 15:51:27 +02:00
parent 2778443ccc
commit 0190133bf3
2 changed files with 7 additions and 1 deletions

View File

@ -5,13 +5,15 @@ void WebHandleRoot() {
server.send(200, "text/html", server.send(200, "text/html",
"<head><meta http-equiv=\"refresh\" content=\"" + String(CONFIG_SAMPLING_PERIODE_MS / 1000) + "\" ></head>" "<head><meta http-equiv=\"refresh\" content=\"" + String(CONFIG_SAMPLING_PERIODE_MS / 1000) + "\" ></head>"
"<h1>You are connected to " + String(hostName) + "</h1>" "<h1>You are connected to " + String(hostName) + "</h1>"
#ifdef CONFIG_ENABLE_BMP180
"<fieldset>" "<fieldset>"
"<legend>Sensors</legend>" "<legend>Sensors</legend>"
"Temperature " + String(temp, 2) + "C<br/>" "Temperature " + String(temp, 2) + "C<br/>"
"Pressure " + String(pressure, 2) + "mB<br/>" "Pressure " + String(pressure, 2) + "mB<br/>"
"</fieldset>" "</fieldset>"
"<fieldset>" #endif
#ifdef CONFIG_WEB_CONTROLLED_GPIO #ifdef CONFIG_WEB_CONTROLLED_GPIO
"<fieldset>"
"<legend>Relay</legend>" "<legend>Relay</legend>"
"<a href=\"/gpio?gpio=" TOSTRING(CONFIG_WEB_CONTROLLED_GPIO) "&amp;value=1\">Relay ON</a><br/>" "<a href=\"/gpio?gpio=" TOSTRING(CONFIG_WEB_CONTROLLED_GPIO) "&amp;value=1\">Relay ON</a><br/>"
"<a href=\"/gpio?gpio=" TOSTRING(CONFIG_WEB_CONTROLLED_GPIO) "&value=0\">Relay OFF</a><br/>" "<a href=\"/gpio?gpio=" TOSTRING(CONFIG_WEB_CONTROLLED_GPIO) "&value=0\">Relay OFF</a><br/>"
@ -22,7 +24,9 @@ void WebHandleRoot() {
"<a href=\"/setup\">Enter Setup</a><br/>" "<a href=\"/setup\">Enter Setup</a><br/>"
"<a href=\"/otamode\">Put device in OTA mode</a><br/>" "<a href=\"/otamode\">Put device in OTA mode</a><br/>"
"MQTT Status: " + (MqttIsConnected() ? "Connected" : "Disconnected") + "<br/>" "MQTT Status: " + (MqttIsConnected() ? "Connected" : "Disconnected") + "<br/>"
#ifdef CONFIG_ENABLE_BMP180
"BMP 180 (Temp+Pression) Status: " + (BMP180IsConnected() ? "Connected" : "Disconnected") + "<br/>" "BMP 180 (Temp+Pression) Status: " + (BMP180IsConnected() ? "Connected" : "Disconnected") + "<br/>"
#endif
"Free space: " + ESP.getFreeSketchSpace() + "<br/>" "Free space: " + ESP.getFreeSketchSpace() + "<br/>"
"Free heap: " + ESP.getFreeHeap() + "<br/>" "Free heap: " + ESP.getFreeHeap() + "<br/>"
"</fieldset>" "</fieldset>"

View File

@ -237,6 +237,7 @@ void loop() {
MqttCheckSubscription(); MqttCheckSubscription();
delay(CONFIG_WEB_DELAY_MS); delay(CONFIG_WEB_DELAY_MS);
#ifdef CONFIG_ENABLE_BMP180
nbCycle++; nbCycle++;
if (nbCycle > CONFIG_SAMPLING_PERIODE_MS / CONFIG_WEB_DELAY_MS) { if (nbCycle > CONFIG_SAMPLING_PERIODE_MS / CONFIG_WEB_DELAY_MS) {
if (BMP180IsConnected() && BMP180GetTempAndPressure(temp, pressure) == 0) { if (BMP180IsConnected() && BMP180GetTempAndPressure(temp, pressure) == 0) {
@ -252,5 +253,6 @@ void loop() {
nbCycle = 0; nbCycle = 0;
} }
#endif
} }
} }