Merge pull request #3257 from gudnimg/lcd-optimisation-gudni

Remove redundant operations on LCD CGRAM
This commit is contained in:
Alex Voinea 2022-02-09 08:09:48 +01:00 committed by GitHub
commit 1342db3532
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 98 deletions

View file

@ -644,8 +644,6 @@ uint8_t lcd_status_update_delay = 0;
lcd_longpress_func_t lcd_longpress_func = 0;
lcd_charsetup_func_t lcd_charsetup_func = 0;
lcd_lcdupdate_func_t lcd_lcdupdate_func = 0;
static ShortTimer buttonBlanking;
@ -718,8 +716,6 @@ void lcd_update_enable(uint8_t enabled)
lcd_next_update_millis = _millis() - 1;
// Full update.
lcd_clear();
if (lcd_charsetup_func)
lcd_charsetup_func();
lcd_update(2);
} else
{
@ -923,28 +919,6 @@ const uint8_t lcd_chardata_clock[8] PROGMEM = {
B00000,
B00000}; //thanks Sonny Mounicou
const uint8_t lcd_chardata_arrup[8] PROGMEM = {
B00100,
B01110,
B11111,
B00000,
B00000,
B00000,
B00000,
B00000};
const uint8_t lcd_chardata_arrdown[8] PROGMEM = {
B00000,
B00000,
B00000,
B00000,
B00000,
B10001,
B01010,
B00100};
void lcd_set_custom_characters(void)
{
lcd_createChar_P(LCD_STR_BEDTEMP[0], lcd_chardata_bedTemp);
@ -955,13 +929,6 @@ void lcd_set_custom_characters(void)
lcd_createChar_P(LCD_STR_FOLDER[0], lcd_chardata_folder);
lcd_createChar_P(LCD_STR_FEEDRATE[0], lcd_chardata_feedrate);
lcd_createChar_P(LCD_STR_CLOCK[0], lcd_chardata_clock);
//lcd_createChar_P(LCD_STR_ARROW_UP[0], lcd_chardata_arrup);
//lcd_createChar_P(LCD_STR_ARROW_DOWN[0], lcd_chardata_arrdown);
}
void lcd_set_custom_characters_arrows(void)
{
lcd_createChar_P(1, lcd_chardata_arrdown);
}
const uint8_t lcd_chardata_arr2down[8] PROGMEM = {
@ -985,12 +952,7 @@ const uint8_t lcd_chardata_confirm[8] PROGMEM = {
void lcd_set_custom_characters_nextpage(void)
{
lcd_createChar_P(1, lcd_chardata_arr2down);
lcd_createChar_P(2, lcd_chardata_confirm);
}
void lcd_set_custom_characters_degree(void)
{
lcd_createChar_P(1, lcd_chardata_degree);
lcd_createChar_P(LCD_STR_ARROW_2_DOWN[0], lcd_chardata_arr2down);
lcd_createChar_P(LCD_STR_CONFIRM[0], lcd_chardata_confirm);
}

View file

@ -112,8 +112,6 @@ extern uint8_t lcd_status_update_delay;
extern lcd_longpress_func_t lcd_longpress_func;
extern bool lcd_longpress_trigger;
extern lcd_charsetup_func_t lcd_charsetup_func;
extern lcd_lcdupdate_func_t lcd_lcdupdate_func;
@ -191,22 +189,21 @@ private:
//Custom characters defined in the first 8 characters of the LCD
#define LCD_STR_BEDTEMP "\x00"
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_UP "\x0B"
#define LCD_STR_ARROW_DOWN "\x01"
#define LCD_STR_ARROW_RIGHT "\x7E" //from the default character set
#define LCD_STR_BEDTEMP "\x00"
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_ARROW_2_DOWN "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_CONFIRM "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_RIGHT "\x7E" //from the default character set
#define LCD_STR_SOLID_BLOCK "\xFF" //from the default character set
extern void lcd_set_custom_characters(void);
extern void lcd_set_custom_characters_arrows(void);
extern void lcd_set_custom_characters_nextpage(void);
extern void lcd_set_custom_characters_degree(void);
//! @brief Consume click event
inline void lcd_consume_click()

View file

@ -570,7 +570,7 @@ void menu_progressbar_update(uint16_t newVal)
newCnt = LCD_WIDTH;
while (newCnt > progressbar_block_count)
{
lcd_print('\xFF');
lcd_print(LCD_STR_SOLID_BLOCK[0]);
progressbar_block_count++;
}
}

View file

@ -1,10 +1,8 @@
//messages.c
#include "language.h"
#include "lcd.h" // Needed for LCD_STR_REFRESH
//this is because we need include Configuration_prusa.h (CUSTOM_MENDEL_NAME)
#define bool char
#define true 1
#define false 0
#include "Configuration_prusa.h"
//internationalized messages
@ -80,7 +78,7 @@ const char MSG_PRESS_TO_UNLOAD[] PROGMEM_I1 = ISTR("Please press the knob to unl
const char MSG_PRINT_ABORTED[] PROGMEM_I1 = ISTR("Print aborted"); ////c=20
const char MSG_PULL_OUT_FILAMENT[] PROGMEM_I1 = ISTR("Please pull out filament immediately"); ////c=20 r=4
const char MSG_RECOVER_PRINT[] PROGMEM_I1 = ISTR("Blackout occurred. Recover print?"); ////c=20 r=2
const char MSG_REFRESH[] PROGMEM_I1 = ISTR("\x04Refresh"); ////c=18
const char MSG_REFRESH[] PROGMEM_I1 = ISTR(LCD_STR_REFRESH "Refresh"); ////c=18
const char MSG_REMOVE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please remove steel sheet from heatbed."); ////c=20 r=4
const char MSG_RESET[] PROGMEM_I1 = ISTR("Reset"); ////c=14
const char MSG_RESUME_PRINT[] PROGMEM_I1 = ISTR("Resume print"); ////c=18

View file

@ -728,9 +728,6 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move)
screen=0;
}
lcd_set_degree();
//5 seconds delay
for (uint8_t i = 0; i < 5; i++) {
if (lcd_clicked()) {

View file

@ -3231,7 +3231,6 @@ void lcd_adjust_z() {
#ifdef PINDA_THERMISTOR
bool lcd_wait_for_pinda(float temp) {
lcd_set_custom_characters_degree();
setAllTargetHotends(0);
setTargetBed(0);
LongTimer pinda_timeout;
@ -3246,7 +3245,7 @@ bool lcd_wait_for_pinda(float temp) {
lcd_print(ftostr3(current_temperature_pinda));
lcd_print('/');
lcd_print(ftostr3(temp));
lcd_print(LCD_STR_DEGREE);
lcd_print(LCD_STR_DEGREE[0]);
delay_keep_alive(1000);
serialecho_temperatures();
if (pinda_timeout.expired(8 * 60 * 1000ul)) { //PINDA cooling from 60 C to 35 C takes about 7 minutes
@ -3254,7 +3253,6 @@ bool lcd_wait_for_pinda(float temp) {
break;
}
}
lcd_set_custom_characters_arrows();
lcd_update_enable(true);
return target_temp_reached;
}
@ -3262,17 +3260,15 @@ bool lcd_wait_for_pinda(float temp) {
void lcd_wait_for_heater() {
lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
lcd_set_degree();
lcd_set_cursor(0, 4);
lcd_print(LCD_STR_THERMOMETER[0]);
lcd_print(ftostr3(degHotend(active_extruder)));
lcd_print('/');
lcd_print(ftostr3(degTargetHotend(active_extruder)));
lcd_print(LCD_STR_DEGREE);
lcd_print(LCD_STR_DEGREE[0]);
}
void lcd_wait_for_cool_down() {
lcd_set_custom_characters_degree();
setAllTargetHotends(0);
setTargetBed(0);
int fanSpeedBckp = fanSpeed;
@ -3284,19 +3280,17 @@ void lcd_wait_for_cool_down() {
lcd_print(LCD_STR_THERMOMETER[0]);
lcd_print(ftostr3(degHotend(0)));
lcd_print("/0");
lcd_print(LCD_STR_DEGREE);
lcd_print(LCD_STR_DEGREE[0]);
lcd_set_cursor(9, 4);
lcd_print(LCD_STR_BEDTEMP[0]);
lcd_print(ftostr3(degBed()));
lcd_print("/0");
lcd_print(LCD_STR_DEGREE);
lcd_set_custom_characters();
lcd_print(LCD_STR_DEGREE[0]);
delay_keep_alive(1000);
serialecho_temperatures();
}
fanSpeed = fanSpeedBckp;
lcd_set_custom_characters_arrows();
lcd_update_enable(true);
}
@ -3439,11 +3433,10 @@ static const char* lcd_display_message_fullscreen_nonBlocking_P(const char *msg,
if (multi_screen) {
// Display the "next screen" indicator character.
// lcd_set_custom_characters_arrows();
lcd_set_custom_characters_nextpage();
lcd_set_cursor(19, 3);
// Display the down arrow.
lcd_print(char(1));
// Display the double down arrow.
lcd_print(LCD_STR_ARROW_2_DOWN[0]);
}
nlines = row;
@ -3484,7 +3477,7 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg)
if (!multi_screen) {
lcd_set_cursor(19, 3);
// Display the confirm char.
lcd_print(char(2));
lcd_print(LCD_STR_CONFIRM[0]);
}
// Wait for 5 seconds before displaying the next text.
for (uint8_t i = 0; i < 100; ++ i) {
@ -3510,7 +3503,7 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg)
lcd_set_cursor(19, 3);
// Display the confirm char.
lcd_print(char(2));
lcd_print(LCD_STR_CONFIRM[0]);
}
}
}
@ -4420,10 +4413,6 @@ static void lcd_fsensor_state_set()
}
#endif //FILAMENT_SENSOR
void lcd_set_degree() {
lcd_set_custom_characters_degree();
}
#if (LANG_MODE != 0)
void menu_setlang(unsigned char lang)
@ -4792,7 +4781,6 @@ static void wait_preheat()
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS] / 60);
delay_keep_alive(2000);
lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
lcd_set_custom_characters();
while (fabs(degHotend(0) - degTargetHotend(0)) > 3) {
lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
@ -7267,7 +7255,7 @@ void lcd_belttest()
Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
lcd_set_cursor(10,3),lcd_printf_P(PSTR("%u"),Y);
lcd_set_cursor(19, 3);
lcd_print(LCD_STR_UPLEVEL);
lcd_print(LCD_STR_UPLEVEL[0]);
lcd_wait_for_click_delay(10);
}
}
@ -8582,10 +8570,8 @@ void ultralcd_init()
lcd_init();
lcd_refresh();
lcd_longpress_func = menu_lcd_longpress_func;
lcd_charsetup_func = menu_lcd_charsetup_func;
lcd_lcdupdate_func = menu_lcd_lcdupdate_func;
menu_menu = lcd_status_screen;
menu_lcd_charsetup_func();
SET_INPUT(BTN_EN1);
SET_INPUT(BTN_EN2);
@ -8646,7 +8632,7 @@ static void lcd_connect_printer() {
i = 0;
lcd_puts_at_P(0, 3, PSTR(" "));
}
if (i!=0) lcd_puts_at_P((i * 20) / (NC_BUTTON_LONG_PRESS * 10), 3, "\xFF");
if (i!=0) lcd_puts_at_P((i * 20) / (NC_BUTTON_LONG_PRESS * 10), 3, LCD_STR_SOLID_BLOCK[0]);
if (i == NC_BUTTON_LONG_PRESS * 10) {
no_response = false;
}
@ -8802,14 +8788,6 @@ void menu_lcd_longpress_func(void)
}
}
void menu_lcd_charsetup_func(void)
{
if (menu_menu == lcd_status_screen)
lcd_set_custom_characters_degree();
else
lcd_set_custom_characters_arrows();
}
static inline bool z_menu_expired()
{
return (menu_menu == lcd_babystep_z

View file

@ -5,7 +5,6 @@
#include "config.h"
extern void menu_lcd_longpress_func(void);
extern void menu_lcd_charsetup_func(void);
extern void menu_lcd_lcdupdate_func(void);
// Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
@ -215,8 +214,6 @@ void lcd_pinda_calibration_menu();
void lcd_calibrate_pinda();
void lcd_temp_calibration_set();
void lcd_set_degree();
#if (LANG_MODE != 0)
void lcd_language();
#endif