thermferm/server.c

changeset 101
1302abe92eb1
parent 100
012576d7386d
child 106
1bd9a16f5061
equal deleted inserted replaced
100:012576d7386d 101:1302abe92eb1
31 extern unsigned char lcdbuf[MAX_LCDS][20][4]; 31 extern unsigned char lcdbuf[MAX_LCDS][20][4];
32 #endif 32 #endif
33 extern sys_config Config; 33 extern sys_config Config;
34 extern const char UNITMODE[5][8]; 34 extern const char UNITMODE[5][8];
35 extern const char UNITmode[5]; 35 extern const char UNITmode[5];
36 extern const char TEMPSTATE[3][8];
36 37
37 int s; /* connected socket */ 38 int s; /* connected socket */
38 int ls; /* listen socket */ 39 int ls; /* listen socket */
39 40
40 struct sockaddr_in myaddr_in; /* for local socket address */ 41 struct sockaddr_in myaddr_in; /* for local socket address */
148 uuid_generate(uu); 149 uuid_generate(uu);
149 uuid_unparse(uu, unit->uuid); 150 uuid_unparse(uu, unit->uuid);
150 unit->name = xstrcpy(param); 151 unit->name = xstrcpy(param);
151 unit->air_address = unit->beer_address = unit->io1_address = unit->io2_address = unit->profile = NULL; 152 unit->air_address = unit->beer_address = unit->io1_address = unit->io2_address = unit->profile = NULL;
152 unit->volume = 0.0; 153 unit->volume = 0.0;
154 unit->air_state = unit->beer_state = 1;
153 unit->heater_available = unit->cooler_available = unit->fan_available = FALSE; 155 unit->heater_available = unit->cooler_available = unit->fan_available = FALSE;
154 unit->air_temp = unit->beer_temp = unit->beer_set = unit->fridge_set = 20.0; 156 unit->air_temperature = unit->beer_temperature = 20000;
157 unit->beer_set = unit->fridge_set = 20.0;
155 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0; 158 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0;
156 unit->temp_set_min = 1.0; 159 unit->temp_set_min = 1.0;
157 unit->temp_set_max = 30.0; 160 unit->temp_set_max = 30.0;
158 unit->idle_rangeH = 1.0; 161 unit->idle_rangeH = 1.0;
159 unit->idle_rangeL = -1.0; 162 unit->idle_rangeL = -1.0;
274 if (i == current_unit) { 277 if (i == current_unit) {
275 srv_send((char *)"NAME,%s", unit->name); 278 srv_send((char *)"NAME,%s", unit->name);
276 srv_send((char *)"UUID,%s", unit->uuid); 279 srv_send((char *)"UUID,%s", unit->uuid);
277 if (unit->air_address) { 280 if (unit->air_address) {
278 srv_send((char *)"AIR_ADDRESS,%s", unit->air_address); 281 srv_send((char *)"AIR_ADDRESS,%s", unit->air_address);
279 srv_send((char *)"AIR_TEMP,%.1f", unit->air_temp); 282 srv_send((char *)"AIR_STATE,%s", TEMPSTATE[unit->air_state]);
283 srv_send((char *)"AIR_TEMPERATURE,%.3f", unit->air_temperature / 1000.0);
280 } 284 }
281 if (unit->beer_address) { 285 if (unit->beer_address) {
282 srv_send((char *)"BEER_ADDRESS,%s", unit->beer_address); 286 srv_send((char *)"BEER_ADDRESS,%s", unit->beer_address);
283 srv_send((char *)"BEER_TEMP,%.1f", unit->beer_temp); 287 srv_send((char *)"BEER_STATE,%s", TEMPSTATE[unit->beer_state]);
288 srv_send((char *)"BEER_TEMPERATURE,%.3f", unit->beer_temperature / 1000.0);
284 } 289 }
285 if (unit->io1_address) { 290 if (unit->io1_address) {
286 srv_send((char *)"IO1_ADDRESS,%s", unit->io1_address); 291 srv_send((char *)"IO1_ADDRESS,%s", unit->io1_address);
287 } 292 }
288 if (unit->io2_address) { 293 if (unit->io2_address) {

mercurial