Added Carbonation stage.

Fri, 24 Aug 2018 14:14:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 24 Aug 2018 14:14:31 +0200
changeset 566
776a605befa5
parent 565
3593b18486d7
child 567
6f2f8a940291

Added Carbonation stage.

thermferm/mqtt.c file | annotate | diff | comparison | revisions
thermferm/rdconfig.c file | annotate | diff | comparison | revisions
thermferm/server.c file | annotate | diff | comparison | revisions
www-thermferm/units.php file | annotate | diff | comparison | revisions
--- a/thermferm/mqtt.c	Mon Aug 06 17:04:57 2018 +0200
+++ b/thermferm/mqtt.c	Fri Aug 24 14:14:31 2018 +0200
@@ -29,7 +29,7 @@
 extern int		my_shutdown;
 extern int		my_reboot;
 extern const char	UNITMODE[5][8];
-extern const char	UNITSTAGE[3][10];
+extern const char	UNITSTAGE[4][12];
 extern const char	PROFSTATE[5][6];
 extern const char	TEMPSTATE[3][8];
 
--- a/thermferm/rdconfig.c	Mon Aug 06 17:04:57 2018 +0200
+++ b/thermferm/rdconfig.c	Fri Aug 24 14:14:31 2018 +0200
@@ -33,7 +33,7 @@
 
 const char	TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" };
 const char      UNITMODE[5][8]	= { "OFF", "NONE", "FRIDGE", "BEER", "PROFILE" };
-const char	UNITSTAGE[3][10] = { "PRIMARY", "SECONDARY", "TERTIARY" };
+const char	UNITSTAGE[4][12] = { "PRIMARY", "SECONDARY", "TERTIARY", "CARBONATION" };
 const char	PROFSTATE[5][6]	= { "OFF", "PAUSE", "RUN", "DONE", "ABORT" };
 const char	DEVTYPE[8][6] = { "NA", "W1", "GPIO", "RC433", "DHT", "I2C", "SPI", "SIM" };
 const char	DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" };
@@ -1388,7 +1388,7 @@
 	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"STAGE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	    for (i = 0; i < 3; i++) {
+	    for (i = 0; i < 4; i++) {
 		if (! xmlStrcmp(key, (const xmlChar *)UNITSTAGE[i])) {
 		    unit->stage = i;
 		    break;
--- a/thermferm/server.c	Mon Aug 06 17:04:57 2018 +0200
+++ b/thermferm/server.c	Fri Aug 24 14:14:31 2018 +0200
@@ -36,7 +36,7 @@
 extern int		run_hold;
 extern sys_config       Config;
 extern const char	UNITMODE[5][8];
-extern const char	UNITSTAGE[3][10];
+extern const char	UNITSTAGE[4][12];
 extern const char	TEMPSTATE[3][8];
 extern const char	DEVTYPE[8][6];
 extern const char	DEVPRESENT[4][6];
@@ -1950,7 +1950,11 @@
     if ((strcmp(opt, (char *)"LIST") == 0) && (param == NULL)) {
 	srv_send((char *)"212 Fermenter list follows:");
 	for (unit = Config.units; unit; unit = unit->next) {
-	    srv_send((char *)"%s,%s,%s", unit->uuid, unit->alias, UNITMODE[unit->mode]);
+	    if (strlen(unit->product_code) && strlen(unit->product_name)) {
+		srv_send((char *)"%s,%s %s,%s", unit->uuid, unit->product_code, unit->product_name, UNITMODE[unit->mode]);
+	    } else {
+	    	srv_send((char *)"%s,%s,%s", unit->uuid, unit->alias, UNITMODE[unit->mode]);
+	    }
 	}
 	srv_send((char *)".");
 	return 0;
@@ -2455,7 +2459,7 @@
 				}
 
 			    } else if (val && (strcmp(kwd, (char *)"STAGE") == 0)) {
-				for (i = 0; i < 3; i++) {
+				for (i = 0; i < 4; i++) {
 				    if (strcmp(val, UNITSTAGE[i]) == 0) {
 					if (i != unit->stage) {
 					    syslog(LOG_NOTICE, "Fermenter unit %s stage %s to %s", unit->uuid, UNITSTAGE[unit->stage], UNITSTAGE[i]);
--- a/www-thermferm/units.php	Mon Aug 06 17:04:57 2018 +0200
+++ b/www-thermferm/units.php	Fri Aug 24 14:14:31 2018 +0200
@@ -389,6 +389,8 @@
 		$outstr .= '         <option value="SECONDARY"'.$se.'>Secondary</option>'.PHP_EOL;
 		($f[1] == "TERTIARY") ? $se = " selected" : $se = "";
 		$outstr .= '         <option value="TERTIARY"'.$se.'>Tertiary</option>'.PHP_EOL;
+		($f[1] == "CARBONATION") ? $se = " selected" : $se = "";
+		$outstr .= '         <option value="CARBONATION"'.$se.'>Carbonation</option>'.PHP_EOL;
 		$outstr .= '        </select></td>'.PHP_EOL;
 	    }
 

mercurial