Fri, 01 Aug 2014 11:45:35 +0200
Fixed GET AIR|BEER commands. Save configuration every 30 minutes.
thermferm/server.c | file | annotate | diff | comparison | revisions | |
thermferm/thermferm.c | file | annotate | diff | comparison | revisions |
--- 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;
--- 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);