# HG changeset patch # User Michiel Broek # Date 1406886335 -7200 # Node ID 56b008563db8a103deaecbf2e5235094e5d2e5c9 # Parent c31ea86fec438ae1d79c42132fc4181aa21cdf3b Fixed GET AIR|BEER commands. Save configuration every 30 minutes. diff -r c31ea86fec43 -r 56b008563db8 thermferm/server.c --- a/thermferm/server.c Fri Aug 01 09:25:38 2014 +0200 +++ b/thermferm/server.c Fri Aug 01 11:45:35 2014 +0200 @@ -301,13 +301,13 @@ if (strcmp(opt, (char *)"AIR") == 0) { if (unit->air_state == 0) - srv_send((char *)"215 AIR,%.3f", unit->air_temperature); + srv_send((char *)"215 AIR,%.3f", unit->air_temperature / 1000.0); else srv_send((char *)"215 AIR,NA"); return 0; } else if (strcmp(opt, (char *)"BEER") == 0) { if (unit->beer_state == 0) - srv_send((char *)"215 BEER,%.3f", unit->beer_temperature); + srv_send((char *)"215 BEER,%.3f", unit->beer_temperature / 1000.0); else srv_send((char *)"215 BEER,NA"); return 0; diff -r c31ea86fec43 -r 56b008563db8 thermferm/thermferm.c --- a/thermferm/thermferm.c Fri Aug 01 09:25:38 2014 +0200 +++ b/thermferm/thermferm.c Fri Aug 01 11:45:35 2014 +0200 @@ -231,7 +231,7 @@ char buf[1024], *filename, target[40], heater[40], cooler[40], fan[40], door[40]; time_t now, last = (time_t)0; units_list *unit; - int rc, run = 1, seconds = 0; + int rc, run = 1, seconds = 0, minutes = 0; #ifdef HAVE_WIRINGPI_H struct tm *tm; int row; @@ -380,6 +380,13 @@ filename = NULL; } } + + minutes++; + if (minutes == 60) + minutes = 0; + + if ((minutes == 15) || (minutes == 45)) + wrconfig(); } } usleep(100000);