Fixed profile progess percentage

Tue, 02 Sep 2014 14:14:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 02 Sep 2014 14:14:54 +0200
changeset 277
6f9a7cca8f19
parent 276
a19cc3770f09
child 278
76c8a6f18e4d

Fixed profile progess percentage

thermferm/thermferm.c file | annotate | diff | comparison | revisions
--- 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

mercurial