Move temp_all_zero() to heaters_all_zero().

We need the power supply for the heaters, after all, not for
the temperature sensors. Some heaters (e.g. fans) don't even have
a temp sensor.
This commit is contained in:
Markus Hitter 2012-11-30 03:26:06 +01:00
parent 28a366fc48
commit 042d9ddfc2
5 changed files with 14 additions and 15 deletions

View File

@ -8,7 +8,6 @@
#include "sersendf.h"
#include "dda_queue.h"
#include "watchdog.h"
#include "temp.h"
#include "timer.h"
#include "debug.h"
#include "heater.h"
@ -24,7 +23,7 @@
*/
static void clock_250ms(void) {
#ifndef NO_AUTO_IDLE
if (temp_all_zero()) {
if (heaters_all_zero()) {
if (psu_timeout > (30 * 4)) {
power_off();
}

View File

@ -443,6 +443,18 @@ void heater_set(heater_t index, uint8_t value) {
power_on();
}
/** \brief check wether all heaters are off
*/
uint8_t heaters_all_zero() {
uint8_t i;
for (i = 0; i < NUM_HEATERS; i++) {
if (heaters_runtime[i].heater_output)
return 0;
}
return 255;
}
/** \brief turn off all heaters
for emergency stop

View File

@ -21,6 +21,7 @@ void heater_save_settings(void);
void heater_set(heater_t index, uint8_t value);
void heater_tick(heater_t h, temp_type_t type, uint16_t current_temp, uint16_t target_temp);
uint8_t heaters_all_zero(void);
uint8_t heaters_all_off(void);
void pid_set_p(heater_t index, int32_t p);

11
temp.c
View File

@ -341,17 +341,6 @@ 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
static void single_temp_print(temp_sensor_t index) {

2
temp.h
View File

@ -41,8 +41,6 @@ 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 */