From 58bc71aafdbe5070ece1ffa9b0ac67860e88a767 Mon Sep 17 00:00:00 2001 From: volpol Date: Sat, 1 Sep 2018 14:34:25 +0200 Subject: [PATCH] Abort mixing on sudden weight loss --- mgmt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.30.2