Fix lightweight UI hotends display

This commit is contained in:
Scott Lahteine 2018-10-04 14:37:24 -05:00
parent 72a750e0eb
commit 517b4f4cd4

View file

@ -419,7 +419,7 @@ void ST7920_Lite_Status_Screen::draw_static_elements() {
// Draw the static icons in GDRAM // Draw the static icons in GDRAM
draw_gdram_icon(1, 1, nozzle_icon); draw_gdram_icon(1, 1, nozzle_icon);
#if EXTRUDERS == 2 #if HOTENDS > 1
draw_gdram_icon(1,2,nozzle_icon); draw_gdram_icon(1,2,nozzle_icon);
draw_gdram_icon(1,3,bed_icon); draw_gdram_icon(1,3,bed_icon);
#else #else
@ -440,7 +440,7 @@ void ST7920_Lite_Status_Screen::draw_static_elements() {
* text data (the percentage). * text data (the percentage).
*/ */
void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) { void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) {
#if EXTRUDERS == 1 #if HOTENDS == 1
// If we have only one extruder, draw a long progress bar on the third line // If we have only one extruder, draw a long progress bar on the third line
const uint8_t top = 1, // Top in pixels const uint8_t top = 1, // Top in pixels
bottom = 13, // Bottom in pixels bottom = 13, // Bottom in pixels
@ -477,7 +477,7 @@ void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) {
} }
// Draw the percentage as text in DDRAM // Draw the percentage as text in DDRAM
#if EXTRUDERS == 1 #if HOTENDS == 1
set_ddram_address(DDRAM_LINE_3 + 4); set_ddram_address(DDRAM_LINE_3 + 4);
begin_data(); begin_data();
write_byte(' '); write_byte(' ');
@ -505,7 +505,7 @@ void ST7920_Lite_Status_Screen::draw_fan_icon(const bool whichIcon) {
void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool heating) { void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool heating) {
set_ddram_address( set_ddram_address(
#if EXTRUDERS == 1 #if HOTENDS == 1
DDRAM_LINE_2 DDRAM_LINE_2
#else #else
DDRAM_LINE_3 DDRAM_LINE_3
@ -573,7 +573,7 @@ void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const i
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
#if EXTRUDERS > 1 #if HOTENDS > 1
+ 1 + 1
#endif #endif
, temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate , temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate
@ -590,7 +590,7 @@ void ST7920_Lite_Status_Screen::draw_fan_speed(const uint8_t value) {
} }
void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed) { void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed) {
#if EXTRUDERS == 1 #if HOTENDS == 1
set_ddram_address(DDRAM_LINE_3); set_ddram_address(DDRAM_LINE_3);
#else #else
set_ddram_address(DDRAM_LINE_3 + 5); set_ddram_address(DDRAM_LINE_3 + 5);
@ -604,7 +604,7 @@ void ST7920_Lite_Status_Screen::draw_print_time(const duration_t &elapsed) {
void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint16_t percentage) { void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint16_t percentage) {
// We only have enough room for the feedrate when // We only have enough room for the feedrate when
// we have one extruder // we have one extruder
#if EXTRUDERS == 1 #if HOTENDS == 1
set_ddram_address(DDRAM_LINE_2 + 6); set_ddram_address(DDRAM_LINE_2 + 6);
begin_data(); begin_data();
write_number(percentage, 3); write_number(percentage, 3);
@ -712,7 +712,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
const uint16_t feedrate_perc = feedrate_percentage; const uint16_t feedrate_perc = feedrate_percentage;
const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256;
const int16_t extruder_1_target = thermalManager.degTargetHotend(0); const int16_t extruder_1_target = thermalManager.degTargetHotend(0);
#if EXTRUDERS == 2 #if HOTENDS > 1
const int16_t extruder_2_target = thermalManager.degTargetHotend(1); const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -720,7 +720,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
#endif #endif
static uint16_t last_checksum = 0; static uint16_t last_checksum = 0;
const uint16_t checksum = blink ^ feedrate_perc ^ fan_speed ^ extruder_1_target const uint16_t checksum = blink ^ feedrate_perc ^ fan_speed ^ extruder_1_target
#if EXTRUDERS == 2 #if HOTENDS > 1
^ extruder_2_target ^ extruder_2_target
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -740,7 +740,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256;
const int16_t extruder_1_temp = thermalManager.degHotend(0), const int16_t extruder_1_temp = thermalManager.degHotend(0),
extruder_1_target = thermalManager.degTargetHotend(0); extruder_1_target = thermalManager.degTargetHotend(0);
#if EXTRUDERS == 2 #if HOTENDS > 1
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
@ -750,7 +750,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
#endif #endif
draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate); draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate);
#if EXTRUDERS == 2 #if HOTENDS > 1
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_HEATED_BED #if HAS_HEATED_BED