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

Committer:
okini3939
Date:
Fri Mar 16 15:26:46 2012 +0000
Revision:
8:bed0b81794ba
Parent:
7:f7c98d836f81

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 1:6c7141895545 1 /*
okini3939 1:6c7141895545 2 * Weather Station - mbed Weather Platform
okini3939 1:6c7141895545 3 * Copyright (c) 2011 Hiroshi Suga
okini3939 1:6c7141895545 4 * Released under the MIT License: http://mbed.org/license/mit
okini3939 1:6c7141895545 5 */
okini3939 1:6c7141895545 6
okini3939 1:6c7141895545 7 /** @file
okini3939 1:6c7141895545 8 * @brief Weather Station
okini3939 1:6c7141895545 9 */
okini3939 1:6c7141895545 10
okini3939 0:bdb53686c194 11 #include "mbed.h"
okini3939 0:bdb53686c194 12 #include "weather.h"
okini3939 2:a3e5edf84f74 13 #include "SDFileSystem.h"
okini3939 2:a3e5edf84f74 14 #ifdef USE_USB
okini3939 0:bdb53686c194 15 #include "MSCFileSystem.h"
okini3939 2:a3e5edf84f74 16 #endif
okini3939 0:bdb53686c194 17 #include "ConfigFile.h"
okini3939 0:bdb53686c194 18
okini3939 7:f7c98d836f81 19 extern struct Sensor offset;
okini3939 0:bdb53686c194 20 static SDFileSystem sd(p5, p6, p7, p8, "sd");
okini3939 0:bdb53686c194 21 static LocalFileSystem *local;
okini3939 2:a3e5edf84f74 22 #ifdef USE_USB
okini3939 0:bdb53686c194 23 static MSCFileSystem *usb;
okini3939 2:a3e5edf84f74 24 #endif
okini3939 1:6c7141895545 25 static DigitalIn sd_ins(p27);
okini3939 2:a3e5edf84f74 26 struct Config conf;
okini3939 0:bdb53686c194 27 static char filename[30] = "";
okini3939 0:bdb53686c194 28
okini3939 7:f7c98d836f81 29 // date time from filesystem
okini3939 7:f7c98d836f81 30 int fstime (char *d, time_t *tim) {
okini3939 7:f7c98d836f81 31 DIR_t dir;
okini3939 7:f7c98d836f81 32 FILINFO fno;
okini3939 7:f7c98d836f81 33 #if _USE_LFN
okini3939 7:f7c98d836f81 34 static char lfn[_MAX_LFN + 1];
okini3939 7:f7c98d836f81 35 fno.lfname = lfn;
okini3939 7:f7c98d836f81 36 fno.lfsize = sizeof(lfn);
okini3939 7:f7c98d836f81 37 #endif
okini3939 7:f7c98d836f81 38 DWORD fattime = 0, ft;
okini3939 7:f7c98d836f81 39 struct tm t;
okini3939 7:f7c98d836f81 40
okini3939 7:f7c98d836f81 41 if (f_opendir(&dir, "") == FR_OK) {
okini3939 7:f7c98d836f81 42 for (;;) {
okini3939 7:f7c98d836f81 43 if (f_readdir(&dir, &fno) != FR_OK) break;
okini3939 7:f7c98d836f81 44 if (fno.fname[0] == 0) break;
okini3939 7:f7c98d836f81 45 if (fno.fdate != 0) {
okini3939 7:f7c98d836f81 46 printf("%s %d\r\n", fno.fname, fno.fdate);
okini3939 7:f7c98d836f81 47 ft = (fno.fdate << 16) | fno.ftime;
okini3939 7:f7c98d836f81 48 if (ft > fattime) {
okini3939 7:f7c98d836f81 49 fattime = ft;
okini3939 7:f7c98d836f81 50 }
okini3939 7:f7c98d836f81 51 }
okini3939 7:f7c98d836f81 52 }
okini3939 7:f7c98d836f81 53 if (fattime) {
okini3939 7:f7c98d836f81 54 t.tm_year = ((fattime >> 25) & 0x7f) + 80;
okini3939 7:f7c98d836f81 55 t.tm_mon = ((fattime >> 21) & 0x0f) - 1;
okini3939 7:f7c98d836f81 56 t.tm_mday = (fattime >> 16) & 0x1f;
okini3939 7:f7c98d836f81 57 t.tm_hour = (fattime >> 11) & 0x1f;
okini3939 7:f7c98d836f81 58 t.tm_min = (fattime >> 5) & 0x3f;
okini3939 7:f7c98d836f81 59 t.tm_sec = (fattime << 1) & 0x3e;
okini3939 7:f7c98d836f81 60 *tim = mktime(&t);
okini3939 7:f7c98d836f81 61 return 0;
okini3939 7:f7c98d836f81 62 }
okini3939 7:f7c98d836f81 63 }
okini3939 7:f7c98d836f81 64 return -1;
okini3939 7:f7c98d836f81 65 }
okini3939 7:f7c98d836f81 66
okini3939 7:f7c98d836f81 67 // write CSV file
okini3939 0:bdb53686c194 68 int write_log (const char *buf) {
okini3939 0:bdb53686c194 69 FILE *fp;
okini3939 0:bdb53686c194 70
okini3939 0:bdb53686c194 71 if (filename[0] == 0) return 0;
okini3939 1:6c7141895545 72 #ifdef USE_SD_INS
okini3939 1:6c7141895545 73 if (sd_ins != 0) return -1;
okini3939 1:6c7141895545 74 #endif
okini3939 0:bdb53686c194 75
okini3939 2:a3e5edf84f74 76 LED_FILE_ACT_ON;
okini3939 0:bdb53686c194 77 fp = fopen(filename, "a");
okini3939 0:bdb53686c194 78 if (fp) {
okini3939 0:bdb53686c194 79 fprintf(fp, buf);
okini3939 5:90f840432195 80 fprintf(fp, "\r\n");
okini3939 0:bdb53686c194 81 fclose(fp);
okini3939 0:bdb53686c194 82 } else {
okini3939 2:a3e5edf84f74 83 LED_FILE_ACT_OFF;
okini3939 0:bdb53686c194 84 return -1;
okini3939 0:bdb53686c194 85 }
okini3939 2:a3e5edf84f74 86 LED_FILE_ACT_OFF;
okini3939 0:bdb53686c194 87 return 0;
okini3939 0:bdb53686c194 88 }
okini3939 0:bdb53686c194 89
okini3939 7:f7c98d836f81 90 int init_log () {
okini3939 0:bdb53686c194 91 int seq = 0;
okini3939 2:a3e5edf84f74 92 char dir[8];
okini3939 0:bdb53686c194 93 FILE *fp;
okini3939 0:bdb53686c194 94
okini3939 2:a3e5edf84f74 95 if (conf.filetype) {
okini3939 2:a3e5edf84f74 96 if (conf.filetype == 1) {
okini3939 2:a3e5edf84f74 97 strcpy(dir, "/sd/");
okini3939 0:bdb53686c194 98 } else
okini3939 2:a3e5edf84f74 99 if (conf.filetype == 2) {
okini3939 2:a3e5edf84f74 100 #ifdef USE_USB
okini3939 0:bdb53686c194 101 usb = new MSCFileSystem("usb");
okini3939 2:a3e5edf84f74 102 strcpy(dir, "/usb/");
okini3939 2:a3e5edf84f74 103 #endif
okini3939 0:bdb53686c194 104 }
okini3939 0:bdb53686c194 105
okini3939 0:bdb53686c194 106 // seq num
okini3939 2:a3e5edf84f74 107 strcpy(filename, dir);
okini3939 0:bdb53686c194 108 strcat(filename, "weather.seq");
okini3939 2:a3e5edf84f74 109 LED_FILE_ACT_ON;
okini3939 0:bdb53686c194 110 fp = fopen(filename, "r");
okini3939 0:bdb53686c194 111 if (fp) {
okini3939 0:bdb53686c194 112 fscanf(fp, "%d", &seq);
okini3939 0:bdb53686c194 113 fclose(fp);
okini3939 0:bdb53686c194 114 }
okini3939 0:bdb53686c194 115 seq ++;
okini3939 0:bdb53686c194 116
okini3939 0:bdb53686c194 117 // save seq num
okini3939 0:bdb53686c194 118 fp = fopen(filename, "w");
okini3939 0:bdb53686c194 119 if (fp) {
okini3939 0:bdb53686c194 120 fprintf(fp, "%d", seq);
okini3939 0:bdb53686c194 121 fclose(fp);
okini3939 0:bdb53686c194 122 }
okini3939 2:a3e5edf84f74 123 LED_FILE_ACT_OFF;
okini3939 0:bdb53686c194 124
okini3939 0:bdb53686c194 125 // csv filename
okini3939 2:a3e5edf84f74 126 sprintf(filename, "%sw%05d.csv", dir, seq);
okini3939 0:bdb53686c194 127 pc.printf("CSV Filename: %s\r\n", filename);
okini3939 0:bdb53686c194 128 }
okini3939 0:bdb53686c194 129 return 0;
okini3939 0:bdb53686c194 130 }
okini3939 0:bdb53686c194 131
okini3939 0:bdb53686c194 132 char* chop (char *s) {
okini3939 0:bdb53686c194 133 int i;
okini3939 0:bdb53686c194 134
okini3939 0:bdb53686c194 135 for (i = strlen(s) - 1; i >= 0; i --) {
okini3939 0:bdb53686c194 136 if (s[i] == ' ' || s[i] == '\n' || s[i] == '\r') {
okini3939 0:bdb53686c194 137 s[i] = 0;
okini3939 0:bdb53686c194 138 } else {
okini3939 0:bdb53686c194 139 break;
okini3939 0:bdb53686c194 140 }
okini3939 0:bdb53686c194 141 }
okini3939 0:bdb53686c194 142 return s;
okini3939 0:bdb53686c194 143 }
okini3939 2:a3e5edf84f74 144
okini3939 2:a3e5edf84f74 145 int init_conf () {
okini3939 2:a3e5edf84f74 146 ConfigFile cfg;
okini3939 2:a3e5edf84f74 147 int i;
okini3939 2:a3e5edf84f74 148 char buf[CF_VALUE_SIZE], key[CF_KEY_SIZE];
okini3939 2:a3e5edf84f74 149 int ip0, ip1, ip2, ip3;
okini3939 2:a3e5edf84f74 150
okini3939 2:a3e5edf84f74 151 memset(&conf, 0, sizeof(conf));
okini3939 2:a3e5edf84f74 152 conf.interval = 60;
okini3939 2:a3e5edf84f74 153 strcpy(conf.csv_mesg, CSV_MESG);
okini3939 2:a3e5edf84f74 154
okini3939 2:a3e5edf84f74 155 #ifdef USE_SD_INS
okini3939 2:a3e5edf84f74 156 sd_ins.mode(PullUp);
okini3939 2:a3e5edf84f74 157 #endif
okini3939 2:a3e5edf84f74 158
okini3939 2:a3e5edf84f74 159 // open config
okini3939 2:a3e5edf84f74 160 LED_FILE_ACT_ON;
okini3939 2:a3e5edf84f74 161 #ifdef USE_SD_INS
okini3939 2:a3e5edf84f74 162 if (sd_ins == 0 && cfg.read("/sd/" CONFIG_FILE)) {
okini3939 2:a3e5edf84f74 163 #else
okini3939 2:a3e5edf84f74 164 if (cfg.read("/sd/" CONFIG_FILE)) {
okini3939 2:a3e5edf84f74 165 #endif
okini3939 2:a3e5edf84f74 166 // from sd
okini3939 2:a3e5edf84f74 167
okini3939 2:a3e5edf84f74 168 strcpy(conf.dir, "/sd/");
okini3939 2:a3e5edf84f74 169 LED_FILE_ACT_OFF;
okini3939 2:a3e5edf84f74 170
okini3939 2:a3e5edf84f74 171 } else {
okini3939 2:a3e5edf84f74 172 local = new LocalFileSystem("local");
okini3939 2:a3e5edf84f74 173 if (cfg.read("/local/" CONFIG_FILE)) {
okini3939 2:a3e5edf84f74 174 // from usb
okini3939 2:a3e5edf84f74 175
okini3939 2:a3e5edf84f74 176 strcpy(conf.dir, "/local/");
okini3939 2:a3e5edf84f74 177 LED_FILE_ACT_OFF;
okini3939 2:a3e5edf84f74 178
okini3939 2:a3e5edf84f74 179 } else {
okini3939 2:a3e5edf84f74 180 // none
okini3939 2:a3e5edf84f74 181 LED_FILE_ACT_OFF;
okini3939 2:a3e5edf84f74 182 return -1;
okini3939 2:a3e5edf84f74 183 }
okini3939 2:a3e5edf84f74 184 }
okini3939 2:a3e5edf84f74 185
okini3939 2:a3e5edf84f74 186 // load config
okini3939 2:a3e5edf84f74 187 if (cfg.getValue("INTERVAL", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 188 conf.interval = atoi(buf);
okini3939 2:a3e5edf84f74 189 }
okini3939 2:a3e5edf84f74 190 if (cfg.getValue("BAUD", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 191 conf.baud = atoi(buf);
okini3939 2:a3e5edf84f74 192 }
okini3939 2:a3e5edf84f74 193
okini3939 2:a3e5edf84f74 194 if (cfg.getValue("FILE", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 195 chop(buf);
okini3939 2:a3e5edf84f74 196 if (strcmp(buf, "SD") == 0) {
okini3939 2:a3e5edf84f74 197 conf.filetype = 1;
okini3939 2:a3e5edf84f74 198 } else
okini3939 2:a3e5edf84f74 199 if (strcmp(buf, "USB") == 0) {
okini3939 2:a3e5edf84f74 200 conf.filetype = 2;
okini3939 2:a3e5edf84f74 201 }
okini3939 2:a3e5edf84f74 202 }
okini3939 2:a3e5edf84f74 203 if (cfg.getValue("CSV_MESG", conf.csv_mesg, sizeof_1(conf.csv_mesg))) {
okini3939 2:a3e5edf84f74 204 chop(conf.csv_mesg);
okini3939 2:a3e5edf84f74 205 }
okini3939 2:a3e5edf84f74 206
okini3939 2:a3e5edf84f74 207 if (cfg.getValue("IPADDRESS", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 208 if (strncmp(buf, "DHCP", 4) == 0) {
okini3939 2:a3e5edf84f74 209 conf.ipaddr = IpAddr(255, 255, 255, 255);
okini3939 2:a3e5edf84f74 210 } else {
okini3939 2:a3e5edf84f74 211 sscanf(buf, "%d.%d.%d.%d", &ip0, &ip1, &ip2, &ip3);
okini3939 2:a3e5edf84f74 212 conf.ipaddr = IpAddr(ip0, ip1, ip2, ip3);
okini3939 2:a3e5edf84f74 213 }
okini3939 2:a3e5edf84f74 214 }
okini3939 2:a3e5edf84f74 215 if (cfg.getValue("NETMASK", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 216 sscanf(buf, "%d.%d.%d.%d", &ip0, &ip1, &ip2, &ip3);
okini3939 2:a3e5edf84f74 217 conf.netmask = IpAddr(ip0, ip1, ip2, ip3);
okini3939 2:a3e5edf84f74 218 }
okini3939 2:a3e5edf84f74 219 if (cfg.getValue("GATEWAY", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 220 sscanf(buf, "%d.%d.%d.%d", &ip0, &ip1, &ip2, &ip3);
okini3939 2:a3e5edf84f74 221 conf.gateway = IpAddr(ip0, ip1, ip2, ip3);
okini3939 2:a3e5edf84f74 222 }
okini3939 2:a3e5edf84f74 223 if (cfg.getValue("NAMESERVER", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 224 sscanf(buf, "%d.%d.%d.%d", &ip0, &ip1, &ip2, &ip3);
okini3939 2:a3e5edf84f74 225 conf.nameserver = IpAddr(ip0, ip1, ip2, ip3);
okini3939 2:a3e5edf84f74 226 }
okini3939 2:a3e5edf84f74 227
okini3939 2:a3e5edf84f74 228 cfg.getValue("NTPSERVER", conf.ntpserver, sizeof_1(conf.ntpserver));
okini3939 2:a3e5edf84f74 229 chop(conf.ntpserver);
okini3939 2:a3e5edf84f74 230 cfg.getValue("SNMP_COMMNAME", conf.snmp_commname, sizeof_1(conf.snmp_commname));
okini3939 2:a3e5edf84f74 231 chop(conf.snmp_commname);
okini3939 2:a3e5edf84f74 232
okini3939 2:a3e5edf84f74 233 cfg.getValue("PACHUBE_APIKEY", conf.pachube_apikey, sizeof_1(conf.pachube_apikey));
okini3939 2:a3e5edf84f74 234 chop(conf.pachube_apikey);
okini3939 2:a3e5edf84f74 235 cfg.getValue("PACHUBE_FEEDID", conf.pachube_feedid, sizeof_1(conf.pachube_feedid));
okini3939 2:a3e5edf84f74 236 chop(conf.pachube_feedid);
okini3939 2:a3e5edf84f74 237 if (cfg.getValue("PACHUBE_MESG", conf.pachube_mesg, sizeof_1(conf.pachube_mesg))) {
okini3939 2:a3e5edf84f74 238 chop(conf.pachube_mesg);
okini3939 2:a3e5edf84f74 239 } else {
okini3939 2:a3e5edf84f74 240 strcpy(conf.pachube_mesg, PACHUBE_MESG);
okini3939 2:a3e5edf84f74 241 }
okini3939 2:a3e5edf84f74 242
okini3939 2:a3e5edf84f74 243 cfg.getValue("TWITTER_USER", conf.twitter_user, sizeof_1(conf.twitter_user));
okini3939 2:a3e5edf84f74 244 chop(conf.twitter_user);
okini3939 2:a3e5edf84f74 245 cfg.getValue("TWITTER_PWD", conf.twitter_pwd, sizeof_1(conf.twitter_pwd));
okini3939 2:a3e5edf84f74 246 chop(conf.twitter_pwd);
okini3939 2:a3e5edf84f74 247 cfg.getValue("TWITTER_MESG", conf.twitter_mesg[0], sizeof_1(conf.twitter_mesg[0]));
okini3939 2:a3e5edf84f74 248 chop(conf.twitter_mesg[0]);
okini3939 2:a3e5edf84f74 249 for (i = 0; i < CF_TWITTER_NUM; i ++) {
okini3939 2:a3e5edf84f74 250 sprintf(key, "TWITTER_MESG[%d]", i);
okini3939 2:a3e5edf84f74 251 cfg.getValue(key, conf.twitter_mesg[i], sizeof_1(conf.twitter_mesg[i]));
okini3939 2:a3e5edf84f74 252 chop(conf.twitter_mesg[i]);
okini3939 2:a3e5edf84f74 253 }
okini3939 2:a3e5edf84f74 254
okini3939 2:a3e5edf84f74 255 cfg.getValue("STATIONS_ID", conf.stations_id, sizeof_1(conf.stations_id));
okini3939 2:a3e5edf84f74 256 chop(conf.stations_id);
okini3939 2:a3e5edf84f74 257 cfg.getValue("STATIONS_PIN", conf.stations_pin, sizeof_1(conf.stations_pin));
okini3939 2:a3e5edf84f74 258 chop(conf.stations_pin);
okini3939 2:a3e5edf84f74 259
okini3939 2:a3e5edf84f74 260 if (cfg.getValue("LCD_TYPE", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 261 conf.lcdtype = (enum I2CLCDType)atoi(buf);
okini3939 2:a3e5edf84f74 262 } else {
okini3939 2:a3e5edf84f74 263 conf.lcdtype = LCD16x2;
okini3939 2:a3e5edf84f74 264 }
okini3939 2:a3e5edf84f74 265 if (cfg.getValue("LCD_CONF", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 266 conf.lcdconf = (enum I2CLCDConfig)atoi(buf);
okini3939 2:a3e5edf84f74 267 } else {
okini3939 2:a3e5edf84f74 268 conf.lcdconf = LCDCFG_3V;
okini3939 2:a3e5edf84f74 269 }
okini3939 2:a3e5edf84f74 270 if (cfg.getValue("LCD_MESG", conf.lcd_mesg, sizeof_1(conf.lcd_mesg))) {
okini3939 2:a3e5edf84f74 271 chop(conf.lcd_mesg);
okini3939 2:a3e5edf84f74 272 }
okini3939 2:a3e5edf84f74 273 if (cfg.getValue("LEDDISP_MESG", conf.leddisp_mesg, sizeof_1(conf.leddisp_mesg))) {
okini3939 2:a3e5edf84f74 274 chop(conf.leddisp_mesg);
okini3939 2:a3e5edf84f74 275 }
okini3939 2:a3e5edf84f74 276
okini3939 2:a3e5edf84f74 277 if (cfg.getValue("XBEE", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 278 conf.xbeebaud = atoi(buf);
okini3939 2:a3e5edf84f74 279 }
okini3939 2:a3e5edf84f74 280
okini3939 2:a3e5edf84f74 281 if (cfg.getValue("INPUT", buf, sizeof(buf))) {
okini3939 2:a3e5edf84f74 282 conf.inputtype = (enum eINPUTTYPE)atoi(buf);
okini3939 2:a3e5edf84f74 283 }
okini3939 2:a3e5edf84f74 284
okini3939 7:f7c98d836f81 285 memset(&offset, 0, sizeof(offset));
okini3939 2:a3e5edf84f74 286 if (cfg.getValue("OFFSET[P]", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 287 offset.pres = atof(buf);
okini3939 2:a3e5edf84f74 288 }
okini3939 2:a3e5edf84f74 289 if (cfg.getValue("OFFSET[T]", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 290 offset.temp = atof(buf);
okini3939 2:a3e5edf84f74 291 }
okini3939 2:a3e5edf84f74 292 if (cfg.getValue("OFFSET[H]", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 293 offset.humi = atof(buf);
okini3939 2:a3e5edf84f74 294 }
okini3939 6:898c306f7990 295 if (cfg.getValue("OFFSET[V]", buf, sizeof_1(buf))) {
okini3939 6:898c306f7990 296 offset.vane = atof(buf);
okini3939 6:898c306f7990 297 }
okini3939 2:a3e5edf84f74 298
okini3939 2:a3e5edf84f74 299 #ifdef USE_EMAIL
okini3939 2:a3e5edf84f74 300 cfg.getValue("SMTPSERVER", conf.smtphost, sizeof_1(conf.smtphost));
okini3939 2:a3e5edf84f74 301 chop(conf.smtphost);
okini3939 2:a3e5edf84f74 302 if (cfg.getValue("SMTPPORT", buf, sizeof_1(buf))) {
okini3939 2:a3e5edf84f74 303 conf.smtpport = atoi(buf);
okini3939 2:a3e5edf84f74 304 } else {
okini3939 2:a3e5edf84f74 305 conf.smtpport = 25;
okini3939 2:a3e5edf84f74 306 }
okini3939 2:a3e5edf84f74 307 cfg.getValue("SMTPUSER", conf.smtpuser, sizeof_1(conf.smtpuser));
okini3939 2:a3e5edf84f74 308 chop(conf.smtpuser);
okini3939 2:a3e5edf84f74 309 cfg.getValue("SMTPPWD", conf.smtppwd, sizeof_1(conf.smtppwd));
okini3939 2:a3e5edf84f74 310 chop(conf.smtppwd);
okini3939 2:a3e5edf84f74 311 cfg.getValue("MAIL_FROM", conf.mailfrom, sizeof_1(conf.mailfrom));
okini3939 2:a3e5edf84f74 312 chop(conf.mailfrom);
okini3939 2:a3e5edf84f74 313 for (i = 0; i < CF_MAIL_NUM; i ++) {
okini3939 2:a3e5edf84f74 314 snprintf(key, sizeof_1(key), "MAIL_MESG[%d]", i);
okini3939 2:a3e5edf84f74 315 cfg.getValue(key, conf.mailmesg[i], sizeof_1(conf.mailmesg[i]));
okini3939 2:a3e5edf84f74 316 chop(conf.mailmesg[i]);
okini3939 2:a3e5edf84f74 317 snprintf(key, sizeof_1(key), "MAIL_TO[%d]", i);
okini3939 2:a3e5edf84f74 318 cfg.getValue(key, conf.mailto[i], sizeof_1(conf.mailto[i]));
okini3939 2:a3e5edf84f74 319 chop(conf.mailto[i]);
okini3939 2:a3e5edf84f74 320 }
okini3939 2:a3e5edf84f74 321 #endif
okini3939 2:a3e5edf84f74 322
okini3939 2:a3e5edf84f74 323 #ifdef DEBUG
okini3939 2:a3e5edf84f74 324 pc.printf("Configration: %d\r\n", cfg.getCount());
okini3939 2:a3e5edf84f74 325 #endif
okini3939 2:a3e5edf84f74 326 return 0;
okini3939 2:a3e5edf84f74 327 }