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
19 changed files with 303 additions and 260 deletions

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:
* http://marlinfw.org/tools/u8glib/converter.html
@ -136,7 +136,7 @@
// STATUS_SCREEN_HOTEND_TEXT_X(i) to modify draw locations.
#include "../../../_Statusscreen.h"
#elif HAS_TEMP_BED
#elif HAS_HEATED_BED
#define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 64))
#define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 64))
@ -321,7 +321,7 @@
};
#endif // HOTENDS
#else // !HAS_TEMP_BED
#else // !HAS_HEATED_BED
#define STATUS_SCREEN_X ( 8 + (HOTENDS ? 0 : 96))
#define STATUS_SCREENWIDTH (120 - (HOTENDS ? 0 : 96))
@ -507,7 +507,7 @@
#endif // HOTENDS
#endif // !HAS_TEMP_BED
#endif // !HAS_HEATED_BED
#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);
#endif
#if HAS_TEMP_BED
#if HAS_HEATED_BED
const bool isBed = heater < 0;
#else
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 HEATER_IDLE_HANDLER
const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
#if HAS_TEMP_BED
thermalManager.is_bed_idle()
#else
false
const bool is_idle = (
#if HAS_HEATED_BED
isBed ? thermalManager.is_bed_idle() :
#endif
thermalManager.is_heater_idle(heater)
);
if (blink || !is_idle)
#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))
_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)) {
const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X,
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.drawBox(x + h, y, 2, 2);
u8g.setColorIndex(1); // black on white
}
else {
else
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);
// Heated bed
#if HOTENDS < 4 && HAS_TEMP_BED
#if HOTENDS < 4 && HAS_HEATED_BED
_draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink);
#endif

View File

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

View File

@ -893,9 +893,11 @@ void kill_screen(const char* lcd_msg) {
#endif
));
// Restore the bed temperature
sprintf_P(cmd, PSTR("M190 S%i"), job_recovery_info.target_temperature_bed);
enqueue_and_echo_command(cmd);
#if HAS_HEATED_BED
// Restore the bed temperature
sprintf_P(cmd, PSTR("M190 S%i"), job_recovery_info.target_temperature_bed);
enqueue_and_echo_command(cmd);
#endif
// Restore all hotend temperatures
HOTEND_LOOP() {
@ -1431,7 +1433,7 @@ void kill_screen(const char* lcd_msg) {
//
// 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);
#endif
@ -2136,7 +2138,7 @@ void kill_screen(const char* lcd_msg) {
x_plot = 0,
y_plot = 0;
#if HAS_TEMP_BED
#if HAS_HEATED_BED
static int16_t custom_bed_temp = 50;
#endif
@ -2146,7 +2148,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_custom_mesh() {
char UBL_LCD_GCODE[20];
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);
lcd_enqueue_command(UBL_LCD_GCODE);
#endif
@ -2167,7 +2169,7 @@ void kill_screen(const char* lcd_msg) {
START_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));
#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));
#endif
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() {
char UBL_LCD_GCODE[24];
const int temp =
#if HAS_TEMP_BED
#if HAS_HEATED_BED
custom_bed_temp
#else
0
@ -2249,7 +2251,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_validate_mesh() {
START_MENU();
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_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#else
@ -2353,7 +2355,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_mesh() {
START_MENU();
MENU_BACK(MSG_UBL_TOOLS);
#if HAS_TEMP_BED
#if HAS_HEATED_BED
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\n"
"M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
@ -2746,7 +2748,7 @@ void kill_screen(const char* lcd_msg) {
//
bool has_heat = false;
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;
#endif
if (has_heat) MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
@ -3466,7 +3468,7 @@ void kill_screen(const char* lcd_msg) {
//
// 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);
#endif
@ -5117,7 +5119,7 @@ void lcd_update() {
}
#endif
#endif
#endif // ULTIPANEL
#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) {
#if TEMP_SENSOR_BED
#if HAS_HEATED_BED
const bool isBed = heater < 0;
const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)),
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
#else
constexpr bool isBed = false;
const float t1 = thermalManager.degHotend(heater), t2 = thermalManager.degTargetHotend(heater);
#endif
const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)),
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
if (prefix >= 0) lcd_put_wchar(prefix);
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
UNUSED(blink);
#else
const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
#if HAS_TEMP_BED
thermalManager.is_bed_idle()
#else
false
const bool is_idle = (
#if HAS_HEATED_BED
isBed ? thermalManager.is_bed_idle() :
#endif
thermalManager.is_heater_idle(heater)
);
if (!blink && is_idle) {