From 6499c6b7c3961749d38be3fe02131cc67e120277 Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Thu, 1 Jun 2023 18:42:30 +0200 Subject: [PATCH] Simplify non-printable char filter loop. --- Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp index df8fef65..13dbec7f 100755 --- a/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/extui/knutwurst/anycubic_touchscreen.cpp @@ -990,10 +990,11 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) { // 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