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
Diff: sensor.cpp
- Revision:
- 6:898c306f7990
- Parent:
- 4:46ad190e6328
- Child:
- 7:f7c98d836f81
--- 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); } }