temp_achieved(): check only sensors/heaters turned on.

Problem spotted, described in a helpful manner and over-fixed
by @zungmann. This fix picks up his basic idea and implements it
with already existing state properties.
This commit is contained in:
Markus Hitter 2013-12-28 10:40:49 +01:00
parent 95a44e8777
commit da8ccf7535
1 changed files with 6 additions and 3 deletions

9
temp.c
View File

@ -315,14 +315,17 @@ void temp_sensor_tick() {
sersendf_P(PSTR("\n"));
}
/// report whether all temp sensors are reading their target temperatures
/// used for M116 and friends
/**
* Report whether all temp sensors in use are reading their target
* temperatures. Used for M116 and friends.
*/
uint8_t temp_achieved() {
temp_sensor_t i;
uint8_t all_ok = 255;
for (i = 0; i < NUM_TEMP_SENSORS; i++) {
if (temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
if (temp_sensors_runtime[i].target_temp > 0 &&
temp_sensors_runtime[i].temp_residency < (TEMP_RESIDENCY_TIME*100))
all_ok = 0;
}
return all_ok;