From 1556ee228042f3b515f2a320a4d07a101656a919 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Tue, 21 Nov 2017 12:27:58 -0700 Subject: [PATCH] Fix for garbled LCD status error and Mini 2 homing. - Modified calls to lcd status to use strings in PROGMEM to prevent garbled text from showing up. - Disabled COOLSTEP during homing on Mini 2 to allow stallguard to function. --- Marlin/Conditionals_LulzBot.h | 26 +++++++++----------------- Marlin/temperature.cpp | 14 +++++--------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/Marlin/Conditionals_LulzBot.h b/Marlin/Conditionals_LulzBot.h index 23770bc2c..d98466f0a 100644 --- a/Marlin/Conditionals_LulzBot.h +++ b/Marlin/Conditionals_LulzBot.h @@ -13,7 +13,7 @@ * got disabled. */ -#define LULZBOT_FW_VERSION ".42" // Change this with each update +#define LULZBOT_FW_VERSION ".43" // Change this with each update #if ( \ !defined(LULZBOT_Gladiola_Mini) && \ @@ -152,7 +152,7 @@ #define LULZBOT_USE_SERIES_Z_MOTORS #define LULZBOT_USE_32_MICROSTEPS_ON_Z #define LULZBOT_USE_TMC_COOLSTEP - #define LULZBOT_USE_TMC_STEALTHCHOP + //#define LULZBOT_USE_TMC_STEALTHCHOP #define LULZBOT_BAUDRATE 250000 #define LULZBOT_PRINTCOUNTER #define LULZBOT_UUID "1b8d32d3-0596-4335-8cd4-f3741a095087" @@ -173,7 +173,7 @@ #define LULZBOT_USE_SERIES_Z_MOTORS #define LULZBOT_USE_32_MICROSTEPS_ON_Z #define LULZBOT_USE_TMC_COOLSTEP - #define LULZBOT_USE_TMC_STEALTHCHOP + //#define LULZBOT_USE_TMC_STEALTHCHOP #define LULZBOT_BAUDRATE 250000 #define LULZBOT_PRINTCOUNTER #define LULZBOT_UUID "1b8d32d3-0596-4335-8cd4-f3741a095087" @@ -1395,7 +1395,7 @@ #define LULZBOT_ENABLE_STALLGUARD(st) \ /* Enable stallguard by disabling steathchop */ \ - st.coolstep_min_speed(LULZBOT_COOLSTEP_MIN); \ + st.coolstep_min_speed(LULZBOT_COOLSTEP_DISABLED); \ st.stealthChop(0); #define LULZBOT_ENABLE_STEALTHCHOP(st) \ @@ -1566,7 +1566,7 @@ line_to_current_position(); \ sync_plan_position_e(); \ stepper.synchronize(); \ - kill(MSG_ERR_PROBING_FAILED); /* stop print job */ \ + kill(PSTR(MSG_ERR_PROBING_FAILED)); /* stop print job */ \ return NAN; /* abort the leveling in progress */ \ } \ SERIAL_ERRORLNPGM(MSG_REWIPE); \ @@ -1767,19 +1767,11 @@ #define LULZBOT_HIDE_EXTRA_FAN_CONFIG_IN_LCD #define LULZBOT_SCROLL_LONG_FILE_NAMES #define LULZBOT_REORDERED_MENUS + #define LULZBOT_STRINGIFY(msg) msg #define LULZBOT_ENHANCED_TEMP_ERROR_MSG(msg, e) \ - { \ - /* Must be static since the ultralcd code */ \ - /* will hold a pointer to this buffer */ \ - static char str[30] = {'\0'}; \ - strncpy(str, msg, 25); \ - switch(e) { \ - case -1: strcat(str, " BED"); break; \ - case 0: strcat(str, " E0"); break; \ - case 1: strcat(str, " E1"); break; \ - } \ - kill(str); \ - } + /* Marlin requires PSTR in order to display on the LCD display, this uses a */ \ + /* preprocessor trick to append the heater name depending on the value of e */ \ + ((e == -1) ? PSTR(LULZBOT_STRINGIFY(msg) " BED") : ((e == 0) ? PSTR(LULZBOT_STRINGIFY(msg) " E0") : PSTR(LULZBOT_STRINGIFY(msg) " E1")) ) #endif /***************************** CUSTOM SPLASH SCREEN *****************************/ diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 7c2a8e2ac..44009b7ed 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -518,11 +518,7 @@ void Temperature::_temp_error(const int8_t e, const char * const serial_msg, con if (!killed) { Running = false; killed = true; - #if defined(LULZBOT_ENHANCED_TEMP_ERROR_MSG) - LULZBOT_ENHANCED_TEMP_ERROR_MSG(lcd_msg, e) - #else kill(lcd_msg); - #endif } else disable_all_heaters(); // paranoia @@ -531,7 +527,7 @@ void Temperature::_temp_error(const int8_t e, const char * const serial_msg, con void Temperature::max_temp_error(const int8_t e) { #if HAS_TEMP_BED - _temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED)); + _temp_error(e, PSTR(MSG_T_MAXTEMP), LULZBOT_ENHANCED_TEMP_ERROR_MSG(MSG_ERR_MAXTEMP, e)); #else _temp_error(HOTEND_INDEX, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP)); #if HOTENDS == 1 @@ -541,7 +537,7 @@ void Temperature::max_temp_error(const int8_t e) { } void Temperature::min_temp_error(const int8_t e) { #if HAS_TEMP_BED - _temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED)); + _temp_error(e, PSTR(MSG_T_MINTEMP), LULZBOT_ENHANCED_TEMP_ERROR_MSG(MSG_ERR_MINTEMP, e)); #else _temp_error(HOTEND_INDEX, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP)); #if HOTENDS == 1 @@ -748,7 +744,7 @@ void Temperature::manage_heater() { // Make sure temperature is increasing if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder? if (degHotend(e) < watch_target_temp[e]) // Failed to increase enough? - _temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD)); + _temp_error(e, PSTR(MSG_T_HEATING_FAILED), LULZBOT_ENHANCED_TEMP_ERROR_MSG(MSG_HEATING_FAILED_LCD,e)); else // Start again if the target is still far off start_watching_heater(e); } @@ -787,7 +783,7 @@ void Temperature::manage_heater() { // Make sure temperature is increasing if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) { // Time to check the bed? if (degBed() < watch_target_bed_temp) // Failed to increase enough? - _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD)); + _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), LULZBOT_ENHANCED_TEMP_ERROR_MSG(MSG_HEATING_FAILED_LCD,-1)); else // Start again if the target is still far off start_watching_bed(); } @@ -1344,7 +1340,7 @@ void Temperature::init() { else if (PENDING(millis(), *timer)) break; *state = TRRunaway; case TRRunaway: - _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), PSTR(MSG_THERMAL_RUNAWAY)); + _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), LULZBOT_ENHANCED_TEMP_ERROR_MSG(MSG_THERMAL_RUNAWAY, heater_id)); } }