mbed Weather Platform firmware http://mbed.org/users/okini3939/notebook/mbed-weather-platform-firmware/
Dependencies: EthernetNetIf SDHCFileSystem I2CLEDDisp Agentbed NTPClient_NetServices mbed BMP085 HTTPClient ConfigFile I2CLCD
Diff: main.cpp
- Revision:
- 17:7c9d111a5d45
- Parent:
- 16:df39da7bef98
- Child:
- 18:9286e5010c14
--- a/main.cpp Fri Apr 01 23:37:04 2011 +0000 +++ b/main.cpp Fri Apr 08 15:59:29 2011 +0000 @@ -16,7 +16,7 @@ #include "BMP085.h" #include "SHT.h" #include "WeatherMeters.h" -#include "SDFileSystem.h" +#include "SDHCFileSystem.h" #include "MSCFileSystem.h" #include "EthernetNetIf.h" #include "NTPClient.h" @@ -149,21 +149,15 @@ void action (char *buf) { int i; - if (check_action('h')) { - swout1 = 1; - led3 = 1; - } - if (check_action('l')) { - swout1 = 0; - led3 = 0; + i = check_action('A'); + if (i) { + swout1 = (i == ' ' ? 1 : i - '0'); + led3 = swout1; } - if (check_action('H')) { - swout2 = 1; - led4 = 1; - } - if (check_action('L')) { - swout2 = 0; - led4 = 0; + i = check_action('B'); + if (i) { + swout2 = (i == ' ' ? 1 : i - '0'); + led4 = swout2; } if (check_action('P')) { if (conf.ipaddr[0] && conf.pachube_apikey[0] && conf.pachube_feedid[0]) { @@ -295,11 +289,11 @@ pc.printf("Actions: %d\r\n", conf.actionscount); - if (conf.inputtype == INPUT_FALL) { + if (conf.inputtype & INPUT_FALL) { intcounter = new InterruptIn(p18); intcounter->fall(&int_counter); } else - if (conf.inputtype == INPUT_RISE) { + if (conf.inputtype & INPUT_RISE) { intcounter = new InterruptIn(p18); intcounter->rise(&int_counter); } else { @@ -379,7 +373,7 @@ if (conf.inputtype == INPUT_MOIST) { sensor.moist = get_moist(*aimoist); } else { - sensor.moist = get_counter(0); + sensor.moist = get_counter(conf.inputtype & INPUT_CPM ? 0 : 1); } sensor.uv = get_uv(aiuv);