From: volpol Date: Sat, 1 Sep 2018 12:34:25 +0000 (+0200) Subject: Abort mixing on sudden weight loss X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=58bc71aafdbe5070ece1ffa9b0ac67860e88a767;p=bbd.git Abort mixing on sudden weight loss --- diff --git a/mgmt.c b/mgmt.c index 9768197..174de47 100644 --- a/mgmt.c +++ b/mgmt.c @@ -48,7 +48,8 @@ int mgmt_stop(void){ int res = MGMT_CONTINUE; double cw = curweight(); if (cw >= stop_weight) res = MGMT_NORMAL_STOP; else - if (time(NULL) >= stop_time && MAX(cw, start_weight) - MIN(cw, start_weight) < MGMT_WEIGHT_GAIN) res = MGMT_ABORT; + if (time(NULL) >= stop_time && MAX(cw, start_weight) - MIN(cw, start_weight) < MGMT_WEIGHT_GAIN) res = MGMT_ABORT; else + if ((start_weight > cw) && (start_weight - cw >= MGMT_WEIGHT_LOSS)) res = MGMT_ABORT; return res; }