@ -142,7 +142,7 @@
* M140 - Set bed target temp . S < temp >
* M140 - Set bed target temp . S < temp >
* M145 - Set heatup values for materials on the LCD . H < hotend > B < bed > F < fan speed > for S < material > ( 0 = PLA , 1 = ABS )
* M145 - Set heatup values for materials on the LCD . H < hotend > B < bed > F < fan speed > for S < material > ( 0 = PLA , 1 = ABS )
* M149 - Set temperature units . ( Requires TEMPERATURE_UNITS_SUPPORT )
* M149 - Set temperature units . ( Requires TEMPERATURE_UNITS_SUPPORT )
* M150 - Set Status LED Color as R < red > U < green > B < blue > . Values 0 - 255. ( Requires BLINKM , RGB_LED , RGBW_LED , or PCA9632 )
* M150 - Set Status LED Color as R < red > U < green > B < blue > P < bright > . Values 0 - 255. ( Requires BLINKM , RGB_LED , RGBW_LED , NEOPIXEL_LED, or PCA9632 ) .
* M155 - Auto - report temperatures with interval of S < seconds > . ( Requires AUTO_REPORT_TEMPERATURES )
* M155 - Auto - report temperatures with interval of S < seconds > . ( Requires AUTO_REPORT_TEMPERATURES )
* M163 - Set a single proportion for a mixing extruder . ( Requires MIXING_EXTRUDER )
* M163 - Set a single proportion for a mixing extruder . ( Requires MIXING_EXTRUDER )
* M164 - Save the mix as a virtual extruder . ( Requires MIXING_EXTRUDER and MIXING_VIRTUAL_TOOLS )
* M164 - Save the mix as a virtual extruder . ( Requires MIXING_EXTRUDER and MIXING_VIRTUAL_TOOLS )
@ -283,7 +283,7 @@
# include "Max7219_Debug_LEDs.h"
# include "Max7219_Debug_LEDs.h"
# endif
# endif
# if ENABLED(NEOPIXEL_ RGBW_ LED)
# if ENABLED(NEOPIXEL_ LED)
# include <Adafruit_NeoPixel.h>
# include <Adafruit_NeoPixel.h>
# endif
# endif
@ -349,6 +349,20 @@
| | isnan ( ubl . z_values [ 0 ] [ 0 ] ) )
| | isnan ( ubl . z_values [ 0 ] [ 0 ] ) )
# endif
# endif
# if ENABLED(NEOPIXEL_LED)
# if NEOPIXEL_TYPE == NEO_RGB || NEOPIXEL_TYPE == NEO_RBG || NEOPIXEL_TYPE == NEO_GRB || NEOPIXEL_TYPE == NEO_GBR || NEOPIXEL_TYPE == NEO_BRG || NEOPIXEL_TYPE == NEO_BGR
# define NEO_WHITE 255, 255, 255
# else
# define NEO_WHITE 0, 0, 0, 255
# endif
# endif
# if ENABLED(RGB_LED) || ENABLED(BLINKM) || ENABLED(PCA9632)
# define LED_WHITE 255, 255, 255
# elif ENABLED(RGBW_LED)
# define LED_WHITE 0, 0, 0, 255
# endif
bool Running = true ;
bool Running = true ;
uint8_t marlin_debug_flags = DEBUG_NONE ;
uint8_t marlin_debug_flags = DEBUG_NONE ;
@ -978,9 +992,9 @@ void servo_init() {
# if HAS_COLOR_LEDS
# if HAS_COLOR_LEDS
# if ENABLED(NEOPIXEL_ RGBW_ LED)
# if ENABLED(NEOPIXEL_ LED)
Adafruit_NeoPixel pixels ( NEOPIXEL_PIXELS , NEOPIXEL_PIN , NEO _GRBW + NEO_KHZ800 ) ;
Adafruit_NeoPixel pixels ( NEOPIXEL_PIXELS , NEOPIXEL_PIN , NEO PIXEL_TYPE + NEO_KHZ800 ) ;
void set_neopixel_color ( const uint32_t color ) {
void set_neopixel_color ( const uint32_t color ) {
for ( uint16_t i = 0 ; i < pixels . numPixels ( ) ; + + i )
for ( uint16_t i = 0 ; i < pixels . numPixels ( ) ; + + i )
@ -989,7 +1003,7 @@ void servo_init() {
}
}
void setup_neopixel ( ) {
void setup_neopixel ( ) {
pixels . setBrightness ( 255 ) ; // 0 - 255 range
pixels . setBrightness ( NEOPIXEL_BRIGHTNESS ) ; // 0 - 255 range
pixels . begin ( ) ;
pixels . begin ( ) ;
pixels . show ( ) ; // initialize to all off
pixels . show ( ) ; // initialize to all off
@ -1002,26 +1016,28 @@ void servo_init() {
set_neopixel_color ( pixels . Color ( 0 , 0 , 255 , 0 ) ) ; // blue
set_neopixel_color ( pixels . Color ( 0 , 0 , 255 , 0 ) ) ; // blue
delay ( 2000 ) ;
delay ( 2000 ) ;
# endif
# endif
set_neopixel_color ( pixels . Color ( 0 , 0 , 0 , 255 ) ) ; // white
set_neopixel_color ( pixels . Color ( NEO_WHITE ) ) ; // white
}
}
# endif // NEOPIXEL_ RGBW_ LED
# endif // NEOPIXEL_ LED
void set_led_color (
void set_led_color (
const uint8_t r , const uint8_t g , const uint8_t b
const uint8_t r , const uint8_t g , const uint8_t b
# if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_ RGBW_ LED)
# if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_ LED)
, const uint8_t w = 0
, const uint8_t w = 0
# if ENABLED(NEOPIXEL_RGBW_LED)
# if ENABLED(NEOPIXEL_LED)
, const uint8_t p = NEOPIXEL_BRIGHTNESS
, bool isSequence = false
, bool isSequence = false
# endif
# endif
# endif
# endif
) {
) {
# if ENABLED(NEOPIXEL_ RGBW_ LED)
# if ENABLED(NEOPIXEL_ LED)
const uint32_t color = pixels . Color ( r , g , b , w ) ;
const uint32_t color = pixels . Color ( r , g , b , w ) ;
static uint16_t nextLed = 0 ;
static uint16_t nextLed = 0 ;
pixels . setBrightness ( p ) ;
if ( ! isSequence )
if ( ! isSequence )
set_neopixel_color ( color ) ;
set_neopixel_color ( color ) ;
else {
else {
@ -7590,9 +7606,13 @@ inline void gcode_M109() {
if ( blue ! = old_blue ) {
if ( blue ! = old_blue ) {
old_blue = blue ;
old_blue = blue ;
set_led_color ( 255 , 0 , blue
set_led_color ( 255 , 0 , blue
# if ENABLED(NEOPIXEL_RGBW_LED)
# if ENABLED(NEOPIXEL_LED)
, 0 , true
, 0
, pixels . getBrightness ( )
# if ENABLED(NEOPIXEL_IS_SEQUENTIAL)
, true
# endif
# endif
# endif
) ;
) ;
}
}
}
}
@ -7629,10 +7649,11 @@ inline void gcode_M109() {
if ( wait_for_heatup ) {
if ( wait_for_heatup ) {
LCD_MESSAGEPGM ( MSG_HEATING_COMPLETE ) ;
LCD_MESSAGEPGM ( MSG_HEATING_COMPLETE ) ;
# if ENABLED(PRINTER_EVENT_LEDS)
# if ENABLED(PRINTER_EVENT_LEDS)
# if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_RGBW_LED)
# if ENABLED(RGB_LED) || ENABLED(BLINKM) || ENABLED(PCA9632) || ENABLED(RGBW_LED)
set_led_color ( 0 , 0 , 0 , 255 ) ; // Turn on the WHITE LED
set_led_color ( LED_WHITE ) ;
# else
# endif
set_led_color ( 255 , 255 , 255 ) ; // Set LEDs All On
# if ENABLED(NEOPIXEL_LED)
set_neopixel_color ( pixels . Color ( NEO_WHITE ) ) ;
# endif
# endif
# endif
# endif
}
}
@ -7730,8 +7751,11 @@ inline void gcode_M109() {
if ( red ! = old_red ) {
if ( red ! = old_red ) {
old_red = red ;
old_red = red ;
set_led_color ( red , 0 , 255
set_led_color ( red , 0 , 255
# if ENABLED(NEOPIXEL_RGBW_LED)
# if ENABLED(NEOPIXEL_LED)
, 0 , true
, 0 , pixels . getBrightness ( )
# if ENABLED(NEOPIXEL_IS_SEQUENTIAL)
, true
# endif
# endif
# endif
) ;
) ;
}
}
@ -8378,8 +8402,10 @@ inline void gcode_M121() { endstops.enable_globally(false); }
/**
/**
* M150 : Set Status LED Color - Use R - U - B - W for R - G - B - W
* M150 : Set Status LED Color - Use R - U - B - W for R - G - B - W
* and Brightness - Use P ( for NEOPIXEL only )
*
*
* Always sets all 3 or 4 components . If a component is left out , set to 0.
* Always sets all 3 or 4 components . If a component is left out , set to 0.
* If brightness is left out , no value changed
*
*
* Examples :
* Examples :
*
*
@ -8388,15 +8414,19 @@ inline void gcode_M121() { endstops.enable_globally(false); }
* M150 ; Turn LED off
* M150 ; Turn LED off
* M150 R U B ; Turn LED white
* M150 R U B ; Turn LED white
* M150 W ; Turn LED white using a white LED
* M150 W ; Turn LED white using a white LED
*
* M150 P127 ; Set LED 50 % brightness
* M150 P ; Set LED full brightness
*/
*/
inline void gcode_M150 ( ) {
inline void gcode_M150 ( ) {
set_led_color (
set_led_color (
parser . seen ( ' R ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0 ,
parser . seen ( ' R ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0 ,
parser . seen ( ' U ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0 ,
parser . seen ( ' U ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0 ,
parser . seen ( ' B ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0
parser . seen ( ' B ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0
# if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_ RGBW_ LED)
# if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_ LED)
, parser . seen ( ' W ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0
, parser . seen ( ' W ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : 0
# if ENABLED(NEOPIXEL_LED)
, parser . seen ( ' P ' ) ? ( parser . has_value ( ) ? parser . value_byte ( ) : 255 ) : pixels . getBrightness ( )
# endif
# endif
# endif
) ;
) ;
}
}
@ -13492,7 +13522,7 @@ void setup() {
OUT_WRITE ( STAT_LED_BLUE_PIN , LOW ) ; // turn it off
OUT_WRITE ( STAT_LED_BLUE_PIN , LOW ) ; // turn it off
# endif
# endif
# if ENABLED(NEOPIXEL_ RGBW_ LED)
# if ENABLED(NEOPIXEL_ LED)
SET_OUTPUT ( NEOPIXEL_PIN ) ;
SET_OUTPUT ( NEOPIXEL_PIN ) ;
setup_neopixel ( ) ;
setup_neopixel ( ) ;
# endif
# endif