diff --git a/clock.c b/clock.c index c83af71..80ee617 100644 --- a/clock.c +++ b/clock.c @@ -23,17 +23,21 @@ called from clock_10ms(), do not call directly */ void clock_250ms() { - if (steptimeout > (30 * 4)) { - power_off(); - } - else if (heaters_all_off()) { - uint8_t save_reg = SREG; - cli(); - CLI_SEI_BUG_MEMORY_BARRIER(); - steptimeout++; - MEMORY_BARRIER(); - SREG = save_reg; + #ifndef NO_AUTO_IDLE + if (temp_all_zero()) { + if (steptimeout > (30 * 4)) { + power_off(); + } + else { + uint8_t save_reg = SREG; + cli(); + CLI_SEI_BUG_MEMORY_BARRIER(); + steptimeout++; + MEMORY_BARRIER(); + SREG = save_reg; + } } + #endif ifclock(clock_flag_1s) { if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) { diff --git a/temp.c b/temp.c index df42697..b32b91b 100644 --- a/temp.c +++ b/temp.c @@ -326,6 +326,17 @@ uint16_t temp_get(temp_sensor_t index) { return temp_sensors_runtime[index].last_read_temp; } +uint8_t temp_all_zero() { + uint8_t i; + for (i = 0; i < NUM_TEMP_SENSORS; i++) { + if (temp_sensors[i].heater < NUM_HEATERS) { + if (temp_sensors_runtime[i].target_temp) + return 0; + } + } + return 255; +} + // extruder doesn't have sersendf_P #ifndef EXTRUDER /// send temperatures to host diff --git a/temp.h b/temp.h index 68d1afe..2e185f8 100644 --- a/temp.h +++ b/temp.h @@ -41,6 +41,8 @@ uint8_t temp_achieved(void); void temp_set(temp_sensor_t index, uint16_t temperature); uint16_t temp_get(temp_sensor_t index); +uint8_t temp_all_zero(void); + void temp_print(temp_sensor_t index); #endif /* _TEMP_H */