From 77f77a58e80bb081ec4d30dfdd13d6f199ea824f Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Fri, 24 Jul 2020 09:12:21 +0200 Subject: [PATCH] Remove code duplication --- Marlin/src/lcd/anycubic_touchscreen.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Marlin/src/lcd/anycubic_touchscreen.cpp b/Marlin/src/lcd/anycubic_touchscreen.cpp index ea9e302e..87b2bb79 100755 --- a/Marlin/src/lcd/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/anycubic_touchscreen.cpp @@ -59,7 +59,7 @@ unsigned char ResumingFlag = 0; void setup_OutageTestPin() { -#if defined(POWER_OUTAGE_TEST) +#ifdef POWER_OUTAGE_TEST pinMode(OUTAGETEST_PIN, INPUT); pinMode(OUTAGECON_PIN, OUTPUT); WRITE(OUTAGECON_PIN, LOW); @@ -474,7 +474,8 @@ void AnycubicTouchscreenClass::HandleSpecialMenu() SERIAL_ECHOLNPGM("Special Menu: Preheat Ultrabase"); queue.inject_P(PSTR("M140 S60")); } - #if DISABLED(KNUTWURST_BLTOUCH) + +#if DISABLED(KNUTWURST_BLTOUCH) else if (strcasestr(currentTouchscreenSelection, "") != NULL) { SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling"); @@ -517,21 +518,16 @@ void AnycubicTouchscreenClass::HandleSpecialMenu() queue.enqueue_now_P(PSTR("G91\nG1 Z+0.02\nG90")); queue.enqueue_now_P(PSTR("G91\nG1 Z-0.03\nG90")); } - #endif - #if ENABLED(KNUTWURST_BLTOUCH) +#endif + +#if ENABLED(KNUTWURST_BLTOUCH) else if (strcasestr(currentTouchscreenSelection, "") != NULL) { SERIAL_ECHOLNPGM("Special Menu: BLTouch Leveling"); queue.inject_P(PSTR("G28\nG29")); } - #endif - #if ENABLED(KNUTWURST_BLTOUCH) - else if (strcasestr(currentTouchscreenSelection, "") != NULL) - { - SERIAL_ECHOLNPGM("Special Menu: BLTouch Leveling"); - queue.inject_P(PSTR("G28\nG29")); - } - #endif +#endif + else if (strcasestr(currentTouchscreenSelection, "") != NULL) { SERIAL_ECHOLNPGM("Special Menu: Fil. Change Pause"); @@ -747,7 +743,7 @@ void AnycubicTouchscreenClass::PrintList() HARDWARE_SERIAL_PROTOCOL("/"); HARDWARE_SERIAL_PROTOCOLLN(card.filename); HARDWARE_SERIAL_PROTOCOL("/"); - HARDWARE_SERIAL_PROTOCOLLN(buffer); + HARDWARE_SERIAL_PROTOCOLLN(outputString); SERIAL_ECHO(count); SERIAL_ECHOPGM(": /"); SERIAL_ECHOLN(outputString);