brewco/rdconfig.c

changeset 455
f84501d8dd87
parent 450
8fe99759c27f
child 464
4a624c071ca9
--- a/brewco/rdconfig.c	Fri Dec 11 15:52:37 2015 +0100
+++ b/brewco/rdconfig.c	Sat Dec 12 19:31:35 2015 +0100
@@ -551,11 +551,11 @@
 	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
 	    return 1;
 	}
-	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_TIME", "%d", Config.simulator->hlt_heater_time)) < 0) {
+	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_VOLUME", "%d", Config.simulator->hlt_heater_volume)) < 0) {
 	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
 	    return 1;
 	}
-	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_SIZE", "%f", Config.simulator->hlt_heater_size)) < 0) {
+	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_POWER", "%d", Config.simulator->hlt_heater_power)) < 0) {
 	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
 	    return 1;
 	}
@@ -572,11 +572,11 @@
 	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
 	    return 1;
 	}
-	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_TIME", "%d", Config.simulator->mlt_heater_time)) < 0) {
+	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_VOLUME", "%d", Config.simulator->mlt_heater_volume)) < 0) {
 	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
 	    return 1;
 	}                                       
-	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_SIZE", "%f", Config.simulator->mlt_heater_size)) < 0) {
+	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_POWER", "%d", Config.simulator->mlt_heater_power)) < 0) {
 	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
 	    return 1;
 	}
@@ -585,15 +585,6 @@
 	    return 1;
 	}
 
-	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HLT_TEMP", "%f", Config.simulator->s_hlt_temp)) < 0) {
-	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
-	    return 1;
-	}
-	if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_MLT_TEMP", "%f", Config.simulator->s_mlt_temp)) < 0) {
-	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
-	    return 1;
-	}
-
         if ((rc = xmlTextWriterEndElement(writer)) < 0) {
             syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
             return 1;
@@ -1195,10 +1186,10 @@
     if (! Config.simulator) {
 	Config.simulator = (simulator_var *)malloc(sizeof(simulator_var));
 	Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \
-		Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = \
-		Config.simulator->s_hlt_temp = Config.simulator->s_mlt_temp = 0.0;
-	Config.simulator->hlt_heater_size = Config.simulator->mlt_heater_size = 0.0;
-	Config.simulator->hlt_heater_time = Config.simulator->mlt_heater_time = Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0;
+		Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = 20.0;
+	Config.simulator->hlt_heater_volume = Config.simulator->mlt_heater_volume = 20;
+	Config.simulator->hlt_heater_power = Config.simulator->mlt_heater_power = 2000;
+	Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0;
     }
 
     cur = cur->xmlChildrenNode;
@@ -1221,16 +1212,16 @@
 		Config.simulator->hlt_heater_temp = fval;
 	    xmlFree(key);
 	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_TIME"))) {
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VOLUME"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
 	    if (sscanf((const char *)key, "%d", &ival) == 1)
-		Config.simulator->hlt_heater_time = ival;
+		Config.simulator->hlt_heater_volume = ival;
 	    xmlFree(key);
 	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_SIZE"))) {
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_POWER"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	    if (sscanf((const char *)key, "%f", &fval) == 1)
-		Config.simulator->hlt_heater_size = fval;
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		Config.simulator->hlt_heater_power = ival;
 	    xmlFree(key);
 	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_STATE"))) {
@@ -1251,16 +1242,16 @@
                 Config.simulator->mlt_heater_temp = fval;
             xmlFree(key);
         }
-        if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_TIME"))) {
+        if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VOLUME"))) {
             key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
             if (sscanf((const char *)key, "%d", &ival) == 1)
-                Config.simulator->mlt_heater_time = ival;
+                Config.simulator->mlt_heater_volume = ival;
             xmlFree(key);
         }
-        if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_SIZE"))) {
+        if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_POWER"))) {
             key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-            if (sscanf((const char *)key, "%f", &fval) == 1)
-                Config.simulator->mlt_heater_size = fval;
+            if (sscanf((const char *)key, "%d", &ival) == 1)
+                Config.simulator->mlt_heater_power = ival;
             xmlFree(key);
         }
         if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_STATE"))) {
@@ -1269,18 +1260,6 @@
                 Config.simulator->mlt_heater_state = ival;
             xmlFree(key);
         }
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_HLT_TEMP"))) {
-	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	    if (sscanf((const char *)key, "%f", &fval) == 1)
-		Config.simulator->s_hlt_temp = fval;
-	    xmlFree(key);
-	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_MLT_TEMP"))) {
-	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	    if (sscanf((const char *)key, "%f", &fval) == 1)
-		Config.simulator->s_mlt_temp = fval;
-	    xmlFree(key);
-	}
         cur = cur->next;
     }
 
@@ -1404,10 +1383,10 @@
 	Config.simulator = (simulator_var *)malloc(sizeof(simulator_var));
 	syslog(LOG_NOTICE, "rdconfig() init a new simulator");
 	Config.simulator->room_temperature = Config.simulator->hlt_temperature = Config.simulator->hlt_heater_temp = \
-		Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = \
-		Config.simulator->s_hlt_temp = Config.simulator->s_mlt_temp = 20.0;
-	Config.simulator->hlt_heater_size = Config.simulator->mlt_heater_size = 0.0;
-	Config.simulator->hlt_heater_time = Config.simulator->mlt_heater_time = Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0;
+		Config.simulator->mlt_temperature = Config.simulator->mlt_heater_temp = 20.0;
+	Config.simulator->hlt_heater_volume = Config.simulator->mlt_heater_volume = 20;
+	Config.simulator->hlt_heater_power = Config.simulator->mlt_heater_power = 2000;
+	Config.simulator->hlt_heater_state = Config.simulator->mlt_heater_state = 0;
     }
 #endif
 

mercurial