Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin
Browse files Browse the repository at this point in the history
… into bugfix-2.0.x-bltouch
  • Loading branch information
crysxd committed Jul 4, 2020
2 parents 8b3ca35 + 3641972 commit 3c51aa8
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,4 @@ struct XYZEval {
#undef FI

const xyze_char_t axis_codes { 'X', 'Y', 'Z', 'E' };
#define XYZ_CHAR(A) ('X' + char(A))
#define XYZ_CHAR(A) ((char)('X' + A))
26 changes: 17 additions & 9 deletions Marlin/src/feature/leds/neopixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#endif

Marlin_NeoPixel neo;
int8_t Marlin_NeoPixel::neoindex;

Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800)
#if MULTIPLE_NEOPIXEL_TYPES
Expand All @@ -52,14 +53,20 @@ Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIX
#endif

void Marlin_NeoPixel::set_color(const uint32_t color) {
for (uint16_t i = 0; i < pixels(); ++i) {
#ifdef NEOPIXEL_BKGD_LED_INDEX
if (i == NEOPIXEL_BKGD_LED_INDEX && color != 0x000000) {
set_color_background();
continue;
}
#endif
set_pixel_color(i, color);
if (get_neo_index() < 0) {
set_pixel_color(get_neo_index(), color);
set_neo_index(-1);
}
else {
for (uint16_t i = 0; i < pixels(); ++i) {
#ifdef NEOPIXEL_BKGD_LED_INDEX
if (i == NEOPIXEL_BKGD_LED_INDEX && color != 0x000000) {
set_color_background();
continue;
}
#endif
set_pixel_color(i, color);
}
}
show();
}
Expand All @@ -71,7 +78,8 @@ void Marlin_NeoPixel::set_color_startup(const uint32_t color) {
}

void Marlin_NeoPixel::init() {
set_brightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range
set_neo_index(-1); // -1 .. NEOPIXEL_PIXELS-1 range
set_brightness(NEOPIXEL_BRIGHTNESS); // 0 .. 255 range
begin();
show(); // initialize to all off

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/feature/leds/neopixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,17 @@ class Marlin_NeoPixel {
, adaneo2
#endif
;
static int8_t neoindex;

public:
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
Expand Down
9 changes: 8 additions & 1 deletion Marlin/src/gcode/feature/leds/M150.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
* Always sets all 3 or 4 components. If a component is left out, set to 0.
* If brightness is left out, no value changed
*
* With NEOPIXEL_LED:
* I<index> Set the Neopixel index to affect. Default: All
*
* Examples:
*
* M150 R255 ; Turn LED red
Expand All @@ -43,8 +46,12 @@
* M150 W ; Turn LED white using a white LED
* M150 P127 ; Set LED 50% brightness
* M150 P ; Set LED full brightness
*/
* M150 I1 R ; Set NEOPIXEL index 1 to red
*/
void GcodeSuite::M150() {
#if ENABLED(NEOPIXEL_LED)
neo.set_neo_index(parser.intval('I', -1));
#endif
leds.set_color(MakeLEDColor(
parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : 0,
parser.seen('U') ? (parser.has_value() ? parser.value_byte() : 255) : 0,
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-07-03"
#define STRING_DISTRIBUTION_DATE "2020-07-04"
#endif

/**
Expand Down
40 changes: 18 additions & 22 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ board = sanguino_atmega644p
platform = atmelavr
extends = common_avr8
board = sanguino_atmega1284p
board_upload.maximum_size = 126976

#
# Melzi and clones (ATmega1284p)
Expand All @@ -157,22 +158,24 @@ extends = common_avr8
board = sanguino_atmega1284p
lib_ignore = TMCStepper
upload_speed = 57600
board_upload.maximum_size = 126976

#
# Melzi and clones (Optiboot bootloader)
#
[env:melzi_optiboot]
platform = atmelavr
extends = env:melzi
extends = common_avr8
board = sanguino_atmega1284p
lib_ignore = TMCStepper
upload_speed = 115200

#
# Melzi and clones (Zonestar Melzi2 with tuned flags)
#
[env:melzi_optimized]
platform = atmelavr
extends = env:melzi
upload_speed = 115200
extends = env:melzi_optiboot
build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues
build_unflags = -g -ggdb

Expand Down Expand Up @@ -552,6 +555,16 @@ extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano.py
build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE -DSS_TIMER=4

#
# MKS Robin Nano (STM32F103VET6) - MKS UI (LVGL)
#
[env:mks_robin_nano35]
platform = ${common_stm32f1.platform}
extends = env:mks_robin_nano
extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
lib_deps = ${common_stm32f1.lib_deps}
MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip

#
# MKS Robin (STM32F103ZET6)
#
Expand Down Expand Up @@ -627,23 +640,6 @@ build_flags = ${common_stm32f1.build_flags}
lib_ignore = ${common_stm32f1.lib_ignore}
LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SoftwareSerialM

#
# MKS Robin Nano (STM32F103VET6) - MKS UI (LVGL)
#
[env:mks_robin_nano35]
platform = ststm32
board = genericSTM32F103VE
platform_packages = tool-stm32duino
build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py
${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4
build_unflags = -std=gnu++11
extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
lib_deps = ${common.lib_deps}
SoftwareSerialM
MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
lib_ignore = Adafruit NeoPixel, SPI

#
# Malyan M200 v2 (STM32F070RB)
#
Expand Down Expand Up @@ -699,8 +695,8 @@ platform = ${common_stm32f1.platform}
extends = env:chitu_f103
src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
lib_deps = ${common.lib_deps}
SoftwareSerialM
MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
SoftwareSerialM
MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip

#
# Creality (STM32F103RET6)
Expand Down

0 comments on commit 3c51aa8

Please sign in to comment.