1110 if (strcmp(unit->profile, profile->uuid) == 0) { |
1110 if (strcmp(unit->profile, profile->uuid) == 0) { |
1111 |
1111 |
1112 switch (unit->prof_state) { |
1112 switch (unit->prof_state) { |
1113 case PROFILE_OFF: |
1113 case PROFILE_OFF: |
1114 unit->prof_target = profile->inittemp; |
1114 unit->prof_target = profile->inittemp; |
|
1115 unit->prof_percent = 0; |
1115 break; |
1116 break; |
1116 case PROFILE_PAUSE: |
1117 case PROFILE_PAUSE: |
1117 /* |
1118 /* |
1118 * Keep current temperature, measure pause time. For |
1119 * Keep current temperature, measure pause time. For |
1119 * temperature fall thru. |
1120 * temperature fall thru. |
1174 } |
1175 } |
1175 if (debug) |
1176 if (debug) |
1176 fprintf(stdout, " %s %02d:%02d\n", valid_step ? "TRUE":"FALSE", minutes, seconds); |
1177 fprintf(stdout, " %s %02d:%02d\n", valid_step ? "TRUE":"FALSE", minutes, seconds); |
1177 |
1178 |
1178 if (valid_step == TRUE) { |
1179 if (valid_step == TRUE) { |
|
1180 unit->prof_percent = (100 * run_minutes) / tot_minutes; |
1179 if (((minutes == 10) || (minutes == 40)) && (seconds == 1)) { |
1181 if (((minutes == 10) || (minutes == 40)) && (seconds == 1)) { |
1180 syslog(LOG_NOTICE, "Profile `%s' running %dd %02d:%02d in step %d, %d%% done, target %.3f degrees", |
1182 syslog(LOG_NOTICE, "Profile `%s' running %dd %02d:%02d in step %d, %d%% done, target %.3f degrees", |
1181 profile->name, run_hours / 24, run_hours % 24, run_minutes % 60, current_step, |
1183 profile->name, run_hours / 24, run_hours % 24, run_minutes % 60, current_step, |
1182 (100 * run_minutes) / tot_minutes, unit->prof_target); |
1184 unit->prof_percent, unit->prof_target); |
1183 } |
1185 } |
1184 } else { |
1186 } else { |
1185 /* |
1187 /* |
1186 * No more steps to do |
1188 * No more steps to do |
1187 */ |
1189 */ |
1188 unit->prof_state = PROFILE_DONE; |
1190 unit->prof_state = PROFILE_DONE; |
|
1191 unit->prof_percent = 100; |
1189 syslog(LOG_NOTICE, "Profile `%s' is done", profile->name); |
1192 syslog(LOG_NOTICE, "Profile `%s' is done", profile->name); |
1190 } |
1193 } |
1191 break; |
1194 break; |
1192 |
1195 |
1193 case PROFILE_DONE: |
1196 case PROFILE_DONE: |