Menu items for Separate NeoPixel (#19280)

This commit is contained in:
Zachary Annand
2020-09-06 20:00:24 -05:00
committed by GitHub
parent f29baed540
commit 5ea7a8373a
5 changed files with 67 additions and 11 deletions

View File

@ -183,7 +183,17 @@ void LEDLights::set_color(const LEDColor &incol
: neo2.Color(incol.r, incol.g, incol.b, incol.w);
neo2.set_brightness(incol.i);
neo2.set_color(neocolor);
#if ENABLED(LED_CONTROL_MENU)
// Don't update the color when OFF
lights_on = !incol.is_off();
if (lights_on) color = incol;
#endif
}
#if ENABLED(LED_CONTROL_MENU)
void LEDLights2::toggle() { if (lights_on) set_off(); else update(); }
#endif
#endif // NEOPIXEL2_SEPARATE

View File

@ -240,7 +240,7 @@ extern LEDLights leds;
static inline void set_violet() { set_color(LEDColorViolet()); }
#endif
#if ENABLED(LED_CONTROL_MENU)
#if ENABLED(NEOPIXEL2_SEPARATE)
static LEDColor color; // last non-off color
static bool lights_on; // the last set color was "on"
static void toggle(); // swap "off" with color