thermferm/rdconfig.c

changeset 289
d810df0df36a
parent 286
674efa17be1d
child 293
881b1ae75468
--- a/thermferm/rdconfig.c	Wed Oct 22 12:42:20 2014 +0200
+++ b/thermferm/rdconfig.c	Sat Oct 25 21:08:47 2014 +0200
@@ -442,6 +442,18 @@
 		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 		    return 1;
 		}
+		if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_ABS", "%.3f", tmp3->prof_peak_abs)) < 0) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
+		if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_REL", "%.3f", tmp3->prof_peak_rel)) < 0) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
+		if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PRIMARY_DONE", "%d", (unsigned int)tmp3->prof_primary_done)) < 0) {
+		    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		    return 1;
+		}
 	    }
 	    if ((rc = xmlTextWriterEndElement(writer)) < 0) {
 		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
@@ -849,7 +861,7 @@
     unit->version = 1;
     unit->uuid = unit->name = unit->air_address = unit->beer_address = unit->heater_address = \
 		 unit->cooler_address = unit->fan_address = unit->door_address = unit->profile = NULL;
-    unit->volume = 0.0;
+    unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
     unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0;
     unit->air_state = unit->beer_state = 1; // missing
     unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0;
@@ -859,7 +871,7 @@
     unit->temp_set_max = 30.0;
     unit->idle_rangeH = 1.0;
     unit->idle_rangeL = -1.0;
-    unit->prof_started = unit->prof_paused = (time_t)0;
+    unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0;
     unit->prof_percent = 0;
     unit->PID_err_old = unit->PID_I_err = 0.0;
 
@@ -1017,6 +1029,24 @@
 	    }
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PEAK_ABS"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1)
+		unit->prof_peak_abs = val;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PEAK_REL"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%f", &val) == 1)
+		unit->prof_peak_rel = val;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PRIMARY_DONE"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->prof_primary_done = ival;
+	    xmlFree(key);
+	}
 	cur = cur->next;
     }
 

mercurial