thermferm/thermferm.c

changeset 355
8f946f9d125a
parent 352
a8e106c95db4
child 361
308f6a436779
equal deleted inserted replaced
354:5ff387f4d6b7 355:8f946f9d125a
832 832
833 833
834 int server(void) 834 int server(void)
835 { 835 {
836 char buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40]; 836 char buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40];
837 char use_heater[40], use_cooler[40], use_fan[40]; 837 char use_heater[40], use_cooler[40], use_fan[40], room_temp[40];
838 time_t now, last = (time_t)0; 838 time_t now, last = (time_t)0;
839 units_list *unit; 839 units_list *unit;
840 profiles_list *profile; 840 profiles_list *profile;
841 prof_step *step; 841 prof_step *step;
842 int rc, run = 1, seconds = 0, minutes = 0, temp, deviation; 842 int rc, run = 1, seconds = 0, minutes = 0, temp, deviation;
1568 snprintf(fan, 39, "NA"); 1568 snprintf(fan, 39, "NA");
1569 snprintf(door, 39, "NA"); 1569 snprintf(door, 39, "NA");
1570 snprintf(use_heater, 39, "NA"); 1570 snprintf(use_heater, 39, "NA");
1571 snprintf(use_cooler, 39, "NA"); 1571 snprintf(use_cooler, 39, "NA");
1572 snprintf(use_fan, 39, "NA"); 1572 snprintf(use_fan, 39, "NA");
1573 1573 snprintf(room_temp, 39, "NA");
1574 1574
1575 if (unit->mode == UNITMODE_BEER) 1575 if (unit->mode == UNITMODE_BEER)
1576 snprintf(target, 39, "%.1f", unit->beer_set); 1576 snprintf(target, 39, "%.1f", unit->beer_set);
1577 else if (unit->mode == UNITMODE_FRIDGE) 1577 else if (unit->mode == UNITMODE_FRIDGE)
1578 snprintf(target, 39, "%.1f", unit->fridge_set); 1578 snprintf(target, 39, "%.1f", unit->fridge_set);
1592 snprintf(use_fan, 39, "%d", unit->fan_usage); 1592 snprintf(use_fan, 39, "%d", unit->fan_usage);
1593 } 1593 }
1594 if (unit->door_address) { 1594 if (unit->door_address) {
1595 snprintf(door, 39, "%d", unit->door_state); 1595 snprintf(door, 39, "%d", unit->door_state);
1596 } 1596 }
1597 1597 if (Config.temp_address) {
1598 snprintf(buf, 1023, "%s,%.3f,%.3f,%s,%s,%s,%s,%s,%s,%s,%s", 1598 snprintf(room_temp, 39, "%.3f", Config.temp_value / 1000.0);
1599 }
1600
1601 snprintf(buf, 1023, "%s,%.3f,%.3f,%s,%s,%s,%s,%s,%s,%s,%s,%s",
1599 UNITMODE[unit->mode], unit->air_temperature / 1000.0, 1602 UNITMODE[unit->mode], unit->air_temperature / 1000.0,
1600 unit->beer_temperature / 1000.0, target, heater, cooler, fan, door, use_heater, use_cooler, use_fan); 1603 unit->beer_temperature / 1000.0, target, heater, cooler, fan, door, use_heater, use_cooler, use_fan, room_temp);
1601 filename = xstrcpy(unit->name); 1604 filename = xstrcpy(unit->name);
1602 filename = xstrcat(filename, (char *)".log"); 1605 filename = xstrcat(filename, (char *)".log");
1603 logger(filename, buf); 1606 logger(filename, buf);
1604 free(filename); 1607 free(filename);
1605 filename = NULL; 1608 filename = NULL;

mercurial