thermferm/server.c

changeset 101
1302abe92eb1
parent 100
012576d7386d
child 106
1bd9a16f5061
--- a/thermferm/server.c	Fri Jul 11 22:53:33 2014 +0200
+++ b/thermferm/server.c	Sat Jul 12 17:57:53 2014 +0200
@@ -33,6 +33,7 @@
 extern sys_config       Config;
 extern const char	UNITMODE[5][8];
 extern const char	UNITmode[5];
+extern const char	TEMPSTATE[3][8];
 
 int			s;		/* connected socket			*/
 int			ls;		/* listen socket			*/
@@ -150,8 +151,10 @@
     	unit->name = xstrcpy(param);
     	unit->air_address = unit->beer_address = unit->io1_address = unit->io2_address = unit->profile = NULL;
     	unit->volume = 0.0;
+	unit->air_state = unit->beer_state = 1;
     	unit->heater_available = unit->cooler_available = unit->fan_available = FALSE;
-    	unit->air_temp = unit->beer_temp = unit->beer_set = unit->fridge_set = 20.0;
+    	unit->air_temperature = unit->beer_temperature = 20000;
+	unit->beer_set = unit->fridge_set = 20.0;
     	unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0;
     	unit->temp_set_min = 1.0;
     	unit->temp_set_max = 30.0;
@@ -276,11 +279,13 @@
 		srv_send((char *)"UUID,%s", unit->uuid);
 		if (unit->air_address) {
 		    srv_send((char *)"AIR_ADDRESS,%s", unit->air_address);
-		    srv_send((char *)"AIR_TEMP,%.1f", unit->air_temp);
+		    srv_send((char *)"AIR_STATE,%s", TEMPSTATE[unit->air_state]);
+		    srv_send((char *)"AIR_TEMPERATURE,%.3f", unit->air_temperature / 1000.0);
 		}
 		if (unit->beer_address) {
 		    srv_send((char *)"BEER_ADDRESS,%s", unit->beer_address);
-		    srv_send((char *)"BEER_TEMP,%.1f", unit->beer_temp);
+		    srv_send((char *)"BEER_STATE,%s", TEMPSTATE[unit->beer_state]);
+		    srv_send((char *)"BEER_TEMPERATURE,%.3f", unit->beer_temperature / 1000.0);
 		}
 		if (unit->io1_address) {
 		    srv_send((char *)"IO1_ADDRESS,%s", unit->io1_address);

mercurial