Don't update sparge volume when brew is done. Disabled some debug messages.

Sun, 09 Jun 2024 17:00:00 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 09 Jun 2024 17:00:00 +0200
changeset 532
082786891630
parent 531
490ed8ac84a9
child 533
288ed828d11a

Don't update sparge volume when brew is done. Disabled some debug messages.

src/EditProduct.cpp file | annotate | diff | comparison | revisions
src/EditProductTab8.cpp file | annotate | diff | comparison | revisions
--- a/src/EditProduct.cpp	Sun Jun 09 16:12:09 2024 +0200
+++ b/src/EditProduct.cpp	Sun Jun 09 17:00:00 2024 +0200
@@ -512,7 +512,7 @@
     /*
      * At this point, see if we must upgrade the whole water part.
      */
-    if (product->sparge_volume != (product->brew_sparge_est + product->eq_HLT_deadspace)) {
+    if ((product->sparge_volume != (product->brew_sparge_est + product->eq_HLT_deadspace)) && (product->stage < PROD_STAGE_PRIMARY)) {
 	qDebug() << "== Update sparge water supply from" << product->sparge_volume << "to" << (product->brew_sparge_est + product->eq_HLT_deadspace);
 	product->sparge_volume = product->brew_sparge_est + product->eq_HLT_deadspace;
 	is_changed();
--- a/src/EditProductTab8.cpp	Sun Jun 09 16:12:09 2024 +0200
+++ b/src/EditProductTab8.cpp	Sun Jun 09 17:00:00 2024 +0200
@@ -226,7 +226,7 @@
 	fg = 1.002;
 
     double bure = ibu / ((0.1808 * Utils::sg_to_plato(og)) + (0.8192 * Utils::sg_to_plato(fg)));
-    qDebug() << "BU:RE" << bure << product->est_fg << product->fg << product->est_ibu << product->brew_fermenter_ibu;
+//    qDebug() << "BU:RE" << bure << product->est_fg << product->fg << product->est_ibu << product->brew_fermenter_ibu;
     ui->est_bufguEdit->setValue(bure);
     ui->est_bufguShow->setValue(bure);
 
@@ -351,7 +351,7 @@
 	 */
 	TpH = product->mash_ph;
 	protonDeficit = ProtonDeficit(TpH);
-	qDebug() << "  calc_acid tgt:" << TpH << "protonDeficit:" << protonDeficit;
+//	qDebug() << "  calc_acid tgt:" << TpH << "protonDeficit:" << protonDeficit;
 	if (protonDeficit > 0) {
 	    frac = Utils::CalcFrac(TpH, my_acids[AT].pK1, my_acids[AT].pK2, my_acids[AT].pK3);
 	    Acid = protonDeficit / frac;
@@ -359,14 +359,14 @@
 	    Acidmg = Acid;
 	    Acid = Acid / my_acids[AT].AcidSG;
 	    Acid = round((Acid / (product->wa_acid_perc / 100.0)) * 100.0) / 100.0;
-	    qDebug() << "  Mash auto Acid final old ml:" << Acid;
+//	    qDebug() << "  Mash auto Acid final old ml:" << Acid;
 	    Acid = Acidmg;
 
 	    double RealSG = round(((my_acids[AT].AcidSG - 1000) * (product->wa_acid_perc / 100)) + 1000);
 	    Acid /= RealSG;
 	    Acid /= my_acids[AT].AcidPrc / 100;
 	    Acid = round(Acid * 100.0) / 100.0;
-	    qDebug() << "  Mash auto Acid final ml:" << Acid;
+//	    qDebug() << "  Mash auto Acid final ml:" << Acid;
 
 	    QString w = my_acids[AT].name_en + ' ' + my_acids[AT].name_nl;
 	    brewing_salt_sub(w, Acid, MISC_USES_MASH);
@@ -384,7 +384,7 @@
 	double pHa = ph;	// Mixed water pH.
 	double RealSG = round(((my_acids[AT].AcidSG - 1000) * (product->wa_acid_perc / 100)) + 1000);
 	// Then calculate the new pH with added acids and malts
-	qDebug() << "  Mash pH:" << pHa;
+//	qDebug() << "  Mash pH:" << pHa;
 	Acid = RealSG;
 	Acid *= ui->mw_acidvolEdit->value();
 	Acid *= my_acids[AT].AcidPrc / 100;
@@ -394,7 +394,7 @@
 	//find the pH where the protondeficit = protondeficit by the acid
 	frac = Utils::CalcFrac(pHa, my_acids[AT].pK1, my_acids[AT].pK2, my_acids[AT].pK3);
 	protonDeficit = Acid * frac;
-	qDebug() << "  Acid:" << Acid << "protonDeficit:" << protonDeficit << "frac:" << frac << "pH:" << pHa;
+//	qDebug() << "  Acid:" << Acid << "protonDeficit:" << protonDeficit << "frac:" << frac << "pH:" << pHa;
 
 	double deltapH = 0.001;
    	double deltapd = 0.1;
@@ -410,7 +410,7 @@
 	    protonDeficit = Acid * frac;
 	    pd = ProtonDeficit(pHa);
 	}
-	qDebug() << "  n:" << n << "pd:" << pd << "protonDeficit:" << protonDeficit << "frac:" << frac << "pHa:" << pHa;
+//	qDebug() << "  n:" << n << "pd:" << pd << "protonDeficit:" << protonDeficit << "frac:" << frac << "pHa:" << pHa;
 
 	bicarbonate = wg_bicarbonate - protonDeficit * frac / liters;
 	total_alkalinity = bicarbonate * 50 / 61;
@@ -486,7 +486,6 @@
     product->wb_ph = ph;
 
     /* Mix sparge and mash waters to display the final water. */
-    qDebug() << " ca" << product->wg_amount << product->sparge_volume << calcium << product->ws_calcium;
     calcium = Utils::mix(product->wg_amount, product->sparge_volume, calcium, product->ws_calcium);
     magnesium = Utils::mix(product->wg_amount, product->sparge_volume, magnesium, product->ws_magnesium);
     sodium = Utils::mix(product->wg_amount, product->sparge_volume, sodium, product->ws_sodium);
@@ -980,7 +979,6 @@
 	return;
 
     if (product->mash_ph != val) {
-	qDebug() << "mw_ph_changed" << val << product->mash_ph;
 	product->mash_ph = val;
 	is_changed();
 	calcWater();
@@ -993,7 +991,6 @@
     if (product->calc_acid)
 	return;
 
-    qDebug() << "on_mw_acid_changed" << val;
     QString w = my_acids[product->wa_acid_name].name_en + ' ' + my_acids[product->wa_acid_name].name_nl;
     set_brewing_salt(w, val, MISC_USES_MASH);
 }
@@ -1025,8 +1022,6 @@
 
 void EditProduct::w2_volume_changed(double val)
 {
-    qDebug() << "w2_vol_changed" << val;
-
     if (product->w2_total_alkalinity && product->w2_sulfate) {
 	/*
 	 * Seems a valid water, but don't go over the total.
@@ -1056,7 +1051,7 @@
     product->waters_ok = true;
 
     if (product->w1_name != "") {
-	qDebug() << "check_waters 1" << product->w1_name;
+//	qDebug() << "check_waters 1" << product->w1_name;
     	query.prepare("SELECT unlimited_stock,inventory FROM inventory_waters WHERE name=:name");
     	query.bindValue(":name", product->w1_name);
     	query.exec();
@@ -1069,7 +1064,7 @@
     }
 
     if ((product->w2_name != "") && (product->w2_amount > 0)) {
-        qDebug() << "check_waters 2" << product->w2_name;
+    //    qDebug() << "check_waters 2" << product->w2_name;
         query.prepare("SELECT unlimited_stock,inventory FROM inventory_waters WHERE name=:name");
         query.bindValue(":name", product->w2_name);
         query.exec();
@@ -1096,7 +1091,7 @@
 {
     QSqlQuery query;
 
-    qDebug() << "w1_name_changed" << val;
+//    qDebug() << "w1_name_changed" << val;
     const QSignalBlocker blocker1(ui->w1_nameEdit);
     if (val == 0) {
 	/*
@@ -1145,7 +1140,7 @@
     QSqlQuery query;
     double hardness, ra_ppm;
 
-    qDebug() << "w2_name_changed" << val;
+//    qDebug() << "w2_name_changed" << val;
 
     if (val == 0) {	// Clear water 2.
 	product->w2_name = "";
@@ -1166,16 +1161,16 @@
         for (int i = 0; i < (val - 1); i++) {
             query.next();
         }
-	qDebug() << "set water" << query.value(1).toString();
+//	qDebug() << "set water" << query.value(1).toString();
 
-	product->w2_name = query.value(1).toString();
-	product->w2_calcium = query.value(3).toDouble();
-        product->w2_magnesium = query.value(8).toDouble();
-        product->w2_total_alkalinity = query.value(11).toDouble();
-        product->w2_sodium = query.value(7).toDouble();
-        product->w2_chloride = query.value(6).toDouble();
-        product->w2_sulfate = query.value(5).toDouble();
-        product->w2_ph = query.value(9).toDouble();
+	product->w2_name = query.value("name").toString();
+	product->w2_calcium = query.value("calcium").toDouble();
+        product->w2_magnesium = query.value("magnesium").toDouble();
+        product->w2_total_alkalinity = query.value("total_alkalinity").toDouble();
+        product->w2_sodium = query.value("sodium").toDouble();
+        product->w2_chloride = query.value("chloride").toDouble();
+        product->w2_sulfate = query.value("sulfate").toDouble();
+        product->w2_ph = query.value("ph").toDouble();
 	hardness = Utils::Hardness(product->w2_calcium, product->w2_magnesium);
 	ra_ppm = Utils::ResidualAlkalinity(product->w2_total_alkalinity, product->w2_calcium, product->w2_magnesium);
     }

mercurial