From 9bc7f1c7e89520e199adae97bf69176f0b0af54d Mon Sep 17 00:00:00 2001 From: Kolbi Date: Tue, 15 Dec 2015 15:35:52 +0100 Subject: [PATCH] Update WeatherStationSensor.ino compile Serial.print only if debugging is enabled - by default: no debugging --- .../WeatherStationSensor/WeatherStationSensor.ino | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/MySensors/examples/WeatherStationSensor/WeatherStationSensor.ino b/libraries/MySensors/examples/WeatherStationSensor/WeatherStationSensor.ino index 38c4046..679fb2e 100644 --- a/libraries/MySensors/examples/WeatherStationSensor/WeatherStationSensor.ino +++ b/libraries/MySensors/examples/WeatherStationSensor/WeatherStationSensor.ino @@ -37,7 +37,7 @@ */ // Enable debug prints to serial monitor -#define MY_DEBUG +//#define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 @@ -227,9 +227,11 @@ bool updatePressureSensor() { changed = true; lastPressureTemp = temperature; + #ifdef MY_DEBUG Serial.print(F("Temperature = ")); Serial.print(temperature); Serial.println(metric ? F(" *C") : F(" *F")); + #endif if (!send(tempMsg.set(lastPressureTemp, 1))) { lastPressureTemp = -1.0; @@ -240,9 +242,11 @@ bool updatePressureSensor() { changed = true; lastPressure = pressure; + #ifdef MY_DEBUG Serial.print(F("sealevel Pressure = ")); Serial.print(pressure); Serial.println(F(" hPa")); + #endif if (!send(pressureMsg.set(lastPressure, 1))) { lastPressure = -1.0; @@ -253,8 +257,10 @@ bool updatePressureSensor() { changed = true; lastForecast = forecast; + #ifdef MY_DEBUG Serial.print(F("Forecast = ")); Serial.println(weatherStrings[forecast]); + #endif if (send(forecastMsg.set(weatherStrings[lastForecast]))) { if (!send(forecastMsg2.set(lastForecast))) @@ -271,8 +277,10 @@ bool updatePressureSensor() { changed = true; lastSituation = situation; + #ifdef MY_DEBUG Serial.print(F("Situation = ")); Serial.println(situationStrings[situation]); + #endif if (!send(situationMsg.set(lastSituation, 0))) { lastSituation = -1.0; @@ -302,8 +310,10 @@ bool updateHumiditySensor() } changed = true; + #ifdef MY_DEBUG Serial.print(F("T: ")); Serial.println(temperature); + #endif if (!send(msgTemp.set(temperature, 1))) { lastTemp = -1.0; @@ -322,8 +332,10 @@ bool updateHumiditySensor() { lastHum = humidity; changed = true; + #ifdef MY_DEBUG Serial.print(F("H: ")); Serial.println(humidity); + #endif if (!send(msgHum.set(lastHum, 1))) { lastHum = -1.0;