--- a/src/EditRecipeTab7.cpp Thu Apr 14 21:54:37 2022 +0200 +++ b/src/EditRecipeTab7.cpp Thu Apr 14 22:47:05 2022 +0200 @@ -29,15 +29,6 @@ } -double EditRecipe::mix(double v1, double v2, double c1, double c2) -{ - if ((v1 + v2) > 0) { - return ((v1 * c1) + (v2 * c2)) / (v1 + v2); - } - return 0; -} - - void EditRecipe::calcWater() { double liters = 0; @@ -57,12 +48,12 @@ */ if (recipe->w2_name != "") { liters = recipe->w1_amount + recipe->w2_amount; - calcium = mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_calcium, recipe->w2_calcium); - magnesium = mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_magnesium, recipe->w2_magnesium); - sodium = mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_sodium, recipe->w2_sodium); - chloride = mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_chloride, recipe->w2_chloride); - sulfate = mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_sulfate, recipe->w2_sulfate); - total_alkalinity = mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_total_alkalinity, recipe->w2_total_alkalinity); + calcium = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_calcium, recipe->w2_calcium); + magnesium = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_magnesium, recipe->w2_magnesium); + sodium = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_sodium, recipe->w2_sodium); + chloride = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_chloride, recipe->w2_chloride); + sulfate = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_sulfate, recipe->w2_sulfate); + total_alkalinity = Utils::mix(recipe->w1_amount, recipe->w2_amount, recipe->w1_total_alkalinity, recipe->w2_total_alkalinity); ph = -log10(((pow(10, -recipe->w1_ph) * recipe->w1_amount) + (pow(10, -recipe->w2_ph) * recipe->w2_amount)) / liters); } else { liters = recipe->w1_amount;