Skip to content
Browse files

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.
  • Loading branch information...
1 parent 28a366f commit 042d9ddfc2a944ebc7d58900e0f18d1b0fa8483d @Traumflug committed
Showing with 14 additions and 15 deletions.
  1. +1 −2 clock.c
  2. +12 −0 heater.c
  3. +1 −0 heater.h
  4. +0 −11 temp.c
  5. +0 −2 temp.h
View
3 clock.c
@@ -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
12 heater.c
@@ -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
1 heater.h
@@ -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);
View
11 temp.c
@@ -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) {
View
2 temp.h
@@ -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 */

0 comments on commit 042d9dd

Please sign in to comment.
Something went wrong with that request. Please try again.