add NO_AUTO_IDLE option to prevent powercuts after inactivity, add temp_all_zero so power isn't cut if heater remains off for a while but has a non-zero set temperature
This commit is contained in:
parent
e05e12c9e0
commit
a68ae12679
6
clock.c
6
clock.c
|
|
@ -23,10 +23,12 @@
|
|||
called from clock_10ms(), do not call directly
|
||||
*/
|
||||
void clock_250ms() {
|
||||
#ifndef NO_AUTO_IDLE
|
||||
if (temp_all_zero()) {
|
||||
if (steptimeout > (30 * 4)) {
|
||||
power_off();
|
||||
}
|
||||
else if (heaters_all_off()) {
|
||||
else {
|
||||
uint8_t save_reg = SREG;
|
||||
cli();
|
||||
CLI_SEI_BUG_MEMORY_BARRIER();
|
||||
|
|
@ -34,6 +36,8 @@ void clock_250ms() {
|
|||
MEMORY_BARRIER();
|
||||
SREG = save_reg;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ifclock(clock_flag_1s) {
|
||||
if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) {
|
||||
|
|
|
|||
11
temp.c
11
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue