Wed, 27 Feb 2019 17:38:06 +0100
Concept for yeast limits settings.
thermferm/mqtt.c | file | annotate | diff | comparison | revisions | |
thermferm/rdconfig.c | file | annotate | diff | comparison | revisions | |
thermferm/thermferm.h | file | annotate | diff | comparison | revisions |
--- a/thermferm/mqtt.c Thu Feb 07 14:59:47 2019 +0100 +++ b/thermferm/mqtt.c Wed Feb 27 17:38:06 2019 +0100 @@ -371,6 +371,16 @@ syslog(LOG_NOTICE, "DCMD change fermenter %s: product_uuid to `%s'", message_alias, unit->product_uuid); } } + if (json_object_object_get_ex(setpoint, "yeast_lo", &val)) { + unit->yeast_lo = json_object_get_double(val); + unit->mqtt_flag |= MQTT_FLAG_DATA; + syslog(LOG_NOTICE, "DCMD change fermenter %s: yeast_lo to `%.1f'", message_alias, unit->yeast_lo); + } + if (json_object_object_get_ex(setpoint, "yeast_hi", &val)) { + unit->yeast_hi = json_object_get_double(val); + unit->mqtt_flag |= MQTT_FLAG_DATA; + syslog(LOG_NOTICE, "DCMD change fermenter %s: yeast_lo to `%.1f'", message_alias, unit->yeast_hi); + } } if (json_object_object_get_ex(metric, "profile", &profile)) { @@ -687,6 +697,12 @@ payload = xstrcat(payload, unit->product_name); payload = xstrcat(payload, (char *)"\""); } + sprintf(buf, "%.1f", unit->yeast_lo); + payload = xstrcat(payload, (char *)",\"yeast_lo\":"); + payload = xstrcat(payload, buf); + sprintf(buf, "%.1f", unit->yeast_hi); + payload = xstrcat(payload, (char *)",\"yeast_hi\":"); + payload = xstrcat(payload, buf); payload = xstrcat(payload, (char *)"}"); }
--- a/thermferm/rdconfig.c Thu Feb 07 14:59:47 2019 +0100 +++ b/thermferm/rdconfig.c Wed Feb 27 17:38:06 2019 +0100 @@ -328,6 +328,8 @@ xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET_HI", "%.1f", tmp3->fridge_set_hi); xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MIN", "%.1f", tmp3->temp_set_min); xmlTextWriterWriteFormatElement(writer, BAD_CAST "TEMP_SET_MAX", "%.1f", tmp3->temp_set_max); + xmlTextWriterWriteFormatElement(writer, BAD_CAST "YEAST_LO", "%.1f", tmp3->yeast_lo); + xmlTextWriterWriteFormatElement(writer, BAD_CAST "YEAST_HI", "%.1f", tmp3->yeast_hi); if (tmp3->profile_uuid) { xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE_UUID", "%s", tmp3->profile_uuid); @@ -586,6 +588,8 @@ unit->heater_usage = unit->cooler_usage = unit->fan_usage = unit->light_usage = 0; unit->temp_set_min = 1.0; unit->temp_set_max = 30.0; + unit->yeast_lo = 12.0; + unit->yeast_hi = 24.0; unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0; unit->prof_percent = 0; unit->PID_cool = (pid_var *)malloc(sizeof(pid_var)); @@ -849,24 +853,18 @@ unit->temp_set_max = val; xmlFree(key); } -// if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KP"))) { -// key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); -// if (sscanf((const char *)key, "%f", &val) == 1) -// unit->PID_cool->pGain = unit->PID_heat->pGain = val; /* Upgrade config */ -// xmlFree(key); -// } -// if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KD"))) { -// key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); -// if (sscanf((const char *)key, "%f", &val) == 1) -// unit->PID_cool->dGain = unit->PID_heat->dGain = val; /* Upgrade config */ -// xmlFree(key); -// } -// if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KI"))) { -// key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); -// if (sscanf((const char *)key, "%f", &val) == 1) -// unit->PID_cool->iGain = unit->PID_heat->iGain = val; /* Upgrade config */ -// xmlFree(key); -// } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"YEAST_LO"))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + if (sscanf((const char *)key, "%f", &val) == 1) + unit->yeast_lo = val; + xmlFree(key); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"YEAST_HI"))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + if (sscanf((const char *)key, "%f", &val) == 1) + unit->yeast_hi = val; + xmlFree(key); + } if ((!xmlStrcmp(cur->name, (const xmlChar *)"PIDC_IMAX"))) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); if (sscanf((const char *)key, "%f", &val) == 1)
--- a/thermferm/thermferm.h Thu Feb 07 14:59:47 2019 +0100 +++ b/thermferm/thermferm.h Wed Feb 27 17:38:06 2019 +0100 @@ -224,6 +224,8 @@ int alarm_flag; /* Alarm flag */ int alarm_last; /* Last alarm state */ int stage; /* Fermentation stage */ + float yeast_lo; /* Yeast low temperature limit */ + float yeast_hi; /* Yeast high temperature limit */ } units_list; #define UNITMODE_OFF 0 /* Unit turned off */