# HG changeset patch # User Michiel Broek # Date 1535112871 -7200 # Node ID 776a605befa5a46641ad9b087f8d9a7268c1cd1e # Parent 3593b18486d7bd6fd9c24550c0e375b8a5c94317 Added Carbonation stage. diff -r 3593b18486d7 -r 776a605befa5 thermferm/mqtt.c --- 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]; diff -r 3593b18486d7 -r 776a605befa5 thermferm/rdconfig.c --- 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; diff -r 3593b18486d7 -r 776a605befa5 thermferm/server.c --- 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]); diff -r 3593b18486d7 -r 776a605befa5 www-thermferm/units.php --- 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 .= ' '.PHP_EOL; ($f[1] == "TERTIARY") ? $se = " selected" : $se = ""; $outstr .= ' '.PHP_EOL; + ($f[1] == "CARBONATION") ? $se = " selected" : $se = ""; + $outstr .= ' '.PHP_EOL; $outstr .= ' '.PHP_EOL; }