Prevent bed temperature being set too high

This commit is contained in:
Scott Lahteine 2017-05-28 11:11:17 -05:00
parent 493f0b0c62
commit b0eae68f57
2 changed files with 25 additions and 7 deletions

View file

@ -67,8 +67,11 @@ float Temperature::current_temperature[HOTENDS] = { 0.0 },
Temperature::current_temperature_bed = 0.0; Temperature::current_temperature_bed = 0.0;
int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
Temperature::target_temperature[HOTENDS] = { 0 }, Temperature::target_temperature[HOTENDS] = { 0 },
Temperature::current_temperature_bed_raw = 0, Temperature::current_temperature_bed_raw = 0;
Temperature::target_temperature_bed = 0;
#if HAS_HEATER_BED
int16_t Temperature::target_temperature_bed = 0;
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
float Temperature::redundant_temperature = 0.0; float Temperature::redundant_temperature = 0.0;

View file

@ -92,6 +92,10 @@ enum ADCSensorState {
#define ACTUAL_ADC_SAMPLES max(int(MIN_ADC_ISR_LOOPS), int(SensorsReady)) #define ACTUAL_ADC_SAMPLES max(int(MIN_ADC_ISR_LOOPS), int(SensorsReady))
#if !HAS_HEATER_BED
constexpr int16_t target_temperature_bed = 0;
#endif
class Temperature { class Temperature {
public: public:
@ -100,8 +104,11 @@ class Temperature {
current_temperature_bed; current_temperature_bed;
static int16_t current_temperature_raw[HOTENDS], static int16_t current_temperature_raw[HOTENDS],
target_temperature[HOTENDS], target_temperature[HOTENDS],
current_temperature_bed_raw, current_temperature_bed_raw;
target_temperature_bed;
#if HAS_HEATER_BED
static int16_t target_temperature_bed;
#endif
static volatile bool in_temp_isr; static volatile bool in_temp_isr;
@ -382,10 +389,18 @@ class Temperature {
} }
static void setTargetBed(const int16_t celsius) { static void setTargetBed(const int16_t celsius) {
target_temperature_bed = celsius; #if HAS_HEATER_BED
target_temperature_bed =
#ifdef BED_MAXTEMP
min(celsius, BED_MAXTEMP)
#else
celsius
#endif
;
#if WATCH_THE_BED #if WATCH_THE_BED
start_watching_bed(); start_watching_bed();
#endif #endif
#endif
} }
static bool isHeatingHotend(uint8_t e) { static bool isHeatingHotend(uint8_t e) {