From 305d9d8dadf8d5d261c4af034ab22c86d1e30066 Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Wed, 31 Jan 2018 16:51:16 -0500 Subject: [PATCH] Try to minimize auto screen clear/redraws Re-enable M851 to use for adjusting Live-Z offset --- Firmware/Configuration.h | 2 +- Firmware/ultralcd.cpp | 65 ++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index c99cc0324..b1b29b58e 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -467,7 +467,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //=========================================================================== // Custom M code points -//#define CUSTOM_M_CODES +#define CUSTOM_M_CODES #ifdef CUSTOM_M_CODES #define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851 #define Z_PROBE_OFFSET_RANGE_MIN -15 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d65e5f4fc..ec802b913 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -116,8 +116,6 @@ union Data int value; }; -int8_t ReInitLCD = 0; - int8_t SDscrool = 0; int8_t SilentModeMenu = 0; @@ -450,19 +448,9 @@ static void lcd_status_screen() lcdDrawUpdate = 1; if (lcdDrawUpdate) { - ReInitLCD++; + // ***Note: Removed lcd reinit from here - // Re-init lcd every 30 re-draw updates (Why? Are things this un-reliable?) - if (ReInitLCD == 30) { - lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. -#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) - currentMenu == lcd_status_screen -#endif - ); - ReInitLCD = 0 ; - } - - lcd_implementation_status_screen(); + lcd_implementation_status_screen(); if (farm_mode) { @@ -6146,29 +6134,34 @@ void lcd_update(uint8_t lcdDrawUpdateOverride) #endif #ifdef ULTIPANEL - if (lcd_timeoutToStatus < millis() && currentMenu != lcd_status_screen) - { - // Exiting a menu. Let's call the menu function the last time with menuExiting flag set to true - // to give it a chance to save its state. - // This is useful for example, when the babystep value has to be written into EEPROM. - if (currentMenu != NULL) { - menuExiting = true; - (*currentMenu)(); - menuExiting = false; - } - lcd_implementation_clear(); - lcd_return_to_status(); - lcdDrawUpdate = 2; - } + if (lcd_timeoutToStatus < millis() && currentMenu != lcd_status_screen) + { + // Exiting a menu. Let's call the menu function the last time with menuExiting flag set to true + // to give it a chance to save its state. + // This is useful for example, when the babystep value has to be written into EEPROM. + if (currentMenu != NULL) { + menuExiting = true; + (*currentMenu)(); + menuExiting = false; + } + + lcd_return_to_status(); + lcdDrawUpdate = 2; + } #endif//ULTIPANEL - if (lcdDrawUpdate == 2) lcd_implementation_clear(); - if (lcdDrawUpdate) lcdDrawUpdate--; - lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL; - } - if (!SdFatUtil::test_stack_integrity()) stack_error(); - lcd_ping(); //check that we have received ping command if we are in farm mode - lcd_send_status(); - if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands(); + if (lcdDrawUpdate == 2) lcd_implementation_clear(); + if (lcdDrawUpdate) lcdDrawUpdate--; + lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL; + } + + if (!SdFatUtil::test_stack_integrity()) + stack_error(); + + lcd_ping(); //check that we have received ping command if we are in farm mode + lcd_send_status(); + + if (lcd_commands_type == LCD_COMMAND_V2_CAL) + lcd_commands(); } void lcd_printer_connected() {