Add HAS_HEATED_BED conditional (#10495)

This commit is contained in:
Scott Lahteine 2018-04-23 17:13:01 -05:00 committed by GitHub
parent 10a25f733e
commit cb46cb8480
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 303 additions and 260 deletions

View file

@ -80,7 +80,7 @@ uint8 adc_pins[] = {
#if HAS_TEMP_4 #if HAS_TEMP_4
TEMP_4_PIN, TEMP_4_PIN,
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
TEMP_BED_PIN, TEMP_BED_PIN,
#endif #endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
@ -104,7 +104,7 @@ enum TEMP_PINS : char {
#if HAS_TEMP_4 #if HAS_TEMP_4
TEMP_4, TEMP_4,
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
TEMP_BED, TEMP_BED,
#endif #endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
@ -211,7 +211,7 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
#if HAS_TEMP_4 #if HAS_TEMP_4
case TEMP_4_PIN: pin_index = TEMP_4; break; case TEMP_4_PIN: pin_index = TEMP_4; break;
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
case TEMP_BED_PIN: pin_index = TEMP_BED; break; case TEMP_BED_PIN: pin_index = TEMP_BED; break;
#endif #endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)

View file

@ -37,7 +37,7 @@ void handle_status_leds(void) {
if (ELAPSED(millis(), next_status_led_update_ms)) { if (ELAPSED(millis(), next_status_led_update_ms)) {
next_status_led_update_ms += 500; // Update every 0.5s next_status_led_update_ms += 500; // Update every 0.5s
float max_temp = 0.0; float max_temp = 0.0;
#if HAS_TEMP_BED #if HAS_HEATED_BED
max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed()); max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
#endif #endif
HOTEND_LOOP() HOTEND_LOOP()

View file

@ -67,7 +67,9 @@ static char sd_filename[MAXPATHNAMELENGTH];
SERIAL_PROTOCOLPAIR("leveling: ", int(job_recovery_info.leveling)); SERIAL_PROTOCOLPAIR("leveling: ", int(job_recovery_info.leveling));
SERIAL_PROTOCOLLNPAIR(" fade: ", int(job_recovery_info.fade)); SERIAL_PROTOCOLLNPAIR(" fade: ", int(job_recovery_info.fade));
#endif #endif
SERIAL_PROTOCOLLNPAIR("target_temperature_bed: ", job_recovery_info.target_temperature_bed); #if HAS_HEATED_BED
SERIAL_PROTOCOLLNPAIR("target_temperature_bed: ", job_recovery_info.target_temperature_bed);
#endif
SERIAL_PROTOCOLLNPAIR("cmd_queue_index_r: ", job_recovery_info.cmd_queue_index_r); SERIAL_PROTOCOLLNPAIR("cmd_queue_index_r: ", job_recovery_info.cmd_queue_index_r);
SERIAL_PROTOCOLLNPAIR("commands_in_queue: ", job_recovery_info.commands_in_queue); SERIAL_PROTOCOLLNPAIR("commands_in_queue: ", job_recovery_info.commands_in_queue);
if (recovery) if (recovery)
@ -196,7 +198,9 @@ void save_job_recovery_info() {
COPY(job_recovery_info.current_position, current_position); COPY(job_recovery_info.current_position, current_position);
job_recovery_info.feedrate = feedrate_mm_s; job_recovery_info.feedrate = feedrate_mm_s;
COPY(job_recovery_info.target_temperature, thermalManager.target_temperature); COPY(job_recovery_info.target_temperature, thermalManager.target_temperature);
job_recovery_info.target_temperature_bed = thermalManager.target_temperature_bed; #if HAS_HEATED_BED
job_recovery_info.target_temperature_bed = thermalManager.target_temperature_bed;
#endif
COPY(job_recovery_info.fanSpeeds, fanSpeeds); COPY(job_recovery_info.fanSpeeds, fanSpeeds);
#if HAS_LEVELING #if HAS_LEVELING

View file

@ -41,9 +41,12 @@ typedef struct {
// Machine state // Machine state
float current_position[NUM_AXIS], feedrate; float current_position[NUM_AXIS], feedrate;
int16_t target_temperature[HOTENDS], int16_t target_temperature[HOTENDS],
target_temperature_bed,
fanSpeeds[FAN_COUNT]; fanSpeeds[FAN_COUNT];
#if HAS_HEATED_BED
int16_t target_temperature_bed;
#endif
#if HAS_LEVELING #if HAS_LEVELING
bool leveling; bool leveling;
float fade; float fade;

View file

@ -417,7 +417,7 @@ inline bool look_for_lines_to_connect() {
*/ */
inline bool turn_on_heaters() { inline bool turn_on_heaters() {
millis_t next = millis() + 5000UL; millis_t next = millis() + 5000UL;
#if HAS_TEMP_BED #if HAS_HEATED_BED
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
if (g26_bed_temp > 25) { if (g26_bed_temp > 25) {
lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
@ -839,7 +839,7 @@ void GcodeSuite::G26() {
#endif #endif
if (!g26_keep_heaters_on) { if (!g26_keep_heaters_on) {
#if HAS_TEMP_BED #if HAS_HEATED_BED
thermalManager.setTargetBed(0); thermalManager.setTargetBed(0);
#endif #endif
thermalManager.setTargetHotend(0, 0); thermalManager.setTargetHotend(0, 0);

View file

@ -365,7 +365,7 @@ void GcodeSuite::process_parsed_command(
case 113: M113(); break; // M113: Set Host Keepalive interval case 113: M113(); break; // M113: Set Host Keepalive interval
#endif #endif
#if HAS_HEATER_BED && HAS_TEMP_BED #if HAS_HEATED_BED
case 140: M140(); break; // M140: Set bed temperature case 140: M140(); break; // M140: Set bed temperature
case 190: M190(); break; // M190: Wait for bed temperature to reach target case 190: M190(); break; // M190: Wait for bed temperature to reach target
#endif #endif

View file

@ -547,7 +547,7 @@ private:
#endif #endif
#endif #endif
#if HAS_HEATER_BED && HAS_TEMP_BED #if HAS_HEATED_BED
static void M140(); static void M140();
static void M190(); static void M190();
#endif #endif

View file

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if HAS_HEATER_BED && HAS_TEMP_BED #if HAS_HEATED_BED
#include "../gcode.h" #include "../gcode.h"
#include "../../module/temperature.h" #include "../../module/temperature.h"
@ -177,4 +177,4 @@ void GcodeSuite::M190() {
#endif #endif
} }
#endif // HAS_HEATER_BED && HAS_TEMP_BED #endif // HAS_HEATED_BED

View file

@ -764,7 +764,6 @@
#define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)) #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2) #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
#define HAS_TEMP_CHAMBER (PIN_EXISTS(TEMP_CHAMBER) && TEMP_SENSOR_CHAMBER != 0 && TEMP_SENSOR_CHAMBER > -2) #define HAS_TEMP_CHAMBER (PIN_EXISTS(TEMP_CHAMBER) && TEMP_SENSOR_CHAMBER != 0 && TEMP_SENSOR_CHAMBER > -2)
#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || HAS_TEMP_BED || HAS_TEMP_CHAMBER)
// Heaters // Heaters
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
@ -774,8 +773,11 @@
#define HAS_HEATER_4 (PIN_EXISTS(HEATER_4)) #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
#define HAS_HEATED_BED (HAS_TEMP_BED && HAS_HEATER_BED)
#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_TEMP_CHAMBER)
// Thermal protection // Thermal protection
#define HAS_THERMALLY_PROTECTED_BED (ENABLED(THERMAL_PROTECTION_BED) && HAS_TEMP_BED && HAS_HEATER_BED) #define HAS_THERMALLY_PROTECTED_BED (HAS_HEATED_BED && ENABLED(THERMAL_PROTECTION_BED))
#define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
#define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0) #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
@ -897,7 +899,7 @@
/** /**
* Heated bed requires settings * Heated bed requires settings
*/ */
#if HAS_HEATER_BED #if HAS_HEATED_BED
#ifndef MAX_BED_POWER #ifndef MAX_BED_POWER
#define MAX_BED_POWER 255 #define MAX_BED_POWER 255
#endif #endif

View file

@ -21,7 +21,7 @@
*/ */
/** /**
* Standard Marlin Boot Screen bitmaps * Standard Marlin Boot and Status Screen bitmaps
* *
* Use the Marlin Bitmap Converter to make your own: * Use the Marlin Bitmap Converter to make your own:
* http://marlinfw.org/tools/u8glib/converter.html * http://marlinfw.org/tools/u8glib/converter.html
@ -136,7 +136,7 @@
// STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations. // STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations.
#include "../../../_Statusscreen.h" #include "../../../_Statusscreen.h"
#elif HAS_TEMP_BED #elif HAS_HEATED_BED
#define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 64)) #define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 64))
#define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 64)) #define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 64))
@ -321,7 +321,7 @@
}; };
#endif // HOTENDS #endif // HOTENDS
#else // !HAS_TEMP_BED #else // !HAS_HEATED_BED
#define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 96)) #define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 96))
#define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 96)) #define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 96))
@ -507,7 +507,7 @@
#endif // HOTENDS #endif // HOTENDS
#endif // !HAS_TEMP_BED #endif // !HAS_HEATED_BED
#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY) #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY)

View file

@ -45,7 +45,7 @@ FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, cons
UNUSED(blink); UNUSED(blink);
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
const bool isBed = heater < 0; const bool isBed = heater < 0;
#else #else
constexpr bool isBed = false; constexpr bool isBed = false;
@ -53,32 +53,48 @@ FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, cons
if (PAGE_UNDER(7)) { if (PAGE_UNDER(7)) {
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : const bool is_idle = (
#if HAS_TEMP_BED #if HAS_HEATED_BED
thermalManager.is_bed_idle() isBed ? thermalManager.is_bed_idle() :
#else
false
#endif #endif
thermalManager.is_heater_idle(heater)
); );
if (blink || !is_idle) if (blink || !is_idle)
#endif #endif
_draw_centered_temp((isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)) + 0.5, x, 7); } _draw_centered_temp(0.5 + (
#if HAS_HEATED_BED
isBed ? thermalManager.degTargetBed() :
#endif
thermalManager.degTargetHotend(heater)
), x, 7
);
}
if (PAGE_CONTAINS(21, 28)) if (PAGE_CONTAINS(21, 28))
_draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28); _draw_centered_temp(0.5 + (
#if HAS_HEATED_BED
isBed ? thermalManager.degBed() :
#endif
thermalManager.degHotend(heater)
), x, 28
);
if (PAGE_CONTAINS(17, 20)) { if (PAGE_CONTAINS(17, 20)) {
const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X, const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X,
y = isBed ? 18 : 17; y = isBed ? 18 : 17;
if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) { if (
#if HAS_HEATED_BED
isBed ? thermalManager.isHeatingBed() :
#endif
thermalManager.isHeatingHotend(heater)
) {
u8g.setColorIndex(0); // white on black u8g.setColorIndex(0); // white on black
u8g.drawBox(x + h, y, 2, 2); u8g.drawBox(x + h, y, 2, 2);
u8g.setColorIndex(1); // black on white u8g.setColorIndex(1); // black on white
} }
else { else
u8g.drawBox(x + h, y, 2, 2); u8g.drawBox(x + h, y, 2, 2);
}
} }
} }
@ -199,7 +215,7 @@ static void lcd_implementation_status_screen() {
HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink); HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink);
// Heated bed // Heated bed
#if HOTENDS < 4 && HAS_TEMP_BED #if HOTENDS < 4 && HAS_HEATED_BED
_draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink); _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink);
#endif #endif

View file

@ -525,12 +525,12 @@ void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool
static struct { static struct {
bool E1_show_target : 1; bool E1_show_target : 1;
bool E2_show_target : 1; bool E2_show_target : 1;
#if HAS_HEATER_BED #if HAS_HEATED_BED
bool bed_show_target : 1; bool bed_show_target : 1;
#endif #endif
} display_state = { } display_state = {
true, true true, true
#if HAS_HEATER_BED #if HAS_HEATED_BED
, true , true
#endif #endif
}; };
@ -569,7 +569,7 @@ void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const i
display_state.E2_show_target = show_target; display_state.E2_show_target = show_target;
} }
#if HAS_HEATER_BED #if HAS_HEATED_BED
void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) { void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) {
const bool show_target = target && FAR(temp, target); const bool show_target = target && FAR(temp, target);
draw_temps(2 draw_temps(2
@ -680,7 +680,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
#if EXTRUDERS == 2 #if EXTRUDERS == 2
const int16_t extruder_2_target = thermalManager.degTargetHotend(1); const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
#endif #endif
#if HAS_HEATER_BED #if HAS_HEATED_BED
const int16_t bed_target = thermalManager.degTargetBed(); const int16_t bed_target = thermalManager.degTargetBed();
#endif #endif
static uint16_t last_checksum = 0; static uint16_t last_checksum = 0;
@ -688,7 +688,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
#if EXTRUDERS == 2 #if EXTRUDERS == 2
^ extruder_2_target ^ extruder_2_target
#endif #endif
#if HAS_HEATER_BED #if HAS_HEATED_BED
^ bed_target ^ bed_target
#endif #endif
; ;
@ -709,7 +709,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
const int16_t extruder_2_temp = thermalManager.degHotend(1), const int16_t extruder_2_temp = thermalManager.degHotend(1),
extruder_2_target = thermalManager.degTargetHotend(1); extruder_2_target = thermalManager.degTargetHotend(1);
#endif #endif
#if HAS_HEATER_BED #if HAS_HEATED_BED
const int16_t bed_temp = thermalManager.degBed(), const int16_t bed_temp = thermalManager.degBed(),
bed_target = thermalManager.degTargetBed(); bed_target = thermalManager.degTargetBed();
#endif #endif
@ -718,7 +718,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
#if EXTRUDERS == 2 #if EXTRUDERS == 2
draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate); draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate);
#endif #endif
#if HAS_HEATER_BED #if HAS_HEATED_BED
draw_bed_temp(bed_temp, bed_target, forceUpdate); draw_bed_temp(bed_temp, bed_target, forceUpdate);
#endif #endif
draw_fan_speed(fan_speed); draw_fan_speed(fan_speed);
@ -727,7 +727,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
// Update the fan and bed animations // Update the fan and bed animations
if (fan_speed > 0) draw_fan_icon(blink); if (fan_speed > 0) draw_fan_icon(blink);
#if HAS_HEATER_BED #if HAS_HEATED_BED
if (bed_target > 0) if (bed_target > 0)
draw_heat_icon(blink, true); draw_heat_icon(blink, true);
else else

View file

@ -893,9 +893,11 @@ void kill_screen(const char* lcd_msg) {
#endif #endif
)); ));
// Restore the bed temperature #if HAS_HEATED_BED
sprintf_P(cmd, PSTR("M190 S%i"), job_recovery_info.target_temperature_bed); // Restore the bed temperature
enqueue_and_echo_command(cmd); sprintf_P(cmd, PSTR("M190 S%i"), job_recovery_info.target_temperature_bed);
enqueue_and_echo_command(cmd);
#endif
// Restore all hotend temperatures // Restore all hotend temperatures
HOTEND_LOOP() { HOTEND_LOOP() {
@ -1431,7 +1433,7 @@ void kill_screen(const char* lcd_msg) {
// //
// Bed: // Bed:
// //
#if HAS_TEMP_BED #if HAS_HEATED_BED
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
#endif #endif
@ -2136,7 +2138,7 @@ void kill_screen(const char* lcd_msg) {
x_plot = 0, x_plot = 0,
y_plot = 0; y_plot = 0;
#if HAS_TEMP_BED #if HAS_HEATED_BED
static int16_t custom_bed_temp = 50; static int16_t custom_bed_temp = 50;
#endif #endif
@ -2146,7 +2148,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_custom_mesh() { void _lcd_ubl_build_custom_mesh() {
char UBL_LCD_GCODE[20]; char UBL_LCD_GCODE[20];
enqueue_and_echo_commands_P(PSTR("G28")); enqueue_and_echo_commands_P(PSTR("G28"));
#if HAS_TEMP_BED #if HAS_HEATED_BED
sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp); sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
lcd_enqueue_command(UBL_LCD_GCODE); lcd_enqueue_command(UBL_LCD_GCODE);
#endif #endif
@ -2167,7 +2169,7 @@ void kill_screen(const char* lcd_msg) {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_BUILD_MESH_MENU); MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10)); MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
#if HAS_TEMP_BED #if HAS_HEATED_BED
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 15)); MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 15));
#endif #endif
MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh); MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
@ -2226,7 +2228,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_validate_custom_mesh() { void _lcd_ubl_validate_custom_mesh() {
char UBL_LCD_GCODE[24]; char UBL_LCD_GCODE[24];
const int temp = const int temp =
#if HAS_TEMP_BED #if HAS_HEATED_BED
custom_bed_temp custom_bed_temp
#else #else
0 0
@ -2249,7 +2251,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_validate_mesh() { void _lcd_ubl_validate_mesh() {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_TOOLS); MENU_BACK(MSG_UBL_TOOLS);
#if HAS_TEMP_BED #if HAS_HEATED_BED
MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#else #else
@ -2353,7 +2355,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_mesh() { void _lcd_ubl_build_mesh() {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_TOOLS); MENU_BACK(MSG_UBL_TOOLS);
#if HAS_TEMP_BED #if HAS_HEATED_BED
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR( MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\n" "G28\n"
"M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n" "M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
@ -2746,7 +2748,7 @@ void kill_screen(const char* lcd_msg) {
// //
bool has_heat = false; bool has_heat = false;
HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; } HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; }
#if HAS_TEMP_BED #if HAS_HEATED_BED
if (thermalManager.target_temperature_bed) has_heat = true; if (thermalManager.target_temperature_bed) has_heat = true;
#endif #endif
if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown); if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
@ -3466,7 +3468,7 @@ void kill_screen(const char* lcd_msg) {
// //
// Bed: // Bed:
// //
#if HAS_TEMP_BED #if HAS_HEATED_BED
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
#endif #endif
@ -5117,7 +5119,7 @@ void lcd_update() {
} }
#endif #endif
#endif #endif // ULTIPANEL
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)

View file

@ -476,15 +476,14 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
} }
FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) { FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) {
#if TEMP_SENSOR_BED #if HAS_HEATED_BED
const bool isBed = heater < 0; const bool isBed = heater < 0;
const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)),
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
#else #else
constexpr bool isBed = false; const float t1 = thermalManager.degHotend(heater), t2 = thermalManager.degTargetHotend(heater);
#endif #endif
const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)),
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
if (prefix >= 0) lcd_put_wchar(prefix); if (prefix >= 0) lcd_put_wchar(prefix);
lcd_put_u8str(itostr3(t1 + 0.5)); lcd_put_u8str(itostr3(t1 + 0.5));
@ -493,12 +492,11 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
#if !HEATER_IDLE_HANDLER #if !HEATER_IDLE_HANDLER
UNUSED(blink); UNUSED(blink);
#else #else
const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : const bool is_idle = (
#if HAS_TEMP_BED #if HAS_HEATED_BED
thermalManager.is_bed_idle() isBed ? thermalManager.is_bed_idle() :
#else
false
#endif #endif
thermalManager.is_heater_idle(heater)
); );
if (!blink && is_idle) { if (!blink && is_idle) {

View file

@ -1056,7 +1056,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
} }
#endif #endif
#if HOMING_Z_WITH_PROBE && HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER) #if HOMING_Z_WITH_PROBE && HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
// Wait for bed to heat back up between probing points // Wait for bed to heat back up between probing points
if (axis == Z_AXIS && distance < 0 && thermalManager.isHeatingBed()) { if (axis == Z_AXIS && distance < 0 && thermalManager.isHeatingBed()) {
serialprintPGM(msg_wait_for_bed_heating); serialprintPGM(msg_wait_for_bed_heating);

View file

@ -483,7 +483,7 @@ bool set_probe_deployed(const bool deploy) {
* @return true to indicate an error * @return true to indicate an error
*/ */
#if HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER) #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
const char msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n"; const char msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
#endif #endif
@ -492,7 +492,7 @@ static bool do_probe_move(const float z, const float fr_mm_m) {
if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
#endif #endif
#if HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER) #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
// Wait for bed to heat back up between probing points // Wait for bed to heat back up between probing points
if (thermalManager.isHeatingBed()) { if (thermalManager.isHeatingBed()) {
serialprintPGM(msg_wait_for_bed_heating); serialprintPGM(msg_wait_for_bed_heating);

View file

@ -44,7 +44,7 @@
float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true); float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
#define DEPLOY_PROBE() set_probe_deployed(true) #define DEPLOY_PROBE() set_probe_deployed(true)
#define STOW_PROBE() set_probe_deployed(false) #define STOW_PROBE() set_probe_deployed(false)
#if HAS_TEMP_BED && ENABLED(WAIT_FOR_BED_HEATER) #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
extern const char msg_wait_for_bed_heating[25]; extern const char msg_wait_for_bed_heating[25];
#endif #endif
#else #else

View file

@ -63,7 +63,7 @@ Temperature thermalManager;
* Macros to include the heater id in temp errors. The compiler's dead-code * Macros to include the heater id in temp errors. The compiler's dead-code
* elimination should (hopefully) optimize out the unused strings. * elimination should (hopefully) optimize out the unused strings.
*/ */
#if HAS_TEMP_BED #if HAS_HEATED_BED
#define TEMP_ERR_PSTR(MSG, E) \ #define TEMP_ERR_PSTR(MSG, E) \
(E) == -1 ? PSTR(MSG ## _BED) : \ (E) == -1 ? PSTR(MSG ## _BED) : \
(HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \ (HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \
@ -82,21 +82,51 @@ Temperature thermalManager;
// public: // public:
float Temperature::current_temperature[HOTENDS] = { 0.0 }, float Temperature::current_temperature[HOTENDS] = { 0.0 };
Temperature::current_temperature_chamber = 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_chamber_raw = 0,
Temperature::current_temperature_bed_raw = 0;
#if ENABLED(AUTO_POWER_E_FANS) #if ENABLED(AUTO_POWER_E_FANS)
int16_t Temperature::autofan_speed[HOTENDS] = { 0 }; int16_t Temperature::autofan_speed[HOTENDS] = { 0 };
#endif #endif
#if HAS_HEATER_BED #if HAS_HEATED_BED
int16_t Temperature::target_temperature_bed = 0; float Temperature::current_temperature_bed = 0.0;
int16_t Temperature::current_temperature_bed_raw = 0,
Temperature::target_temperature_bed = 0;
uint8_t Temperature::soft_pwm_amount_bed;
#ifdef BED_MINTEMP
int16_t Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
#endif
#ifdef BED_MAXTEMP
int16_t Temperature::bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
#endif
#if WATCH_THE_BED
uint16_t Temperature::watch_target_bed_temp = 0;
millis_t Temperature::watch_bed_next_ms = 0;
#endif
#if ENABLED(PIDTEMPBED)
float Temperature::bedKp, Temperature::bedKi, Temperature::bedKd, // Initialized by settings.load()
Temperature::temp_iState_bed = { 0 },
Temperature::temp_dState_bed = { 0 },
Temperature::pTerm_bed,
Temperature::iTerm_bed,
Temperature::dTerm_bed,
Temperature::pid_error_bed;
#else
millis_t Temperature::next_bed_check_ms;
#endif
uint16_t Temperature::raw_temp_bed_value = 0;
#if HEATER_IDLE_HANDLER
millis_t Temperature::bed_idle_timeout_ms = 0;
bool Temperature::bed_idle_timeout_exceeded = false;
#endif
#endif // HAS_HEATED_BED
#if HAS_TEMP_CHAMBER
float Temperature::current_temperature_chamber = 0.0;
int16_t Temperature::current_temperature_chamber_raw = 0;
uint16_t Temperature::raw_temp_chamber_value = 0;
#endif #endif
// Initialized by settings.load() // Initialized by settings.load()
@ -114,11 +144,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
#endif #endif
#endif #endif
// Initialized by settings.load()
#if ENABLED(PIDTEMPBED)
float Temperature::bedKp, Temperature::bedKi, Temperature::bedKd;
#endif
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
volatile int Temperature::babystepsTodo[XYZ] = { 0 }; volatile int Temperature::babystepsTodo[XYZ] = { 0 };
#endif #endif
@ -128,11 +153,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 }; millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
#endif #endif
#if WATCH_THE_BED
uint16_t Temperature::watch_target_bed_temp = 0;
millis_t Temperature::watch_bed_next_ms = 0;
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION) #if ENABLED(PREVENT_COLD_EXTRUSION)
bool Temperature::allow_cold_extrude = false; bool Temperature::allow_cold_extrude = false;
int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP; int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
@ -169,20 +189,7 @@ volatile bool Temperature::temp_meas_ready = false;
bool Temperature::pid_reset[HOTENDS]; bool Temperature::pid_reset[HOTENDS];
#endif #endif
#if ENABLED(PIDTEMPBED) uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 };
float Temperature::temp_iState_bed = { 0 },
Temperature::temp_dState_bed = { 0 },
Temperature::pTerm_bed,
Temperature::iTerm_bed,
Temperature::dTerm_bed,
Temperature::pid_error_bed;
#else
millis_t Temperature::next_bed_check_ms;
#endif
uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 },
Temperature::raw_temp_chamber_value = 0,
Temperature::raw_temp_bed_value = 0;
// Init min and max temp with extreme values to prevent false errors during startup // Init min and max temp with extreme values to prevent false errors during startup
int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP, HEATER_4_RAW_LO_TEMP), int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP, HEATER_4_RAW_LO_TEMP),
@ -198,14 +205,6 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE
millis_t Temperature::preheat_end_time[HOTENDS] = { 0 }; millis_t Temperature::preheat_end_time[HOTENDS] = { 0 };
#endif #endif
#ifdef BED_MINTEMP
int16_t Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
#endif
#ifdef BED_MAXTEMP
int16_t Temperature::bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
int8_t Temperature::meas_shift_index; // Index of a delayed sample in buffer int8_t Temperature::meas_shift_index; // Index of a delayed sample in buffer
#endif #endif
@ -214,8 +213,7 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE
millis_t Temperature::next_auto_fan_check_ms = 0; millis_t Temperature::next_auto_fan_check_ms = 0;
#endif #endif
uint8_t Temperature::soft_pwm_amount[HOTENDS], uint8_t Temperature::soft_pwm_amount[HOTENDS];
Temperature::soft_pwm_amount_bed;
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT], uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT],
@ -233,10 +231,6 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
millis_t Temperature::heater_idle_timeout_ms[HOTENDS] = { 0 }; millis_t Temperature::heater_idle_timeout_ms[HOTENDS] = { 0 };
bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false }; bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false };
#if HAS_TEMP_BED
millis_t Temperature::bed_idle_timeout_ms = 0;
bool Temperature::bed_idle_timeout_exceeded = false;
#endif
#endif #endif
#if ENABLED(ADC_KEYPAD) #if ENABLED(ADC_KEYPAD)
@ -546,8 +540,13 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
Temperature::Temperature() { } Temperature::Temperature() { }
int Temperature::getHeaterPower(int heater) { int Temperature::getHeaterPower(const int heater) {
return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater]; return (
#if HAS_HEATED_BED
heater < 0 ? soft_pwm_amount_bed :
#endif
soft_pwm_amount[heater]
);
} }
#if HAS_AUTO_FAN #if HAS_AUTO_FAN
@ -618,6 +617,7 @@ void Temperature::_temp_error(const int8_t e, const char * const serial_msg, con
void Temperature::max_temp_error(const int8_t e) { void Temperature::max_temp_error(const int8_t e) {
_temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e)); _temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e));
} }
void Temperature::min_temp_error(const int8_t e) { void Temperature::min_temp_error(const int8_t e) {
_temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e)); _temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e));
} }
@ -857,29 +857,29 @@ void Temperature::manage_heater() {
} }
#endif // FILAMENT_WIDTH_SENSOR #endif // FILAMENT_WIDTH_SENSOR
#if WATCH_THE_BED #if HAS_HEATED_BED
// Make sure temperature is increasing
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) { // Time to check the bed?
if (degBed() < watch_target_bed_temp) // Failed to increase enough?
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1));
else // Start again if the target is still far off
start_watching_bed();
}
#endif // WATCH_THE_BED
#if DISABLED(PIDTEMPBED) #if WATCH_THE_BED
if (PENDING(ms, next_bed_check_ms) // Make sure temperature is increasing
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) { // Time to check the bed?
if (degBed() < watch_target_bed_temp) // Failed to increase enough?
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1));
else // Start again if the target is still far off
start_watching_bed();
}
#endif // WATCH_THE_BED
#if DISABLED(PIDTEMPBED)
if (PENDING(ms, next_bed_check_ms)
#if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
&& paused == last_pause_state
#endif
) return;
next_bed_check_ms = ms + BED_CHECK_INTERVAL;
#if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING) #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
&& paused == last_pause_state last_pause_state = paused;
#endif #endif
) return;
next_bed_check_ms = ms + BED_CHECK_INTERVAL;
#if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING)
last_pause_state = paused;
#endif #endif
#endif
#if HAS_TEMP_BED
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
if (!bed_idle_timeout_exceeded && bed_idle_timeout_ms && ELAPSED(ms, bed_idle_timeout_ms)) if (!bed_idle_timeout_exceeded && bed_idle_timeout_ms && ELAPSED(ms, bed_idle_timeout_ms))
@ -920,7 +920,7 @@ void Temperature::manage_heater() {
} }
#endif #endif
} }
#endif // HAS_TEMP_BED #endif // HAS_HEATED_BED
} }
#define PGM_RD_W(x) (short)pgm_read_word(&x) #define PGM_RD_W(x) (short)pgm_read_word(&x)
@ -968,7 +968,7 @@ float Temperature::analog2temp(const int raw, const uint8_t e) {
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET;
} }
#if HAS_TEMP_BED #if HAS_HEATED_BED
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement. // For bed temperature measurement.
float Temperature::analog2tempBed(const int raw) { float Temperature::analog2tempBed(const int raw) {
@ -1002,7 +1002,7 @@ float Temperature::analog2temp(const int raw, const uint8_t e) {
#endif #endif
} }
#endif // HAS_TEMP_BED #endif // HAS_HEATED_BED
#if HAS_TEMP_CHAMBER #if HAS_TEMP_CHAMBER
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
@ -1052,7 +1052,7 @@ void Temperature::updateTemperaturesFromRawValues() {
#endif #endif
HOTEND_LOOP() HOTEND_LOOP()
current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e); current_temperature[e] = Temperature::analog2temp(current_temperature_raw[e], e);
#if HAS_TEMP_BED #if HAS_HEATED_BED
current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw); current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw);
#endif #endif
#if HAS_TEMP_CHAMBER #if HAS_TEMP_CHAMBER
@ -1149,7 +1149,7 @@ void Temperature::init() {
#if HAS_HEATER_4 #if HAS_HEATER_4
OUT_WRITE(HEATER_3_PIN, HEATER_4_INVERTING); OUT_WRITE(HEATER_3_PIN, HEATER_4_INVERTING);
#endif #endif
#if HAS_HEATER_BED #if HAS_HEATED_BED
OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING); OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);
#endif #endif
@ -1204,7 +1204,7 @@ void Temperature::init() {
#if HAS_TEMP_4 #if HAS_TEMP_4
HAL_ANALOG_SELECT(TEMP_4_PIN); HAL_ANALOG_SELECT(TEMP_4_PIN);
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
HAL_ANALOG_SELECT(TEMP_BED_PIN); HAL_ANALOG_SELECT(TEMP_BED_PIN);
#endif #endif
#if HAS_TEMP_CHAMBER #if HAS_TEMP_CHAMBER
@ -1345,7 +1345,7 @@ void Temperature::init() {
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_TEMP_BED #if HAS_HEATED_BED
#ifdef BED_MINTEMP #ifdef BED_MINTEMP
while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) { while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
#if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
@ -1364,7 +1364,7 @@ void Temperature::init() {
#endif #endif
} }
#endif // BED_MAXTEMP #endif // BED_MAXTEMP
#endif // HAS_TEMP_BED #endif // HAS_HEATED_BED
#if ENABLED(PROBING_HEATERS_OFF) #if ENABLED(PROBING_HEATERS_OFF)
paused = false; paused = false;
@ -1483,7 +1483,7 @@ void Temperature::init() {
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
// If the heater idle timeout expires, restart // If the heater idle timeout expires, restart
if ((heater_id >= 0 && heater_idle_timeout_exceeded[heater_id]) if ((heater_id >= 0 && heater_idle_timeout_exceeded[heater_id])
#if HAS_TEMP_BED #if HAS_HEATED_BED
|| (heater_id < 0 && bed_idle_timeout_exceeded) || (heater_id < 0 && bed_idle_timeout_exceeded)
#endif #endif
) { ) {
@ -1529,7 +1529,10 @@ void Temperature::disable_all_heaters() {
#endif #endif
HOTEND_LOOP() setTargetHotend(0, e); HOTEND_LOOP() setTargetHotend(0, e);
setTargetBed(0);
#if HAS_HEATED_BED
setTargetBed(0);
#endif
// Unpause and reset everything // Unpause and reset everything
#if ENABLED(PROBING_HEATERS_OFF) #if ENABLED(PROBING_HEATERS_OFF)
@ -1561,10 +1564,10 @@ void Temperature::disable_all_heaters() {
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
target_temperature_bed = 0; target_temperature_bed = 0;
soft_pwm_amount_bed = 0; soft_pwm_amount_bed = 0;
#if HAS_HEATER_BED #if HAS_HEATED_BED
WRITE_HEATER_BED(LOW); WRITE_HEATER_BED(LOW);
#endif #endif
#endif #endif
@ -1577,13 +1580,13 @@ void Temperature::disable_all_heaters() {
paused = p; paused = p;
if (p) { if (p) {
HOTEND_LOOP() start_heater_idle_timer(e, 0); // timeout immediately HOTEND_LOOP() start_heater_idle_timer(e, 0); // timeout immediately
#if HAS_TEMP_BED #if HAS_HEATED_BED
start_bed_idle_timer(0); // timeout immediately start_bed_idle_timer(0); // timeout immediately
#endif #endif
} }
else { else {
HOTEND_LOOP() reset_heater_idle_timer(e); HOTEND_LOOP() reset_heater_idle_timer(e);
#if HAS_TEMP_BED #if HAS_HEATED_BED
reset_bed_idle_timer(); reset_bed_idle_timer();
#endif #endif
} }
@ -1687,8 +1690,13 @@ void Temperature::set_current_temp_raw() {
#endif #endif
#endif #endif
#endif #endif
current_temperature_bed_raw = raw_temp_bed_value;
current_temperature_chamber_raw = raw_temp_chamber_value; #if HAS_HEATED_BED
current_temperature_bed_raw = raw_temp_bed_value;
#endif
#if HAS_TEMP_CHAMBER
current_temperature_chamber_raw = raw_temp_chamber_value;
#endif
temp_meas_ready = true; temp_meas_ready = true;
} }
@ -1759,7 +1767,7 @@ void Temperature::isr() {
#endif // HOTENDS > 3 #endif // HOTENDS > 3
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATER_BED #if HAS_HEATED_BED
ISR_STATICS(BED); ISR_STATICS(BED);
#endif #endif
@ -1800,7 +1808,7 @@ void Temperature::isr() {
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATER_BED #if HAS_HEATED_BED
soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed; soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed;
WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW); WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW);
#endif #endif
@ -1835,7 +1843,7 @@ void Temperature::isr() {
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATER_BED #if HAS_HEATED_BED
if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(LOW); if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(LOW);
#endif #endif
@ -1916,7 +1924,7 @@ void Temperature::isr() {
#endif // HOTENDS > 3 #endif // HOTENDS > 3
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATER_BED #if HAS_HEATED_BED
_SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED _SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED
#endif #endif
@ -1935,7 +1943,7 @@ void Temperature::isr() {
#endif // HOTENDS > 3 #endif // HOTENDS > 3
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATER_BED #if HAS_HEATED_BED
PWM_OFF_ROUTINE(BED); // BED PWM_OFF_ROUTINE(BED); // BED
#endif #endif
@ -1995,7 +2003,7 @@ void Temperature::isr() {
#endif // HOTENDS > 3 #endif // HOTENDS > 3
#endif // HOTENDS > 2 #endif // HOTENDS > 2
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#if HAS_HEATER_BED #if HAS_HEATED_BED
if (state_timer_heater_BED > 0) state_timer_heater_BED--; if (state_timer_heater_BED > 0) state_timer_heater_BED--;
#endif #endif
} // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0 } // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0
@ -2044,7 +2052,7 @@ void Temperature::isr() {
break; break;
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
case PrepareTemp_BED: case PrepareTemp_BED:
HAL_START_ADC(TEMP_BED_PIN); HAL_START_ADC(TEMP_BED_PIN);
break; break;
@ -2147,8 +2155,14 @@ void Temperature::isr() {
#endif #endif
ZERO(raw_temp_value); ZERO(raw_temp_value);
raw_temp_bed_value = 0;
raw_temp_chamber_value = 0; #if HAS_HEATED_BED
raw_temp_bed_value = 0;
#endif
#if HAS_TEMP_CHAMBER
raw_temp_chamber_value = 0;
#endif
#define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1) #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1)
@ -2194,7 +2208,7 @@ void Temperature::isr() {
#endif #endif
} }
#if HAS_TEMP_BED #if HAS_HEATED_BED
#if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
#define GEBED <= #define GEBED <=
#else #else
@ -2262,15 +2276,15 @@ void Temperature::isr() {
#endif #endif
, const int8_t e=-3 , const int8_t e=-3
) { ) {
#if !(HAS_TEMP_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1 #if !(HAS_HEATED_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1
UNUSED(e); UNUSED(e);
#endif #endif
SERIAL_PROTOCOLCHAR_P(port, ' '); SERIAL_PROTOCOLCHAR_P(port, ' ');
SERIAL_PROTOCOLCHAR_P(port, SERIAL_PROTOCOLCHAR_P(port,
#if HAS_TEMP_CHAMBER && HAS_TEMP_BED && HAS_TEMP_HOTEND #if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
e == -2 ? 'C' : e == -1 ? 'B' : 'T' e == -2 ? 'C' : e == -1 ? 'B' : 'T'
#elif HAS_TEMP_BED && HAS_TEMP_HOTEND #elif HAS_HEATED_BED && HAS_TEMP_HOTEND
e == -1 ? 'B' : 'T' e == -1 ? 'B' : 'T'
#elif HAS_TEMP_HOTEND #elif HAS_TEMP_HOTEND
'T' 'T'
@ -2306,7 +2320,7 @@ void Temperature::isr() {
#endif #endif
); );
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
print_heater_state(degBed(), degTargetBed() print_heater_state(degBed(), degTargetBed()
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
, rawBedTemp() , rawBedTemp()
@ -2338,7 +2352,7 @@ void Temperature::isr() {
#endif #endif
SERIAL_PROTOCOLPGM_P(port, " @:"); SERIAL_PROTOCOLPGM_P(port, " @:");
SERIAL_PROTOCOL_P(port, getHeaterPower(gcode.target_extruder)); SERIAL_PROTOCOL_P(port, getHeaterPower(gcode.target_extruder));
#if HAS_TEMP_BED #if HAS_HEATED_BED
SERIAL_PROTOCOLPGM_P(port, " B@:"); SERIAL_PROTOCOLPGM_P(port, " B@:");
SERIAL_PROTOCOL_P(port, getHeaterPower(-1)); SERIAL_PROTOCOL_P(port, getHeaterPower(-1));
#endif #endif

View file

@ -70,7 +70,7 @@ enum ADCSensorState : char {
PrepareTemp_4, PrepareTemp_4,
MeasureTemp_4, MeasureTemp_4,
#endif #endif
#if HAS_TEMP_BED #if HAS_HEATED_BED
PrepareTemp_BED, PrepareTemp_BED,
MeasureTemp_BED, MeasureTemp_BED,
#endif #endif
@ -108,35 +108,21 @@ enum ADCSensorState : char {
#define unscalePID_d(d) ( (d) * PID_dT ) #define unscalePID_d(d) ( (d) * PID_dT )
#endif #endif
#if !HAS_HEATER_BED
constexpr int16_t target_temperature_bed = 0;
#endif
class Temperature { class Temperature {
public: public:
static float current_temperature[HOTENDS], static volatile bool in_temp_isr;
current_temperature_chamber,
current_temperature_bed; static float current_temperature[HOTENDS];
static int16_t current_temperature_raw[HOTENDS], static int16_t current_temperature_raw[HOTENDS],
target_temperature[HOTENDS], target_temperature[HOTENDS];
current_temperature_chamber_raw, static uint8_t soft_pwm_amount[HOTENDS];
current_temperature_bed_raw;
#if ENABLED(AUTO_POWER_E_FANS) #if ENABLED(AUTO_POWER_E_FANS)
static int16_t autofan_speed[HOTENDS]; static int16_t autofan_speed[HOTENDS];
#endif #endif
#if HAS_HEATER_BED
static int16_t target_temperature_bed;
#endif
static volatile bool in_temp_isr;
static uint8_t soft_pwm_amount[HOTENDS],
soft_pwm_amount_bed;
#if ENABLED(FAN_SOFT_PWM) #if ENABLED(FAN_SOFT_PWM)
static uint8_t soft_pwm_amount_fan[FAN_COUNT], static uint8_t soft_pwm_amount_fan[FAN_COUNT],
soft_pwm_count_fan[FAN_COUNT]; soft_pwm_count_fan[FAN_COUNT];
@ -164,24 +150,24 @@ class Temperature {
#endif #endif
#if ENABLED(PIDTEMPBED) #if HAS_HEATED_BED
static float bedKp, bedKi, bedKd; static float current_temperature_bed;
static int16_t current_temperature_bed_raw, target_temperature_bed;
static uint8_t soft_pwm_amount_bed;
#if ENABLED(PIDTEMPBED)
static float bedKp, bedKi, bedKd;
#endif
#endif
#if HAS_TEMP_CHAMBER
static float current_temperature_chamber;
static int16_t current_temperature_chamber_raw;
#endif #endif
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
static volatile int babystepsTodo[3]; static volatile int babystepsTodo[3];
#endif #endif
#if WATCH_HOTENDS
static uint16_t watch_target_temp[HOTENDS];
static millis_t watch_heater_next_ms[HOTENDS];
#endif
#if WATCH_THE_BED
static uint16_t watch_target_bed_temp;
static millis_t watch_bed_next_ms;
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION) #if ENABLED(PREVENT_COLD_EXTRUSION)
static bool allow_cold_extrude; static bool allow_cold_extrude;
static int16_t extrude_min_temp; static int16_t extrude_min_temp;
@ -209,8 +195,15 @@ class Temperature {
private: private:
#if EARLY_WATCHDOG #if EARLY_WATCHDOG
// If temperature controller is running static bool inited; // If temperature controller is running
static bool inited; #endif
static volatile bool temp_meas_ready;
static uint16_t raw_temp_value[MAX_EXTRUDERS];
#if WATCH_HOTENDS
static uint16_t watch_target_temp[HOTENDS];
static millis_t watch_heater_next_ms[HOTENDS];
#endif #endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
@ -218,8 +211,6 @@ class Temperature {
static float redundant_temperature; static float redundant_temperature;
#endif #endif
static volatile bool temp_meas_ready;
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
static float temp_iState[HOTENDS], static float temp_iState[HOTENDS],
temp_dState[HOTENDS], temp_dState[HOTENDS],
@ -238,27 +229,45 @@ class Temperature {
static bool pid_reset[HOTENDS]; static bool pid_reset[HOTENDS];
#endif #endif
#if ENABLED(PIDTEMPBED)
static float temp_iState_bed,
temp_dState_bed,
pTerm_bed,
iTerm_bed,
dTerm_bed,
pid_error_bed;
#else
static millis_t next_bed_check_ms;
#endif
static uint16_t raw_temp_value[MAX_EXTRUDERS],
raw_temp_chamber_value,
raw_temp_bed_value;
// Init min and max temp with extreme values to prevent false errors during startup // Init min and max temp with extreme values to prevent false errors during startup
static int16_t minttemp_raw[HOTENDS], static int16_t minttemp_raw[HOTENDS],
maxttemp_raw[HOTENDS], maxttemp_raw[HOTENDS],
minttemp[HOTENDS], minttemp[HOTENDS],
maxttemp[HOTENDS]; maxttemp[HOTENDS];
#if HAS_HEATED_BED
static uint16_t raw_temp_bed_value;
#if WATCH_THE_BED
static uint16_t watch_target_bed_temp;
static millis_t watch_bed_next_ms;
#endif
#if ENABLED(PIDTEMPBED)
static float temp_iState_bed,
temp_dState_bed,
pTerm_bed,
iTerm_bed,
dTerm_bed,
pid_error_bed;
#else
static millis_t next_bed_check_ms;
#endif
#if HEATER_IDLE_HANDLER
static millis_t bed_idle_timeout_ms;
static bool bed_idle_timeout_exceeded;
#endif
#ifdef BED_MINTEMP
static int16_t bed_minttemp_raw;
#endif
#ifdef BED_MAXTEMP
static int16_t bed_maxttemp_raw;
#endif
#endif
#if HAS_TEMP_CHAMBER
static uint16_t raw_temp_chamber_value;
#endif
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
static uint8_t consecutive_low_temperature_error[HOTENDS]; static uint8_t consecutive_low_temperature_error[HOTENDS];
#endif #endif
@ -267,14 +276,6 @@ class Temperature {
static millis_t preheat_end_time[HOTENDS]; static millis_t preheat_end_time[HOTENDS];
#endif #endif
#ifdef BED_MINTEMP
static int16_t bed_minttemp_raw;
#endif
#ifdef BED_MAXTEMP
static int16_t bed_maxttemp_raw;
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
static int8_t meas_shift_index; // Index of a delayed sample in buffer static int8_t meas_shift_index; // Index of a delayed sample in buffer
#endif #endif
@ -294,10 +295,6 @@ class Temperature {
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
static millis_t heater_idle_timeout_ms[HOTENDS]; static millis_t heater_idle_timeout_ms[HOTENDS];
static bool heater_idle_timeout_exceeded[HOTENDS]; static bool heater_idle_timeout_exceeded[HOTENDS];
#if HAS_TEMP_BED
static millis_t bed_idle_timeout_ms;
static bool bed_idle_timeout_exceeded;
#endif
#endif #endif
public: public:
@ -319,7 +316,7 @@ class Temperature {
*/ */
static float analog2temp(const int raw, const uint8_t e); static float analog2temp(const int raw, const uint8_t e);
#if HAS_TEMP_BED #if HAS_HEATED_BED
static float analog2tempBed(const int raw); static float analog2tempBed(const int raw);
#endif #endif
#if HAS_TEMP_CHAMBER #if HAS_TEMP_CHAMBER
@ -378,8 +375,6 @@ class Temperature {
#endif #endif
return current_temperature[HOTEND_INDEX]; return current_temperature[HOTEND_INDEX];
} }
FORCE_INLINE static float degBed() { return current_temperature_bed; }
FORCE_INLINE static float degChamber() { return current_temperature_chamber; }
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) { FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) {
@ -388,8 +383,6 @@ class Temperature {
#endif #endif
return current_temperature_raw[HOTEND_INDEX]; return current_temperature_raw[HOTEND_INDEX];
} }
FORCE_INLINE static int16_t rawBedTemp() { return current_temperature_bed_raw; }
FORCE_INLINE static int16_t rawChamberTemp() { return current_temperature_chamber_raw; }
#endif #endif
FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) { FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) {
@ -399,16 +392,10 @@ class Temperature {
return target_temperature[HOTEND_INDEX]; return target_temperature[HOTEND_INDEX];
} }
FORCE_INLINE static int16_t degTargetBed() { return target_temperature_bed; }
#if WATCH_HOTENDS #if WATCH_HOTENDS
static void start_watching_heater(const uint8_t e = 0); static void start_watching_heater(const uint8_t e = 0);
#endif #endif
#if WATCH_THE_BED
static void start_watching_bed();
#endif
static void setTargetHotend(const int16_t celsius, const uint8_t e) { static void setTargetHotend(const int16_t celsius, const uint8_t e) {
#if HOTENDS == 1 #if HOTENDS == 1
UNUSED(e); UNUSED(e);
@ -428,8 +415,30 @@ class Temperature {
#endif #endif
} }
static void setTargetBed(const int16_t celsius) { FORCE_INLINE static bool isHeatingHotend(const uint8_t e) {
#if HAS_HEATER_BED #if HOTENDS == 1
UNUSED(e);
#endif
return target_temperature[HOTEND_INDEX] > current_temperature[HOTEND_INDEX];
}
FORCE_INLINE static bool isCoolingHotend(const uint8_t e) {
#if HOTENDS == 1
UNUSED(e);
#endif
return target_temperature[HOTEND_INDEX] < current_temperature[HOTEND_INDEX];
}
#if HAS_HEATED_BED
#if ENABLED(SHOW_TEMP_ADC_VALUES)
FORCE_INLINE static int16_t rawBedTemp() { return current_temperature_bed_raw; }
#endif
FORCE_INLINE static float degBed() { return current_temperature_bed; }
FORCE_INLINE static int16_t degTargetBed() { return target_temperature_bed; }
FORCE_INLINE static bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
FORCE_INLINE static bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
static void setTargetBed(const int16_t celsius) {
#if ENABLED(AUTO_POWER_CONTROL) #if ENABLED(AUTO_POWER_CONTROL)
powerManager.power_on(); powerManager.power_on();
#endif #endif
@ -443,24 +452,19 @@ class Temperature {
#if WATCH_THE_BED #if WATCH_THE_BED
start_watching_bed(); start_watching_bed();
#endif #endif
#endif }
}
FORCE_INLINE static bool isHeatingHotend(const uint8_t e) { #if WATCH_THE_BED
#if HOTENDS == 1 static void start_watching_bed();
UNUSED(e);
#endif #endif
return target_temperature[HOTEND_INDEX] > current_temperature[HOTEND_INDEX]; #endif
}
FORCE_INLINE static bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
FORCE_INLINE static bool isCoolingHotend(const uint8_t e) { #if HAS_TEMP_CHAMBER
#if HOTENDS == 1 #if ENABLED(SHOW_TEMP_ADC_VALUES)
UNUSED(e); FORCE_INLINE static int16_t rawChamberTemp() { return current_temperature_chamber_raw; }
#endif #endif
return target_temperature[HOTEND_INDEX] < current_temperature[HOTEND_INDEX]; FORCE_INLINE static float degChamber() { return current_temperature_chamber; }
} #endif
FORCE_INLINE static bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; }
FORCE_INLINE static bool wait_for_heating(const uint8_t e) { FORCE_INLINE static bool wait_for_heating(const uint8_t e) {
return degTargetHotend(e) > TEMP_HYSTERESIS && abs(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS; return degTargetHotend(e) > TEMP_HYSTERESIS && abs(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
@ -469,7 +473,7 @@ class Temperature {
/** /**
* The software PWM power for a heater * The software PWM power for a heater
*/ */
static int getHeaterPower(int heater); static int getHeaterPower(const int heater);
/** /**
* Switch off all heaters, set all target temperatures to 0 * Switch off all heaters, set all target temperatures to 0
@ -562,7 +566,7 @@ class Temperature {
return heater_idle_timeout_exceeded[HOTEND_INDEX]; return heater_idle_timeout_exceeded[HOTEND_INDEX];
} }
#if HAS_TEMP_BED #if HAS_HEATED_BED
static void start_bed_idle_timer(const millis_t timeout_ms) { static void start_bed_idle_timer(const millis_t timeout_ms) {
bed_idle_timeout_ms = millis() + timeout_ms; bed_idle_timeout_ms = millis() + timeout_ms;
bed_idle_timeout_exceeded = false; bed_idle_timeout_exceeded = false;
@ -627,7 +631,7 @@ class Temperature {
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED
typedef enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway } TRstate; enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway };
static void thermal_runaway_protection(TRState * const state, millis_t * const timer, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc); static void thermal_runaway_protection(TRState * const state, millis_t * const timer, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);