thermferm/rdconfig.c

changeset 71
a09c5cdc4022
parent 69
df5d983dab1b
child 72
f7cb53c50ee1
--- a/thermferm/rdconfig.c	Mon Jun 23 20:01:27 2014 +0200
+++ b/thermferm/rdconfig.c	Mon Jun 23 22:16:29 2014 +0200
@@ -124,9 +124,7 @@
     int		rc = 0;
     FILE	*fp;
     w1_therm    *tmp1;
-#ifdef HAVE_WIRINGPI_H
-    rc_switch   *tmp2;
-#endif
+    units_list	*tmp3;
 
     if (getenv((char *)"USER") == NULL) {
 	mypath = xstrcpy((char *)"/root");
@@ -148,11 +146,6 @@
     fprintf(fp, "\n");
 
 #ifdef HAVE_WIRINGPI_H
-    fprintf(fp, "# Radio controllers 433 MHz.\n");
-    fprintf(fp, "#\n");
-    fprintf(fp, "tx433	%d\n", Config.tx433);
-    fprintf(fp, "\n");
-
     fprintf(fp, "# LCD display\n");
     fprintf(fp, "#\n");
     fprintf(fp, "lcd_cols	%d\n", Config.lcd_cols);
@@ -168,15 +161,31 @@
     }
     fprintf(fp, "\n");
 
-#ifdef HAVE_WIRINGPI_H
-    fprintf(fp, "# RC switches that we want to control.\n");
+    fprintf(fp, "# Fermenter Units.\n");
     fprintf(fp, "#\n");
-    fprintf(fp, "# kwd		address	alias\n");
-    for (tmp2 = Config.rcswitch; tmp2; tmp2 = tmp2->next) {
-	fprintf(fp, "rcswitch	%s	%s\n", tmp2->address, tmp2->alias);
+    for (tmp3 = Config.units; tmp3; tmp3 = tmp3->next) {
+	fprintf(fp, "unit_uid	%s\n", tmp3->uid);
+	if (tmp3->name)
+	    fprintf(fp, "unit_name	%s\n", tmp3->name);
+	if (tmp3->volume > 0.0)
+	    fprintf(fp, "unit_volume	%.1f\n", tmp3->volume);
+	if (tmp3->air_address)
+	    fprintf(fp, "unit_air_address	%s\n", tmp3->air_address);
+	if (tmp3->beer_address)
+	    fprintf(fp, "unit_beer_address	%s\n", tmp3->beer_address);
+	if (tmp3->io_address)
+	    fprintf(fp, "unit_io_address	%s\n", tmp3->io_address);
+	fprintf(fp, "unit_heater_available	%s\n", tmp3->heater_available ? "yes":"no");
+	fprintf(fp, "unit_cooler_available	%s\n", tmp3->cooler_available ? "yes":"no");
+	fprintf(fp, "unit_fan_available	%s\n", tmp3->fan_available ? "yes":"no");
+	fprintf(fp, "unit_light_available	%s\n", tmp3->light_available ? "yes":"no");
+	fprintf(fp, "unit_mode	%d\n", tmp3->mode);
+	if (tmp3->profile) {
+	    fprintf(fp, "unit_profile	%s\n", tmp3->profile);
+	    fprintf(fp, "unit_prof_started	%d\n", (int)tmp3->prof_started);
+	}
     }
     fprintf(fp, "\n");
-#endif
 
     fprintf(fp, "# Control Settings.\n");
     fprintf(fp, "#\n");

mercurial