thermferm/thermferm.c

changeset 276
a19cc3770f09
parent 275
a86c702c2e4f
child 277
6f9a7cca8f19
--- a/thermferm/thermferm.c	Mon Sep 01 22:06:39 2014 +0200
+++ b/thermferm/thermferm.c	Tue Sep 02 14:10:37 2014 +0200
@@ -833,7 +833,7 @@
     profiles_list	*profile;
     prof_step		*step;
     int			rc, run = 1, seconds = 0, minutes = 0, piddelay = 0, temp, deviation;
-    int			run_seconds, run_minutes, run_hours;
+    int			run_seconds, run_minutes, run_hours, tot_minutes;
     float		err = 0.0, sp, pv, P_err, D_err, Out;
 #ifdef HAVE_WIRINGPI_H
     struct tm		*tm;
@@ -1125,8 +1125,7 @@
 						 * When all done, set state to PROFILE_DONE.
 						 */
 						previous_target = profile->inittemp;
-						time_until_now = 0;
-						current_step = 0;
+						time_until_now = current_step = tot_minutes = 0;
 						run_seconds = (int)(now - unit->prof_started - unit->prof_paused);
 						run_minutes = run_seconds / 60;
 						run_hours = run_minutes / 60;
@@ -1141,6 +1140,7 @@
 						     * 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
@@ -1169,9 +1169,10 @@
 						    fprintf(stdout, " %s %02d:%02d\n", valid_step ? "TRUE":"FALSE", minutes, seconds);
 
 						if (valid_step == TRUE) {
-						    if (((minutes == 15) || (minutes == 45)) && (seconds == 1)) {
-						    	syslog(LOG_NOTICE, "Profile `%s' running %dd %02d:%02d in step %d, target %.3f degrees", 
-								profile->name, run_hours / 24, run_hours % 24, run_minutes % 60, current_step, unit->prof_target);
+						    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);
 						    }
 						} else {
 						    /*

mercurial