thermferm/thermferm.c

changeset 150
1e0a698401df
parent 131
528dc0bb81ab
child 155
0d86f3c0a07b
equal deleted inserted replaced
149:f019ea6a9d31 150:1e0a698401df
230 { 230 {
231 char buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40]; 231 char buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40];
232 time_t now, last = (time_t)0; 232 time_t now, last = (time_t)0;
233 w1_therm *tmp1; 233 w1_therm *tmp1;
234 units_list *unit; 234 units_list *unit;
235 int rc, run = 1, temp, seconds = 0; 235 int rc, run = 1, seconds = 0;
236 #ifdef HAVE_WIRINGPI_H 236 #ifdef HAVE_WIRINGPI_H
237 struct tm *tm; 237 struct tm *tm;
238 int row; 238 int row;
239 #else 239 #else
240 long t = 0; 240 long t = 0;
289 289
290 #ifdef HAVE_WIRINGPI_H 290 #ifdef HAVE_WIRINGPI_H
291 lcd_buf_write(1, (char *)" ThermFerm "); 291 lcd_buf_write(1, (char *)" ThermFerm ");
292 lcd_buf_write(2, (char *)" Version %s ", VERSION); 292 lcd_buf_write(2, (char *)" Version %s ", VERSION);
293 #endif 293 #endif
294
295 snprintf(buf, 1023, "tempA,tempB");
296 logger((char *)"thermferm.log", buf);
297 294
298 for (unit = Config.units; unit; unit = unit->next) { 295 for (unit = Config.units; unit; unit = unit->next) {
299 if (unit->mode != UNITMODE_OFF) { 296 if (unit->mode != UNITMODE_OFF) {
300 snprintf(buf, 1023, "Mode,Air,Beer,Target,Heater,Cooler,Fan,Door"); 297 snprintf(buf, 1023, "Mode,Air,Beer,Target,Heater,Cooler,Fan,Door");
301 filename = xstrcpy(unit->name); 298 filename = xstrcpy(unit->name);
350 #endif 347 #endif
351 348
352 if (seconds == 60) { 349 if (seconds == 60) {
353 seconds = 0; 350 seconds = 0;
354 351
355 if (Config.w1therms) {
356 tmp1 = Config.w1therms;
357 temp = tmp1->lastval;
358 tmp1 = tmp1->next;
359 if (temp && tmp1->lastval && run) {
360 snprintf(buf, 1023, "%.2f,%.2f", temp / 1000.0, tmp1->lastval / 1000.0);
361 logger((char *)"thermferm.log", buf);
362 }
363 }
364
365 for (unit = Config.units; unit; unit = unit->next) { 352 for (unit = Config.units; unit; unit = unit->next) {
366 if (unit->mode != UNITMODE_OFF) { 353 if (unit->mode != UNITMODE_OFF) {
367 354
368 snprintf(target, 39, "NA"); 355 snprintf(target, 39, "NA");
369 snprintf(heater, 39, "NA"); 356 snprintf(heater, 39, "NA");

mercurial