From c86f20010d916ba5a09f7c4320a37f5cdfc75f48 Mon Sep 17 00:00:00 2001 From: Sebastien BLAISOT Date: Wed, 7 Dec 2022 22:49:38 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20M150=20S=20default=20index=20(#2306?= =?UTF-8?q?6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 1 + Marlin/src/gcode/feature/leds/M150.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 462bfff65b..37df8c0c57 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3305,6 +3305,7 @@ #define NEOPIXEL2_PIXELS 15 // Number of LEDs in the second strip #define NEOPIXEL2_BRIGHTNESS 127 // Initial brightness (0-255) #define NEOPIXEL2_STARTUP_TEST // Cycle through colors at startup + #define NEOPIXEL_M150_DEFAULT -1 // Default strip for M150 without 'S'. Use -1 to set all by default. #else //#define NEOPIXEL2_INSERIES // Default behavior is NeoPixel 2 in parallel #endif diff --git a/Marlin/src/gcode/feature/leds/M150.cpp b/Marlin/src/gcode/feature/leds/M150.cpp index 77c58411a3..43062c3f75 100644 --- a/Marlin/src/gcode/feature/leds/M150.cpp +++ b/Marlin/src/gcode/feature/leds/M150.cpp @@ -61,7 +61,12 @@ void GcodeSuite::M150() { #if ENABLED(NEOPIXEL_LED) const pixel_index_t index = parser.intval('I', -1); #if ENABLED(NEOPIXEL2_SEPARATE) - int8_t brightness = neo.brightness(), unit = parser.intval('S', -1); + #ifndef NEOPIXEL_M150_DEFAULT + #define NEOPIXEL_M150_DEFAULT -1 + #elif NEOPIXEL_M150_DEFAULT > 1 + #error "NEOPIXEL_M150_DEFAULT must be -1, 0, or 1." + #endif + int8_t brightness = neo.brightness(), unit = parser.intval('S', NEOPIXEL_M150_DEFAULT); switch (unit) { case -1: neo2.neoindex = index; // fall-thru case 0: neo.neoindex = index; old_color = parser.seen('K') ? neo.pixel_color(index >= 0 ? index : 0) : 0; break;