thermferm/server.c

changeset 578
d694abd9d809
parent 575
86496d2bc4bb
child 582
ba340e00aab2
--- a/thermferm/server.c	Mon Jan 21 17:11:50 2019 +0100
+++ b/thermferm/server.c	Thu Feb 07 14:59:47 2019 +0100
@@ -1697,7 +1697,7 @@
 	unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
 	unit->air_state = unit->beer_state = unit->chiller_state = 1;
 	unit->air_temperature = unit->beer_temperature = unit->chiller_temperature = 20000;
-	unit->beer_set = unit->fridge_set = unit->profile_inittemp_lo = unit->profile_inittemp_hi =20.0;
+	unit->beer_set_lo = unit->beer_set_hi = unit->fridge_set_lo = unit->fridge_set_hi = unit->profile_inittemp_lo = unit->profile_inittemp_hi =20.0;
 	unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = \
 			     unit->light_state = unit->psu_state = unit->prof_state = unit->stage = 0;
 	unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20;	/* 5 minutes delay	*/
@@ -1831,8 +1831,10 @@
 		srv_send((char *)"PSU_ADDRESS,%s", unit->psu_address);
 		srv_send((char *)"PSU_STATE,%d", unit->psu_state);
 		srv_send((char *)"PSU_IDX,%d", unit->psu_idx);
-		srv_send((char *)"FRIDGE_SET,%.1f", unit->fridge_set);
-		srv_send((char *)"BEER_SET,%.1f", unit->beer_set);
+		srv_send((char *)"FRIDGE_SET_LO,%.1f", unit->fridge_set_lo);
+		srv_send((char *)"FRIDGE_SET_HI,%.1f", unit->fridge_set_hi);
+		srv_send((char *)"BEER_SET_LO,%.1f", unit->beer_set_lo);
+		srv_send((char *)"BEER_SET_HI,%.1f", unit->beer_set_hi);
 		if (unit->profile_uuid) {
 		    srv_send((char *)"PROFILE_UUID,%s", unit->profile_uuid);
 		    srv_send((char *)"PROFILE_NAME,%s", unit->profile_name);
@@ -2224,19 +2226,35 @@
 				    }
 				}
 
-			    } else if (val && (strcmp(kwd, (char *)"FRIDGE_SET") == 0)) {
+			    } else if (val && (strcmp(kwd, (char *)"FRIDGE_SET_LO") == 0)) {
 				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
-				    if (unit->fridge_set != fval)
-				    	syslog(LOG_NOTICE, "Fermenter unit %s fridge temperature %.1f to %.1f", unit->uuid, unit->fridge_set, fval);
-				    unit->fridge_set = fval;
+				    if (unit->fridge_set_lo != fval)
+				    	syslog(LOG_NOTICE, "Fermenter unit %s fridge temp low %.1f to %.1f", unit->uuid, unit->fridge_set_lo, fval);
+				    unit->fridge_set_lo = fval;
 				    unit->mqtt_flag |= MQTT_FLAG_DATA;
 				}
 
-			    } else if (val && (strcmp(kwd, (char *)"BEER_SET") == 0)) {
+			    } else if (val && (strcmp(kwd, (char *)"FRIDGE_SET_HI") == 0)) {
+				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
+				    if (unit->fridge_set_hi != fval)
+					syslog(LOG_NOTICE, "Fermenter unit %s fridge temp high %.1f to %.1f", unit->uuid, unit->fridge_set_hi, fval);
+				    unit->fridge_set_hi = fval;
+				    unit->mqtt_flag |= MQTT_FLAG_DATA;
+			    	}
+
+			    } else if (val && (strcmp(kwd, (char *)"BEER_SET_LO") == 0)) {
 				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
-				    if (unit->beer_set != fval)
-				    	syslog(LOG_NOTICE, "Fermenter unit %s beer temperature %.1f to %.1f", unit->uuid, unit->beer_set, fval);
-				    unit->beer_set = fval;
+				    if (unit->beer_set_lo != fval)
+				    	syslog(LOG_NOTICE, "Fermenter unit %s beer temp low %.1f to %.1f", unit->uuid, unit->beer_set_lo, fval);
+				    unit->beer_set_lo = fval;
+				    unit->mqtt_flag |= MQTT_FLAG_DATA;
+				}
+
+			    } else if (val && (strcmp(kwd, (char *)"BEER_SET_HI") == 0)) {
+				if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) {
+				    if (unit->beer_set_hi != fval)
+					syslog(LOG_NOTICE, "Fermenter unit %s beer temp high %.1f to %.1f", unit->uuid, unit->beer_set_hi, fval);
+				    unit->beer_set_hi = fval;
 				    unit->mqtt_flag |= MQTT_FLAG_DATA;
 				}
 

mercurial