From c03aa9d5a44679bfb0533a9cc6637abec2526e83 Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Wed, 21 Dec 2022 08:58:53 +0100 Subject: [PATCH 1/3] Fix Z home position not touching the buildplate (see #396) by removing the 2mm HOMING_BACKOFF_POST_MM on z. --- Marlin/Configuration_adv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ccf0aacd..90194179 100755 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -916,7 +916,7 @@ #define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) #if DISABLED(KNUTWURST_CHIRON) - #define HOMING_BACKOFF_POST_MM { 2, 2, 2 } // (linear=mm, rotational=°) Backoff from endstops after homing + #define HOMING_BACKOFF_POST_MM { 2, 2, 0 } // (linear=mm, rotational=°) Backoff from endstops after homing #endif // #define XY_COUNTERPART_BACKOFF_MM 0 // (mm) Backoff X after homing Y, and vice-versa -- 2.25.1 From c2c950bbcaa2a9bcff533a7c042cb6f8db79d93b Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Tue, 20 Dec 2022 16:54:07 +0100 Subject: [PATCH 2/3] simplify file name sanitization The routine copies "fileNameLen" characters from the original filename plus one additional character or a trailing blank. This additional char is overwritten by a terminating null-byte afterwards anyway. Remove the redundant check and simplify the loop. --- Marlin/src/lcd/anycubic_touchscreen.cpp | 33 +++++++++++-------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/Marlin/src/lcd/anycubic_touchscreen.cpp b/Marlin/src/lcd/anycubic_touchscreen.cpp index cb2f6e10..db431353 100755 --- a/Marlin/src/lcd/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/anycubic_touchscreen.cpp @@ -1190,15 +1190,14 @@ else { card.selectFileByIndex(count - 1); - // THe longname may not be filed, so we use the built-in fallback here. - char* fileName = card.longest_filename(); - int fileNameLen = strlen(fileName); + // The longname may not be filed, so we use the built-in fallback here. + char* fileName = card.longest_filename(); + int fileNameLen = strlen(fileName); bool fileNameWasCut = false; - // Cut off too long filenames. - // They don't fit on the screen anyway. + // Cut off too long filenames. They don't fit on the screen anyway. #if ENABLED(KNUTWURST_DGUS2_TFT) - if (fileNameLen >= MAX_PRINTABLE_FILENAME_LEN) { + if (fileNameLen > MAX_PRINTABLE_FILENAME_LEN) { fileNameWasCut = true; fileNameLen = MAX_PRINTABLE_FILENAME_LEN; } @@ -1206,20 +1205,18 @@ char outputString[fileNameLen]; - // Bugfix for non-printable special characters - // which are now replaced by underscores. - for (unsigned char i = 0; i <= fileNameLen; i++) { - if (i >= fileNameLen) { - outputString[i] = ' '; - } - else { + // Bugfix for non-printable special characters which are now replaced by underscores. + for (unsigned char i = 0; i < fileNameLen; i++) { + if (isPrintable(fileName[i])) outputString[i] = fileName[i]; - if (!isPrintable(outputString[i])) - outputString[i] = '_'; - } + else + outputString[i] = '_'; } - // I know, it's ugly, but it's faster than a string lib + // Terminate the string. + outputString[fileNameLen] = '\0'; + + // Append extension, if filename was truncated. I know, it's ugly, but it's faster than a string lib. if (fileNameWasCut) { outputString[fileNameLen - 7] = '~'; outputString[fileNameLen - 6] = '.'; @@ -1230,8 +1227,6 @@ outputString[fileNameLen - 1] = 'e'; } - outputString[fileNameLen] = '\0'; - if (card.flag.filenameIsDir) { #if ENABLED(KNUTWURST_DGUS2_TFT) HARDWARE_SERIAL_PROTOCOLPGM("/"); -- 2.25.1 From 55170f9fc806fb37a77397bdf294922e4c8f84a0 Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Wed, 21 Dec 2022 09:09:55 +0100 Subject: [PATCH 3/3] Update build version --- Marlin/src/inc/Version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 15f91767..dd4b513d 100755 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -41,10 +41,10 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define CUSTOM_BUILD_VERSION "1.5.0-b1" + #define CUSTOM_BUILD_VERSION "1.5.0-b2" #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2022-09-13" + #define STRING_DISTRIBUTION_DATE "2022-12-21" #endif /** -- 2.25.1