From 7bb5d4bfe85ce05563d6620714949fe6821e0b76 Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Thu, 17 Jan 2019 20:20:26 +0100 Subject: [PATCH] Small LED code reorganization (#12929) --- Marlin/src/Marlin.cpp | 12 +++--------- Marlin/src/feature/caselight.cpp | 1 - Marlin/src/feature/leds/leds.cpp | 8 ++++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index bf98f8527..8a5ac05e8 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -860,16 +860,10 @@ void setup() { leds.setup(); #endif - #if ENABLED(RGB_LED) || ENABLED(RGBW_LED) - SET_OUTPUT(RGB_LED_R_PIN); - SET_OUTPUT(RGB_LED_G_PIN); - SET_OUTPUT(RGB_LED_B_PIN); - #if ENABLED(RGBW_LED) - SET_OUTPUT(RGB_LED_W_PIN); - #endif - #endif - #if HAS_CASE_LIGHT + #if DISABLED(CASE_LIGHT_USE_NEOPIXEL) + SET_OUTPUT(CASE_LIGHT_PIN); + #endif update_case_light(); #endif diff --git a/Marlin/src/feature/caselight.cpp b/Marlin/src/feature/caselight.cpp index e2cc23368..ad06688d1 100644 --- a/Marlin/src/feature/caselight.cpp +++ b/Marlin/src/feature/caselight.cpp @@ -69,7 +69,6 @@ void update_case_light() { #else // !CASE_LIGHT_USE_NEOPIXEL - SET_OUTPUT(CASE_LIGHT_PIN); if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) analogWrite(CASE_LIGHT_PIN, n10ct); else { diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index ae377ecbe..e700de364 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -60,6 +60,14 @@ LEDLights leds; void LEDLights::setup() { + #if ENABLED(RGB_LED) || ENABLED(RGBW_LED) + SET_OUTPUT(RGB_LED_R_PIN); + SET_OUTPUT(RGB_LED_G_PIN); + SET_OUTPUT(RGB_LED_B_PIN); + #if ENABLED(RGBW_LED) + SET_OUTPUT(RGB_LED_W_PIN); + #endif + #endif #if ENABLED(NEOPIXEL_LED) setup_neopixel(); #endif