keep power on when heaters are active
Reported-by: Jacky2K@forums.reprap.org
This commit is contained in:
parent
fc57cfc5de
commit
71eafbf96b
3
clock.c
3
clock.c
|
|
@ -7,12 +7,13 @@
|
|||
#include "temp.h"
|
||||
#include "timer.h"
|
||||
#include "debug.h"
|
||||
#include "heater.h"
|
||||
|
||||
void clock_250ms() {
|
||||
if (steptimeout > (30 * 4)) {
|
||||
power_off();
|
||||
}
|
||||
else
|
||||
else if (heaters_all_off())
|
||||
steptimeout++;
|
||||
|
||||
ifclock(CLOCK_FLAG_1S) {
|
||||
|
|
|
|||
|
|
@ -389,8 +389,10 @@ void process_gcode_command() {
|
|||
break;
|
||||
// M135- set heater output
|
||||
case 135:
|
||||
if (next_target.seen_S)
|
||||
if (next_target.seen_S) {
|
||||
heater_set(next_target.P, next_target.S);
|
||||
power_on();
|
||||
}
|
||||
break;
|
||||
|
||||
case 140: //Set heated bed temperature
|
||||
|
|
|
|||
14
heater.c
14
heater.c
|
|
@ -44,6 +44,8 @@ struct {
|
|||
uint16_t sanity_counter;
|
||||
uint16_t sane_temperature;
|
||||
#endif
|
||||
|
||||
uint8_t heater_output;
|
||||
} heaters_runtime[NUM_HEATERS];
|
||||
|
||||
#define DEFAULT_P 8192
|
||||
|
|
@ -244,6 +246,8 @@ void heater_set(heater_t index, uint8_t value) {
|
|||
if (index >= NUM_HEATERS)
|
||||
return;
|
||||
|
||||
heaters_runtime[index].heater_output = value;
|
||||
|
||||
if (heaters[index].heater_pwm) {
|
||||
*(heaters[index].heater_pwm) = value;
|
||||
#ifdef DEBUG
|
||||
|
|
@ -259,6 +263,16 @@ void heater_set(heater_t index, uint8_t value) {
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t heaters_all_off() {
|
||||
uint8_t i;
|
||||
for (i = 0; i < NUM_HEATERS; i++) {
|
||||
if (heaters_runtime[i].heater_output > 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 255;
|
||||
}
|
||||
|
||||
void pid_set_p(heater_t index, int32_t p) {
|
||||
#ifndef BANG_BANG
|
||||
if (index >= NUM_HEATERS)
|
||||
|
|
|
|||
2
heater.h
2
heater.h
|
|
@ -24,6 +24,8 @@ void heater_save_settings(void);
|
|||
void heater_set(heater_t index, uint8_t value);
|
||||
void heater_tick(heater_t h, temp_sensor_t t, uint16_t current_temp, uint16_t target_temp);
|
||||
|
||||
uint8_t heaters_all_off(void);
|
||||
|
||||
void pid_set_p(heater_t index, int32_t p);
|
||||
void pid_set_i(heater_t index, int32_t i);
|
||||
void pid_set_d(heater_t index, int32_t d);
|
||||
|
|
|
|||
Loading…
Reference in New Issue