thermferm/thermferm.c

changeset 284
9e6fb5aed618
parent 277
6f9a7cca8f19
child 288
8b99ab77262b
--- a/thermferm/thermferm.c	Tue Sep 02 16:54:18 2014 +0200
+++ b/thermferm/thermferm.c	Wed Sep 03 15:02:09 2014 +0200
@@ -1112,6 +1112,7 @@
 			    switch (unit->prof_state) {
 				case PROFILE_OFF:
 						unit->prof_target = profile->inittemp;
+						unit->prof_percent = 0;
 						break;
 				case PROFILE_PAUSE:
 						/*
@@ -1176,16 +1177,18 @@
 						    fprintf(stdout, " %s %02d:%02d\n", valid_step ? "TRUE":"FALSE", minutes, seconds);
 
 						if (valid_step == TRUE) {
+						    unit->prof_percent = (100 * run_minutes) / tot_minutes;
 						    if (((minutes == 10) || (minutes == 40)) && (seconds == 1)) {
 						    	syslog(LOG_NOTICE, "Profile `%s' running %dd %02d:%02d in step %d, %d%% done, target %.3f degrees", 
 								profile->name, run_hours / 24, run_hours % 24, run_minutes % 60, current_step, 
-								(100 * run_minutes) / tot_minutes, unit->prof_target);
+								unit->prof_percent, unit->prof_target);
 						    }
 						} else {
 						    /*
 						     * No more steps to do
 						     */
 						    unit->prof_state = PROFILE_DONE;
+						    unit->prof_percent = 100;
 						    syslog(LOG_NOTICE, "Profile `%s' is done", profile->name);
 						}
 						break;
@@ -1201,6 +1204,7 @@
 						    previous_target = step->target;
 						}
 						unit->prof_target = previous_target;
+						unit->prof_percent = 100;
 						break;
 			    } /* switch */
 			}

mercurial