From 981a681e52a0d85cda3ca8808a026527b5e9558e Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Mon, 15 Jan 2018 17:29:07 +0100 Subject: [PATCH] Temperature ISR synchronization, M600 - faster unload --- Firmware/Configuration.h | 2 +- Firmware/Marlin_main.cpp | 4 ++-- Firmware/ultralcd.cpp | 42 ++++++++++++++++++++++++++-------------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 56ad4018..7e951119 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -11,7 +11,7 @@ #define FW_VERSION "3.1.1-RC4" #define FW_COMMIT_NR 146 #define FW_DEV_VERSION FW_VERSION_RC -#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) +#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR)"c" #define FW_VERSION_UNKNOWN 4 #define FW_VERSION_ALPHA 3 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7b0ffa62..eec43324 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5667,10 +5667,10 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 5200 / 60, active_extruder); st_synchronize(); target[E_AXIS] -= 15; - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 160 / 60, active_extruder); + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1000 / 60, active_extruder); st_synchronize(); target[E_AXIS] -= 20; - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 5000 / 60, active_extruder); + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1000 / 60, active_extruder); st_synchronize(); #endif // SNMM diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 30062405..5f5091b0 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -335,22 +335,28 @@ uint8_t lcdDrawUpdate = 2; /* Set to none-zero when the LCD nee // float raw_Ki, raw_Kd; #endif -static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder = 0, const bool feedback = true, bool reset_menu_state = true) { - if (currentMenu != menu) { - currentMenu = menu; - encoderPosition = encoder; - if (reset_menu_state) { - // Resets the global shared C union. - // This ensures, that the menu entered will find out, that it shall initialize itself. - memset(&menuData, 0, sizeof(menuData)); - } - if (feedback) lcd_quick_feedback(); - - // For LCD_PROGRESS_BAR re-initialize the custom characters +static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder = 0, const bool feedback = true, bool reset_menu_state = true) +{ + asm("cli"); + if (currentMenu != menu) + { + currentMenu = menu; + encoderPosition = encoder; + asm("sei"); + if (reset_menu_state) + { + // Resets the global shared C union. + // This ensures, that the menu entered will find out, that it shall initialize itself. + memset(&menuData, 0, sizeof(menuData)); + } + if (feedback) lcd_quick_feedback(); + // For LCD_PROGRESS_BAR re-initialize the custom characters #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) - lcd_set_custom_characters(menu == lcd_status_screen); + lcd_set_custom_characters(menu == lcd_status_screen); #endif - } + } + else + asm("sei"); } /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */ @@ -5506,8 +5512,10 @@ void lcd_sdcard_menu() } \ static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) \ { \ - menuData.editMenuParentState.prevMenu = currentMenu; \ + asm("cli"); \ + menuData.editMenuParentState.prevMenu = currentMenu; \ menuData.editMenuParentState.prevEncoderPosition = encoderPosition; \ + asm("sei"); \ \ lcdDrawUpdate = 2; \ menuData.editMenuParentState.editLabel = pstr; \ @@ -6921,6 +6929,9 @@ void lcd_setcontrast(uint8_t value) /* Warning: This function is called from interrupt context */ void lcd_buttons_update() { + static bool _lock = false; + if (_lock) return; + _lock = true; #ifdef NEWPANEL uint8_t newbutton = 0; if (READ(BTN_EN1) == 0) newbutton |= EN_A; @@ -7045,6 +7056,7 @@ void lcd_buttons_update() } } lastEncoderBits = enc; + _lock = false; } bool lcd_detected(void)