diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f84d78a50..39dc19523 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2363,7 +2363,7 @@ //#define NEOPIXEL2_TYPE NEOPIXEL_TYPE //#define NEOPIXEL2_PIN 5 //#define NEOPIXEL2_INSERIES // Default behavior is NeoPixel 2 in parallel - #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip, larger of 2 strips if 2 neopixel strips are used + #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip, larger of 2 strips if 2 NeoPixel strips are used #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) //#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index eec0cde63..d1c0bfd5e 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -129,12 +129,9 @@ void LEDLights::set_color(const LEDColor &incol #endif - #if ENABLED(PCA9632) - // Update I2C LED driver - pca9632_set_led_color(incol); - #endif - - TERN_(PCA9533, PCA9533_setColor(incol.r, incol.g, incol.b)); + // Update I2C LED driver + TERN_(PCA9632, PCA9632_set_led_color(incol)); + TERN_(PCA9533, PCA9533_set_rgb(incol.r, incol.g, incol.b)); #if EITHER(LED_CONTROL_MENU, PRINTER_EVENT_LEDS) // Don't update the color when OFF diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index 577c94752..1302f63c1 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -104,11 +104,7 @@ typedef struct LEDColor { bool operator!=(const LEDColor &right) { return !operator==(right); } bool is_off() const { - return 3 > r + g + b - #if HAS_WHITE_LED - + w - #endif - ; + return 3 > r + g + b + TERN0(HAS_WHITE_LED, w); } } LEDColor; @@ -156,7 +152,7 @@ public: #endif ); - inline void set_color(uint8_t r, uint8_t g, uint8_t b + static inline void set_color(uint8_t r, uint8_t g, uint8_t b #if HAS_WHITE_LED , uint8_t w=0 #if ENABLED(NEOPIXEL_LED) diff --git a/Marlin/src/feature/leds/neopixel.cpp b/Marlin/src/feature/leds/neopixel.cpp index 520d4d63b..ce2e4ee77 100644 --- a/Marlin/src/feature/leds/neopixel.cpp +++ b/Marlin/src/feature/leds/neopixel.cpp @@ -53,9 +53,9 @@ Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIX #endif void Marlin_NeoPixel::set_color(const uint32_t color) { - if (get_neo_index() >= 0) { - set_pixel_color(get_neo_index(), color); - set_neo_index(-1); + if (neoindex >= 0) { + set_pixel_color(neoindex, color); + neoindex = -1; } else { for (uint16_t i = 0; i < pixels(); ++i) { @@ -78,18 +78,17 @@ void Marlin_NeoPixel::set_color_startup(const uint32_t color) { } void Marlin_NeoPixel::init() { - set_neo_index(-1); // -1 .. NEOPIXEL_PIXELS-1 range + neoindex = -1; // -1 .. NEOPIXEL_PIXELS-1 range set_brightness(NEOPIXEL_BRIGHTNESS); // 0 .. 255 range begin(); show(); // initialize to all off #if ENABLED(NEOPIXEL_STARTUP_TEST) set_color_startup(adaneo1.Color(255, 0, 0, 0)); // red - safe_delay(1000); + safe_delay(500); set_color_startup(adaneo1.Color(0, 255, 0, 0)); // green - safe_delay(1000); + safe_delay(500); set_color_startup(adaneo1.Color(0, 0, 255, 0)); // blue - safe_delay(1000); #endif #ifdef NEOPIXEL_BKGD_LED_INDEX diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index c3c8e2fbd..0d9fdefc0 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -65,17 +65,15 @@ private: , adaneo2 #endif ; - static int8_t neoindex; public: + static int8_t neoindex; + static void init(); static void set_color_startup(const uint32_t c); static void set_color(const uint32_t c); - FORCE_INLINE static void set_neo_index(const int8_t neoIndex) { neoindex = neoIndex; } - FORCE_INLINE static int8_t get_neo_index() { return neoindex; } - #ifdef NEOPIXEL_BKGD_LED_INDEX static void set_color_background(); #endif diff --git a/Marlin/src/feature/leds/pca9533.cpp b/Marlin/src/feature/leds/pca9533.cpp index bcc4bc50a..0fd4d6675 100644 --- a/Marlin/src/feature/leds/pca9533.cpp +++ b/Marlin/src/feature/leds/pca9533.cpp @@ -62,7 +62,7 @@ void PCA9533_setOff() { PCA9533_writeRegister(PCA9533_REG_SEL, 0); } -void PCA9533_setColor(uint8_t red, uint8_t green, uint8_t blue) { +void PCA9533_set_rgb(uint8_t red, uint8_t green, uint8_t blue) { uint8_t r_pwm0 = 0; // Register data - PWM value uint8_t r_pwm1 = 0; // Register data - PWM value diff --git a/Marlin/src/feature/leds/pca9533.h b/Marlin/src/feature/leds/pca9533.h index 899418ff2..431058c49 100644 --- a/Marlin/src/feature/leds/pca9533.h +++ b/Marlin/src/feature/leds/pca9533.h @@ -55,5 +55,5 @@ void PCA9533_init(); void PCA9533_reset(); -void PCA9533_setColor(uint8_t red, uint8_t green, uint8_t blue); +void PCA9533_set_rgb(uint8_t red, uint8_t green, uint8_t blue); void PCA9533_setOff(); diff --git a/Marlin/src/feature/leds/pca9632.cpp b/Marlin/src/feature/leds/pca9632.cpp index df991ded3..d8af31cb6 100644 --- a/Marlin/src/feature/leds/pca9632.cpp +++ b/Marlin/src/feature/leds/pca9632.cpp @@ -120,7 +120,7 @@ static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const } #endif -void pca9632_set_led_color(const LEDColor &color) { +void PCA9632_set_led_color(const LEDColor &color) { Wire.begin(); if (!PCA_init) { PCA_init = 1; @@ -138,7 +138,7 @@ void pca9632_set_led_color(const LEDColor &color) { #if ENABLED(PCA9632_BUZZER) - void pca9632_buzz(const long, const uint16_t) { + void PCA9632_buzz(const long, const uint16_t) { uint8_t data[] = PCA9632_BUZZER_DATA; Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS)); Wire.write(data, sizeof(data)); diff --git a/Marlin/src/feature/leds/pca9632.h b/Marlin/src/feature/leds/pca9632.h index 34aceb31d..fb59a8c18 100644 --- a/Marlin/src/feature/leds/pca9632.h +++ b/Marlin/src/feature/leds/pca9632.h @@ -29,9 +29,9 @@ struct LEDColor; typedef LEDColor LEDColor; -void pca9632_set_led_color(const LEDColor &color); +void PCA9632_set_led_color(const LEDColor &color); #if ENABLED(PCA9632_BUZZER) #include - void pca9632_buzz(const long, const uint16_t); + void PCA9632_buzz(const long, const uint16_t); #endif diff --git a/Marlin/src/feature/password/password.cpp b/Marlin/src/feature/password/password.cpp index c519ee7c9..90bb64711 100644 --- a/Marlin/src/feature/password/password.cpp +++ b/Marlin/src/feature/password/password.cpp @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * */ diff --git a/Marlin/src/feature/password/password.h b/Marlin/src/feature/password/password.h index 66f1c70ba..3ed584b29 100644 --- a/Marlin/src/feature/password/password.h +++ b/Marlin/src/feature/password/password.h @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/gcode/feature/password/M510-M512.cpp b/Marlin/src/gcode/feature/password/M510-M512.cpp index f26fb75fd..79f1da065 100644 --- a/Marlin/src/gcode/feature/password/M510-M512.cpp +++ b/Marlin/src/gcode/feature/password/M510-M512.cpp @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * */ diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 8848450fc..23bf2c0ce 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -155,7 +155,7 @@ * M141 - Set heated chamber target temp. S (Requires a chamber heater) * M145 - Set heatup values for materials on the LCD. H B F for S (0=PLA, 1=ABS) * M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT) - * M150 - Set Status LED Color as R U B P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, or PCA9632). + * M150 - Set Status LED Color as R U B W P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, or PCA9632). * M155 - Auto-report temperatures with interval of S. (Requires AUTO_REPORT_TEMPERATURES) * M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER) * M164 - Commit the mix and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER) diff --git a/Marlin/src/lcd/menu/menu_led.cpp b/Marlin/src/lcd/menu/menu_led.cpp index 61ffbfd66..290b0ddf6 100644 --- a/Marlin/src/lcd/menu/menu_led.cpp +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -34,18 +34,19 @@ #include "../../feature/leds/leds.h" #if ENABLED(LED_COLOR_PRESETS) + void menu_led_presets() { START_MENU(); #if LCD_HEIGHT > 2 STATIC_ITEM(MSG_LED_PRESETS, SS_DEFAULT|SS_INVERT); #endif BACK_ITEM(MSG_LED_CONTROL); - ACTION_ITEM(MSG_SET_LEDS_WHITE, leds.set_white); - ACTION_ITEM(MSG_SET_LEDS_RED, leds.set_red); + ACTION_ITEM(MSG_SET_LEDS_WHITE, leds.set_white); + ACTION_ITEM(MSG_SET_LEDS_RED, leds.set_red); ACTION_ITEM(MSG_SET_LEDS_ORANGE, leds.set_orange); - ACTION_ITEM(MSG_SET_LEDS_YELLOW,leds.set_yellow); - ACTION_ITEM(MSG_SET_LEDS_GREEN, leds.set_green); - ACTION_ITEM(MSG_SET_LEDS_BLUE, leds.set_blue); + ACTION_ITEM(MSG_SET_LEDS_YELLOW, leds.set_yellow); + ACTION_ITEM(MSG_SET_LEDS_GREEN, leds.set_green); + ACTION_ITEM(MSG_SET_LEDS_BLUE, leds.set_blue); ACTION_ITEM(MSG_SET_LEDS_INDIGO, leds.set_indigo); ACTION_ITEM(MSG_SET_LEDS_VIOLET, leds.set_violet); END_MENU(); @@ -83,11 +84,10 @@ #endif #endif - - void menu_led() { START_MENU(); BACK_ITEM(MSG_MAIN); + #if ENABLED(LED_CONTROL_MENU) bool led_on = leds.lights_on; EDIT_ITEM(bool, MSG_LEDS, &led_on, leds.toggle); @@ -97,6 +97,7 @@ void menu_led() { #endif SUBMENU(MSG_CUSTOM_LEDS, menu_led_custom); #endif + // // Set Case light on/off/brightness // diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index f30d9c68c..09767c72a 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -81,7 +81,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif void MarlinUI::buzz(const long duration, const uint16_t freq) { #if ENABLED(PCA9632_BUZZER) - pca9632_buzz(duration, freq); + PCA9632_buzz(duration, freq); #elif USE_BEEPER buzzer.tone(duration, freq); #endif diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index af1e4c114..5254166fa 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -113,7 +113,7 @@ #define FAN1_PIN PA8 // FAN (fan0 on board) e0 cool fan #define FAN2_PIN PB9 // FAN (fan1 on board) controller cool fan -// One neopixel onboard and a connector for other neopixels +// One NeoPixel onboard and a connector for other NeoPixels #define NEOPIXEL_PIN PC7 // The NEOPIXEL LED driving pin /**