Merge pull request #298 from Kolbi/patch-1
Update WeatherStationSensor.ino
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Enable debug prints to serial monitor
|
// Enable debug prints to serial monitor
|
||||||
#define MY_DEBUG
|
//#define MY_DEBUG
|
||||||
|
|
||||||
// Enable and select radio type attached
|
// Enable and select radio type attached
|
||||||
#define MY_RADIO_NRF24
|
#define MY_RADIO_NRF24
|
||||||
@@ -227,9 +227,11 @@ bool updatePressureSensor()
|
|||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
lastPressureTemp = temperature;
|
lastPressureTemp = temperature;
|
||||||
|
#ifdef MY_DEBUG
|
||||||
Serial.print(F("Temperature = "));
|
Serial.print(F("Temperature = "));
|
||||||
Serial.print(temperature);
|
Serial.print(temperature);
|
||||||
Serial.println(metric ? F(" *C") : F(" *F"));
|
Serial.println(metric ? F(" *C") : F(" *F"));
|
||||||
|
#endif
|
||||||
if (!send(tempMsg.set(lastPressureTemp, 1)))
|
if (!send(tempMsg.set(lastPressureTemp, 1)))
|
||||||
{
|
{
|
||||||
lastPressureTemp = -1.0;
|
lastPressureTemp = -1.0;
|
||||||
@@ -240,9 +242,11 @@ bool updatePressureSensor()
|
|||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
lastPressure = pressure;
|
lastPressure = pressure;
|
||||||
|
#ifdef MY_DEBUG
|
||||||
Serial.print(F("sealevel Pressure = "));
|
Serial.print(F("sealevel Pressure = "));
|
||||||
Serial.print(pressure);
|
Serial.print(pressure);
|
||||||
Serial.println(F(" hPa"));
|
Serial.println(F(" hPa"));
|
||||||
|
#endif
|
||||||
if (!send(pressureMsg.set(lastPressure, 1)))
|
if (!send(pressureMsg.set(lastPressure, 1)))
|
||||||
{
|
{
|
||||||
lastPressure = -1.0;
|
lastPressure = -1.0;
|
||||||
@@ -253,8 +257,10 @@ bool updatePressureSensor()
|
|||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
lastForecast = forecast;
|
lastForecast = forecast;
|
||||||
|
#ifdef MY_DEBUG
|
||||||
Serial.print(F("Forecast = "));
|
Serial.print(F("Forecast = "));
|
||||||
Serial.println(weatherStrings[forecast]);
|
Serial.println(weatherStrings[forecast]);
|
||||||
|
#endif
|
||||||
if (send(forecastMsg.set(weatherStrings[lastForecast])))
|
if (send(forecastMsg.set(weatherStrings[lastForecast])))
|
||||||
{
|
{
|
||||||
if (!send(forecastMsg2.set(lastForecast)))
|
if (!send(forecastMsg2.set(lastForecast)))
|
||||||
@@ -271,8 +277,10 @@ bool updatePressureSensor()
|
|||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
lastSituation = situation;
|
lastSituation = situation;
|
||||||
|
#ifdef MY_DEBUG
|
||||||
Serial.print(F("Situation = "));
|
Serial.print(F("Situation = "));
|
||||||
Serial.println(situationStrings[situation]);
|
Serial.println(situationStrings[situation]);
|
||||||
|
#endif
|
||||||
if (!send(situationMsg.set(lastSituation, 0)))
|
if (!send(situationMsg.set(lastSituation, 0)))
|
||||||
{
|
{
|
||||||
lastSituation = -1.0;
|
lastSituation = -1.0;
|
||||||
@@ -302,8 +310,10 @@ bool updateHumiditySensor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
|
#ifdef MY_DEBUG
|
||||||
Serial.print(F("T: "));
|
Serial.print(F("T: "));
|
||||||
Serial.println(temperature);
|
Serial.println(temperature);
|
||||||
|
#endif
|
||||||
if (!send(msgTemp.set(temperature, 1)))
|
if (!send(msgTemp.set(temperature, 1)))
|
||||||
{
|
{
|
||||||
lastTemp = -1.0;
|
lastTemp = -1.0;
|
||||||
@@ -322,8 +332,10 @@ bool updateHumiditySensor()
|
|||||||
{
|
{
|
||||||
lastHum = humidity;
|
lastHum = humidity;
|
||||||
changed = true;
|
changed = true;
|
||||||
|
#ifdef MY_DEBUG
|
||||||
Serial.print(F("H: "));
|
Serial.print(F("H: "));
|
||||||
Serial.println(humidity);
|
Serial.println(humidity);
|
||||||
|
#endif
|
||||||
if (!send(msgHum.set(lastHum, 1)))
|
if (!send(msgHum.set(lastHum, 1)))
|
||||||
{
|
{
|
||||||
lastHum = -1.0;
|
lastHum = -1.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user