thermferm/rdconfig.c

changeset 95
2c28afc329a5
parent 92
116226a8c70a
child 96
d08bf980ff28
--- a/thermferm/rdconfig.c	Mon Jul 07 21:15:44 2014 +0200
+++ b/thermferm/rdconfig.c	Mon Jul 07 22:31:07 2014 +0200
@@ -30,6 +30,7 @@
 #define MY_ENCODING "utf-8"
 
 const char      UNITMODE[5][8]	= { "OFF", "NONE", "FRIDGE", "BEER", "PROFILE" };
+const char	UNITmode[5]  = { 'o', 'n', 'f', 'b', 'p' };
 const char	PROFSTATE[4][6]	= { "OFF", "PAUSE", "RUN", "DONE" };
 
 
@@ -58,6 +59,9 @@
     Config.w1therms = NULL;
     Config.my_port = 6554;
     Config.tempFormat = 'C';
+    if (Config.air_address)
+	free(Config.air_address);
+    Config.air_address = NULL;
 
     for (tmp2 = Config.units; tmp2; tmp2 = tmp2->next) {
 	if (tmp2->uuid)
@@ -96,9 +100,6 @@
     Config.lcd_cols = 16;
     Config.lcd_rows = 2;
 #endif
-
-    defaultControlSettings();
-    defaultControlConstants();
 }
 
 
@@ -172,6 +173,10 @@
 	syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
 	return 1;
     }
+    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_ADDRESS", "%s", Config.air_address)) < 0) {
+	syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+	return 1;
+    }
 
 #ifdef HAVE_WIRINGPI_H
     /* 
@@ -1000,6 +1005,9 @@
 	    Config.tempFormat = key[0];
 	    xmlFree(key);
 	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_ADDRESS"))) {
+	    Config.air_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	}
 #ifdef HAVE_WIRINGPI_H
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) {
 	    parseLCDs(doc, cur);

mercurial