mbed Weather Platform firmware http://mbed.org/users/okini3939/notebook/mbed-weather-platform-firmware/

Dependencies:   ChaNFSSD EthernetNetIf I2CLEDDisp Agentbed ChaNFSUSB ILinterpreter mbed BMP085 WeatherMeters ConfigFile ChaNFS I2CLCD

Files at this revision

API Documentation at this revision

Comitter:
okini3939
Date:
Sun Jan 15 13:28:12 2012 +0000
Parent:
5:90f840432195
Child:
7:f7c98d836f81
Commit message:

Changed in this revision

file.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
sensor.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/file.cpp	Wed Oct 12 02:18:00 2011 +0000
+++ b/file.cpp	Sun Jan 15 13:28:12 2012 +0000
@@ -251,6 +251,9 @@
     if (cfg.getValue("OFFSET[H]", buf, sizeof_1(buf))) {
         offset.humi = atof(buf);
     }
+    if (cfg.getValue("OFFSET[V]", buf, sizeof_1(buf))) {
+        offset.vane = atof(buf);
+    }
 
 #ifdef USE_EMAIL
     cfg.getValue("SMTPSERVER", conf.smtphost, sizeof_1(conf.smtphost));
--- a/main.cpp	Wed Oct 12 02:18:00 2011 +0000
+++ b/main.cpp	Sun Jan 15 13:28:12 2012 +0000
@@ -49,6 +49,7 @@
         pc.baud(conf.baud);
     }
 
+    init_sensor();
     init_ilip(conf.dir);
     init_file();
     init_display();
--- a/sensor.cpp	Wed Oct 12 02:18:00 2011 +0000
+++ b/sensor.cpp	Sun Jan 15 13:28:12 2012 +0000
@@ -89,7 +89,7 @@
     sensor.humi = sht15.get_humidity() + offset.humi;
 
     sensor.anemo = wmeters.get_windspeed();
-    sensor.vane = wmeters.get_windvane();
+    sensor.vane = wmeters.get_windvane() + offset.vane;
     sensor.rain = wmeters.get_raingauge();
 
     sensor.light = get_light(ailight);
@@ -99,7 +99,7 @@
         // moist sensor
         sensor.moist = get_moist(*aimoist);
     } else
-    if (conf.inputtype == INPUT_MOIST) {
+    if (conf.inputtype & (INPUT_FALL|INPUT_RISE)) {
         // counter
         sensor.moist = get_counter(conf.inputtype & INPUT_CPM ? 0 : 1);
     }
@@ -121,12 +121,14 @@
     } else
     if (conf.inputtype & (INPUT_FALL|INPUT_RISE)) {
         // counter
-        intin->fall(&isr_counter);
+        intin = new InterruptIn(p18);
         if (conf.inputtype & INPUT_FALL) {
-            intin = new InterruptIn(p18);
+            intin->mode(PullUp);
+            intin->fall(&isr_counter);
         }
         if (conf.inputtype & INPUT_RISE) {
-            intin = new InterruptIn(p18);
+            intin->mode(PullDown);
+            intin->rise(&isr_counter);
         }
     }