# HG changeset patch # User Michiel Broek # Date 1409660094 -7200 # Node ID 6f9a7cca8f19576ababad6ec641a0133dad76028 # Parent a19cc3770f092e3c78fc043b8704b43e3a7c3a4f Fixed profile progess percentage diff -r a19cc3770f09 -r 6f9a7cca8f19 thermferm/thermferm.c --- a/thermferm/thermferm.c Tue Sep 02 14:10:37 2014 +0200 +++ b/thermferm/thermferm.c Tue Sep 02 14:14:54 2014 +0200 @@ -1125,13 +1125,21 @@ * When all done, set state to PROFILE_DONE. */ previous_target = profile->inittemp; - time_until_now = current_step = tot_minutes = 0; + time_until_now = current_step = 0; run_seconds = (int)(now - unit->prof_started - unit->prof_paused); run_minutes = run_seconds / 60; run_hours = run_minutes / 60; if (debug) fprintf(stdout, "run_HMS=%d,%d,%d ", run_hours, run_minutes, run_seconds); + /* + * See how long this profile will take + */ + tot_minutes = 0; + for (step = profile->steps; step; step = step->next) { + tot_minutes += ((step->steptime + step->resttime) * 60); + } + valid_step = FALSE; for (step = profile->steps; step; step = step->next) { /* @@ -1140,7 +1148,6 @@ * step->target */ current_step++; - tot_minutes += ((step->steptime + step->resttime) * 60); if ((run_hours >= time_until_now) && (run_hours < (time_until_now + step->steptime + step->resttime))) { /* * This is our current step