Merge pull request #3486 from gudnimg/gudni-optimisation

Flash optimizations in loop() and status screen menu
This commit is contained in:
DRracer 2022-08-19 17:21:17 +02:00 committed by GitHub
commit 3ebd8b88a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View file

@ -1940,7 +1940,7 @@ void loop()
} }
//check heater every n milliseconds //check heater every n milliseconds
manage_heater(); manage_heater();
isPrintPaused ? manage_inactivity(true) : manage_inactivity(false); manage_inactivity(isPrintPaused);
checkHitEndstops(); checkHitEndstops();
lcd_update(0); lcd_update(0);
#ifdef TMC2130 #ifdef TMC2130

View file

@ -638,7 +638,6 @@ uint8_t lcd_button_pressed = 0;
uint8_t lcd_update_enabled = 1; uint8_t lcd_update_enabled = 1;
uint32_t lcd_next_update_millis = 0; uint32_t lcd_next_update_millis = 0;
uint8_t lcd_status_update_delay = 0;

View file

@ -107,8 +107,6 @@ extern LongTimer lcd_timeoutToStatus;
extern uint32_t lcd_next_update_millis; extern uint32_t lcd_next_update_millis;
extern uint8_t lcd_status_update_delay;
extern lcd_longpress_func_t lcd_longpress_func; extern lcd_longpress_func_t lcd_longpress_func;
extern bool lcd_longpress_trigger; extern bool lcd_longpress_trigger;

View file

@ -758,6 +758,7 @@ void lcdui_print_status_screen(void)
// Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent // Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent
void lcd_status_screen() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") void lcd_status_screen() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
{ {
static uint8_t lcd_status_update_delay = 0;
#ifdef ULTIPANEL_FEEDMULTIPLY #ifdef ULTIPANEL_FEEDMULTIPLY
// Dead zone at 100% feedrate // Dead zone at 100% feedrate
if ((feedmultiply < 100 && (feedmultiply + int(lcd_encoder)) > 100) || if ((feedmultiply < 100 && (feedmultiply + int(lcd_encoder)) > 100) ||
@ -788,14 +789,17 @@ void lcd_status_screen() // NOT static due to using ins
else if (feedmultiply > 999) else if (feedmultiply > 999)
feedmultiply = 999; feedmultiply = 999;
if (lcd_draw_update) {
// Update the status screen immediately
lcd_status_update_delay = 0;
}
if (lcd_status_update_delay) if (lcd_status_update_delay)
lcd_status_update_delay--; lcd_status_update_delay--;
else else
lcd_draw_update = 1; { // Redraw the main screen every second (see LCD_UPDATE_INTERVAL).
// This is easier then trying keep track of all things that change on the screen
lcd_status_update_delay = 10;
if (lcd_draw_update)
{
ReInitLCD++; ReInitLCD++;
if (ReInitLCD == 30) if (ReInitLCD == 30)
{ {
@ -832,10 +836,9 @@ void lcd_status_screen() // NOT static due to using ins
} }
} // end of farm_mode } // end of farm_mode
lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
if (lcd_commands_type != LcdCommands::Idle) if (lcd_commands_type != LcdCommands::Idle)
lcd_commands(); lcd_commands();
} // end of lcd_draw_update }
bool current_click = LCD_CLICKED; bool current_click = LCD_CLICKED;