Use heater index defines

This commit is contained in:
Scott Lahteine 2019-07-02 23:29:43 -05:00
parent f7eeae8424
commit ae9232962e
2 changed files with 15 additions and 17 deletions

View file

@ -526,7 +526,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
} }
} }
FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, const bool blink) { FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const char prefix, const bool blink) {
#if HAS_HEATED_BED #if HAS_HEATED_BED
const bool isBed = heater < 0; const bool isBed = heater < 0;
const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)), const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)),
@ -567,7 +567,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
} }
FORCE_INLINE void _draw_bed_status(const bool blink) { FORCE_INLINE void _draw_bed_status(const bool blink) {
_draw_heater_status(-1, ( _draw_heater_status(H_BED, (
#if HAS_LEVELING #if HAS_LEVELING
planner.leveling_active && blink ? '_' : planner.leveling_active && blink ? '_' :
#endif #endif
@ -750,19 +750,17 @@ void MarlinUI::draw_status_screen() {
// //
// Hotend 0 Temperature // Hotend 0 Temperature
// //
_draw_heater_status(0, -1, blink); _draw_heater_status(H_E0, -1, blink);
// //
// Hotend 1 or Bed Temperature // Hotend 1 or Bed Temperature
// //
#if HOTENDS > 1 #if HOTENDS > 1
lcd_moveto(8, 0); lcd_moveto(8, 0);
lcd_put_wchar(LCD_STR_THERMOMETER[0]); _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
_draw_heater_status(1, -1, blink);
#elif HAS_HEATED_BED #elif HAS_HEATED_BED
lcd_moveto(8, 0); lcd_moveto(8, 0);
lcd_put_wchar(LCD_STR_BEDTEMP[0]); _draw_bed_status(blink);
_draw_heater_status(-1, -1, blink);
#endif #endif
#else // LCD_WIDTH >= 20 #else // LCD_WIDTH >= 20
@ -770,14 +768,14 @@ void MarlinUI::draw_status_screen() {
// //
// Hotend 0 Temperature // Hotend 0 Temperature
// //
_draw_heater_status(0, LCD_STR_THERMOMETER[0], blink); _draw_heater_status(H_E0, LCD_STR_THERMOMETER[0], blink);
// //
// Hotend 1 or Bed Temperature // Hotend 1 or Bed Temperature
// //
#if HOTENDS > 1 #if HOTENDS > 1
lcd_moveto(10, 0); lcd_moveto(10, 0);
_draw_heater_status(1, LCD_STR_THERMOMETER[0], blink); _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
#elif HAS_HEATED_BED #elif HAS_HEATED_BED
lcd_moveto(10, 0); lcd_moveto(10, 0);
_draw_bed_status(blink); _draw_bed_status(blink);
@ -806,7 +804,7 @@ void MarlinUI::draw_status_screen() {
#if HOTENDS > 2 || (HOTENDS > 1 && HAS_HEATED_BED) #if HOTENDS > 2 || (HOTENDS > 1 && HAS_HEATED_BED)
#if HOTENDS > 2 #if HOTENDS > 2
_draw_heater_status(2, LCD_STR_THERMOMETER[0], blink); _draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink);
lcd_moveto(10, 1); lcd_moveto(10, 1);
#endif #endif
@ -911,7 +909,7 @@ void MarlinUI::draw_status_screen() {
// //
// Hotend 0 Temperature // Hotend 0 Temperature
// //
_draw_heater_status(0, LCD_STR_THERMOMETER[0], blink); _draw_heater_status(H_E0, LCD_STR_THERMOMETER[0], blink);
// //
// Z Coordinate // Z Coordinate
@ -931,7 +929,7 @@ void MarlinUI::draw_status_screen() {
// //
lcd_moveto(0, 1); lcd_moveto(0, 1);
#if HOTENDS > 1 #if HOTENDS > 1
_draw_heater_status(1, LCD_STR_THERMOMETER[0], blink); _draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
#elif HAS_HEATED_BED #elif HAS_HEATED_BED
_draw_bed_status(blink); _draw_bed_status(blink);
#endif #endif
@ -948,7 +946,7 @@ void MarlinUI::draw_status_screen() {
// //
lcd_moveto(0, 2); lcd_moveto(0, 2);
#if HOTENDS > 2 #if HOTENDS > 2
_draw_heater_status(2, LCD_STR_THERMOMETER[0], blink); _draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink);
#elif HOTENDS > 1 && HAS_HEATED_BED #elif HOTENDS > 1 && HAS_HEATED_BED
_draw_bed_status(blink); _draw_bed_status(blink);
#elif HAS_PRINT_PROGRESS #elif HAS_PRINT_PROGRESS
@ -987,7 +985,7 @@ void MarlinUI::draw_status_screen() {
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
if (row < LCD_HEIGHT) { if (row < LCD_HEIGHT) {
lcd_moveto(LCD_WIDTH - 9, row); lcd_moveto(LCD_WIDTH - 9, row);
_draw_heater_status(extruder, LCD_STR_THERMOMETER[0], get_blink()); _draw_heater_status((heater_ind_t)extruder, LCD_STR_THERMOMETER[0], get_blink());
} }
} }

View file

@ -105,7 +105,7 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
#define SHOW_ON_STATE false #define SHOW_ON_STATE false
#endif #endif
FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) { FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blink) {
#if !HEATER_IDLE_HANDLER #if !HEATER_IDLE_HANDLER
UNUSED(blink); UNUSED(blink);
#endif #endif
@ -404,11 +404,11 @@ void MarlinUI::draw_status_screen() {
if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) { if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) {
// Extruders // Extruders
for (uint8_t e = 0; e < MAX_HOTEND_DRAW; ++e) for (uint8_t e = 0; e < MAX_HOTEND_DRAW; ++e)
_draw_heater_status(e, blink); _draw_heater_status((heater_ind_t)e, blink);
// Heated bed // Heated bed
#if HAS_HEATED_BED && HOTENDS < 4 #if HAS_HEATED_BED && HOTENDS < 4
_draw_heater_status(-1, blink); _draw_heater_status(H_BED, blink);
#endif #endif
#if HAS_HEATED_CHAMBER #if HAS_HEATED_CHAMBER