Skip to content

Commit cc5bd37

Browse files
committed
Chameleon multi-extruder
1 parent 9d58b78 commit cc5bd37

11 files changed

Lines changed: 239 additions & 17 deletions

File tree

Marlin/Configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@
375375
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
376376
* EXTENDABLE_EMU_MMU2 : MMU with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
377377
* EXTENDABLE_EMU_MMU2S : MMUS with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
378+
* CHAMELEON : Chameleon with up to 4 switchable filaments
378379
*
379380
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
380381
* See additional options in Configuration_adv.h.

Marlin/Configuration_adv.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4318,7 +4318,25 @@
43184318

43194319
//#define MMU2_DEBUG // Write debug info to serial output
43204320

4321-
#endif // HAS_PRUSA_MMU2
4321+
#elif HAS_CHAMELEON
4322+
// Initial location of the button, minus 3mm for the axis (e.g., if the button is at X225 use X222 here
4323+
#define CHAMELEON_BUTTON_X X_MAX_POS
4324+
#define CHAMELEON_HOLDING_X (CHAMELEON_BUTTON_X - 3)
4325+
#define CHAMELEON_TOOLCHANGE_Y Y_CENTER
4326+
#define CHAMELEON_RAMMING_SEQUENCE \
4327+
{ -50, 2000 }, \
4328+
{ -80, 600 }, \
4329+
{ 1, 2000 }, \
4330+
{ -50, 2000 }, \
4331+
{ -80, 600 }, \
4332+
{ 1, 2000 }, \
4333+
{ -10, 2000 }, \
4334+
{ 1, 2000 }, \
4335+
{ -10, 2000 }, \
4336+
{ 1, 2000 }, \
4337+
{ -50, 2000 }, \
4338+
{ -80, 100 }
4339+
#endif
43224340

43234341
/**
43244342
* Advanced Print Counter settings

Marlin/src/core/macros.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@
293293
#define GANG_N_1(N,K) _GANG_N(N,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K)
294294

295295
// Macros for initializing arrays
296+
#define LIST_32(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,DD,EE,FF,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,DD,EE,FF
297+
#define LIST_31(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,DD,EE,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,DD,EE
298+
#define LIST_30(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,DD,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,DD
299+
#define LIST_29(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,CC
300+
#define LIST_28(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,BB,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,TU,V,W,X,Y,Z,AA,BB
301+
#define LIST_27(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA
296302
#define LIST_26(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
297303
#define LIST_25(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y
298304
#define LIST_24(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X
@@ -524,6 +530,17 @@
524530
#define INC_18 19
525531
#define INC_19 20
526532
#define INC_20 21
533+
#define INC_21 22
534+
#define INC_22 23
535+
#define INC_23 24
536+
#define INC_24 25
537+
#define INC_25 26
538+
#define INC_26 27
539+
#define INC_27 28
540+
#define INC_28 29
541+
#define INC_29 30
542+
#define INC_30 31
543+
#define INC_31 32
527544
#define INCREMENT_(n) INC_##n
528545
#define INCREMENT(n) INCREMENT_(n)
529546

@@ -559,6 +576,23 @@
559576
#define DEC_13 12
560577
#define DEC_14 13
561578
#define DEC_15 14
579+
#define DEC_16 15
580+
#define DEC_17 16
581+
#define DEC_18 17
582+
#define DEC_19 18
583+
#define DEC_20 19
584+
#define DEC_21 20
585+
#define DEC_22 21
586+
#define DEC_23 22
587+
#define DEC_24 23
588+
#define DEC_25 24
589+
#define DEC_26 25
590+
#define DEC_27 26
591+
#define DEC_28 27
592+
#define DEC_29 28
593+
#define DEC_30 29
594+
#define DEC_31 30
595+
#define DEC_32 31
562596
#define DECREMENT_(n) DEC_##n
563597
#define DECREMENT(n) DECREMENT_(n)
564598

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* Marlin 3D Printer Firmware
3+
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4+
*
5+
* Based on Sprinter and grbl.
6+
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
#include "../../inc/MarlinConfig.h"
24+
25+
#if HAS_CHAMELEON
26+
27+
#include "chameleon.h"
28+
//#include "../../MarlinCore.h"
29+
#include "../../module/planner.h"
30+
#include "../../module/stepper.h"
31+
#include "../../lcd/marlinui.h"
32+
33+
//#define DEBUG_OUT ENABLED(DEBUG_CHAMELEON)
34+
#include "../../core/debug_out.h"
35+
36+
Chameleon chameleon;
37+
38+
struct E_Step {
39+
float extrude;
40+
feedRate_t feedRate;
41+
};
42+
43+
void Chameleon::tool_change(const uint8_t index) {
44+
if (index == active_extruder) return;
45+
46+
ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
47+
48+
static constexpr E_Step ramming_sequence[] PROGMEM = { CHAMELEON_RAMMING_SEQUENCE };
49+
execute_extruder_sequence(ramming_sequence, COUNT(ramming_sequence));
50+
51+
ui.reset_status();
52+
}
53+
54+
void Chameleon::execute_extruder_sequence(const E_Step * const sequence, const uint8_t steps) {
55+
planner.synchronize();
56+
stepper.enable_extruder();
57+
58+
const E_Step *step = sequence;
59+
60+
LOOP_L_N(i, steps) {
61+
const float es = pgm_read_float(&(step->extrude));
62+
const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate));
63+
64+
DEBUG_ECHO_MSG("E step ", es, "/", fr_mm_m);
65+
66+
current_position.e += es;
67+
line_to_current_position(MMM_TO_MMS(fr_mm_m));
68+
planner.synchronize();
69+
70+
step++;
71+
}
72+
73+
stepper.disable_extruder();
74+
}
75+
76+
#endif // HAS_CHAMELEON

Marlin/src/feature/mmu/chameleon.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Marlin 3D Printer Firmware
3+
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4+
*
5+
* Based on Sprinter and grbl.
6+
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
#pragma once
23+
24+
#include <stdint.h>
25+
26+
struct E_Step;
27+
28+
class Chameleon {
29+
public:
30+
Chameleon() {}
31+
static void tool_change(const uint8_t new_tool);
32+
33+
private:
34+
static void execute_extruder_sequence(const E_Step * const sequence, const uint8_t steps);
35+
static void push_button();
36+
};
37+
38+
extern Chameleon chameleon;

Marlin/src/inc/Conditionals_LCD.h

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@
569569
#define PRUSA_MMU1 1
570570
#define PRUSA_MMU2 2
571571
#define PRUSA_MMU2S 3
572+
#define CHAMELEON 4
572573
#define EXTENDABLE_EMU_MMU2 12
573574
#define EXTENDABLE_EMU_MMU2S 13
574575

@@ -581,6 +582,8 @@
581582
#elif MMU_MODEL % 10 == PRUSA_MMU2S
582583
#define HAS_PRUSA_MMU2 1
583584
#define HAS_PRUSA_MMU2S 1
585+
#elif MMU_MODEL == CHAMELEON
586+
#define HAS_CHAMELEON 1
584587
#endif
585588
#if MMU_MODEL >= EXTENDABLE_EMU_MMU2
586589
#define HAS_EXTENDABLE_MMU 1
@@ -590,6 +593,7 @@
590593
#undef PRUSA_MMU1
591594
#undef PRUSA_MMU2
592595
#undef PRUSA_MMU2S
596+
#undef CHAMELEON
593597
#undef EXTENDABLE_EMU_MMU2
594598
#undef EXTENDABLE_EMU_MMU2S
595599

@@ -613,14 +617,6 @@
613617
#else
614618
#undef EXTRUDERS
615619
#define EXTRUDERS 0
616-
#undef TEMP_SENSOR_0
617-
#undef TEMP_SENSOR_1
618-
#undef TEMP_SENSOR_2
619-
#undef TEMP_SENSOR_3
620-
#undef TEMP_SENSOR_4
621-
#undef TEMP_SENSOR_5
622-
#undef TEMP_SENSOR_6
623-
#undef TEMP_SENSOR_7
624620
#undef SINGLENOZZLE
625621
#undef SWITCHING_EXTRUDER
626622
#undef MECHANICAL_SWITCHING_EXTRUDER
@@ -674,7 +670,7 @@
674670
#define E_STEPPERS EXTRUDERS
675671
#define E_MANUAL EXTRUDERS
676672

677-
#elif HAS_PRUSA_MMU2 // Průša Multi-Material Unit v2
673+
#elif HAS_PRUSA_MMU2 || HAS_CHAMELEON // Multi-Material Unit
678674

679675
#define E_STEPPERS 1
680676
#define E_MANUAL 1
@@ -686,7 +682,7 @@
686682
#undef DISABLE_OTHER_EXTRUDERS
687683
#endif
688684

689-
// Průša MMU1, MMU(S) 2.0 and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE
685+
// Chameleon, Průša MMU1, MMU(S) 2.0, and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE
690686
#if HAS_MMU
691687
#define SINGLENOZZLE
692688
#endif
@@ -771,6 +767,41 @@
771767
#endif
772768
#endif
773769

770+
#if HOTENDS <= 7
771+
#undef TEMP_SENSOR_7
772+
#define TEMP_SENSOR_7 0
773+
#if HOTENDS <= 6
774+
#undef TEMP_SENSOR_6
775+
#define TEMP_SENSOR_6 0
776+
#if HOTENDS <= 5
777+
#undef TEMP_SENSOR_5
778+
#define TEMP_SENSOR_5 0
779+
#if HOTENDS <= 4
780+
#undef TEMP_SENSOR_4
781+
#define TEMP_SENSOR_4 0
782+
#if HOTENDS <= 3
783+
#undef TEMP_SENSOR_3
784+
#define TEMP_SENSOR_3 0
785+
#if HOTENDS <= 2
786+
#undef TEMP_SENSOR_2
787+
#define TEMP_SENSOR_2 0
788+
#if HOTENDS <= 1
789+
#undef TEMP_SENSOR_1
790+
#define TEMP_SENSOR_1 0
791+
#if HOTENDS == 0
792+
#undef TEMP_SENSOR_0
793+
#define TEMP_SENSOR_0 0
794+
#undef TEMP_SENSOR_REDUNDANT
795+
#define TEMP_SENSOR_REDUNDANT 0
796+
#endif
797+
#endif
798+
#endif
799+
#endif
800+
#endif
801+
#endif
802+
#endif
803+
#endif
804+
774805
/**
775806
* Number of Linear Axes (e.g., XYZIJKUVW)
776807
* All the logical axes except for the tool (E) axis

Marlin/src/inc/SanityCheck.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,12 +621,21 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
621621
#endif
622622
#endif
623623

624+
#if HAS_CHAMELEON
625+
#if EXTRUDERS > 32
626+
#undef SINGLENOZZLE
627+
#error "CHAMELEON only supports up to 32 EXTRUDERS. Please update your Configuration."
628+
#endif
629+
#endif
630+
624631
/**
625632
* Options only for EXTRUDERS > 1
626633
*/
627634
#if HAS_MULTI_EXTRUDER
628635

629-
#if HAS_EXTENDABLE_MMU
636+
#if HAS_CHAMELEON
637+
#define MAX_EXTRUDERS 32
638+
#elif HAS_EXTENDABLE_MMU
630639
#define MAX_EXTRUDERS 15
631640
#else
632641
#define MAX_EXTRUDERS 8

Marlin/src/module/stepper/indirection.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
585585
#define FWD_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? HIGH : LOW ); }while(0)
586586
#define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? LOW : HIGH); }while(0)
587587

588+
#elif ENABLED(CHAMELEON) // One multiplexed stepper driver, reversed on T2/T3, T6/T7, T10/T11, etc.
589+
590+
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
591+
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 1) ? HIGH : LOW ); }while(0)
592+
#define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 1) ? LOW : HIGH); }while(0)
593+
588594
#elif E_STEPPERS > 1
589595

590596
#if E_STEPPERS > 7

Marlin/src/module/tool_change.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
#include "../feature/mmu/mmu.h"
8383
#elif HAS_PRUSA_MMU2
8484
#include "../feature/mmu/mmu2.h"
85+
#elif HAS_CHAMELEON
86+
#include "../feature/mmu/chameleon.h"
8587
#endif
8688

8789
#if HAS_MARLINUI_MENU
@@ -1103,6 +1105,12 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
11031105
mixer.T(new_tool);
11041106
#endif
11051107

1108+
#elif HAS_CHAMELEON
1109+
1110+
UNUSED(no_move);
1111+
1112+
chameleon.tool_change(new_tool);
1113+
11061114
#elif HAS_PRUSA_MMU2
11071115

11081116
UNUSED(no_move);

buildroot/tests/mega2560

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE ..."
3939
# Add a Sled Z Probe, use UBL Cartesian moves, use Japanese language
4040
#
4141
use_example_configs AnimationExample
42-
opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO LCD_LANGUAGE jp_kana DEFAULT_EJERK 10 \
43-
EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 5 TEMP_SENSOR_3 20 TEMP_SENSOR_4 1000 TEMP_SENSOR_BED 1
42+
opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO \
43+
EXTRUDERS 8 TEMP_SENSOR_BED 1 MMU_MODEL CHAMELEON DEFAULT_EJERK 10 LCD_LANGUAGE jp_kana
4444
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LIGHTWEIGHT_UI SHOW_CUSTOM_BOOTSCREEN BOOT_MARLIN_LOGO_SMALL \
4545
SET_PROGRESS_MANUALLY SET_PROGRESS_PERCENT PRINT_PROGRESS_SHOW_DECIMALS SHOW_REMAINING_TIME STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES \
4646
SDSUPPORT LONG_FILENAME_WRITE_SUPPORT SDCARD_SORT_ALPHA NO_SD_AUTOSTART USB_FLASH_DRIVE_SUPPORT CANCEL_OBJECTS \
4747
Z_PROBE_SLED AUTO_BED_LEVELING_UBL UBL_HILBERT_CURVE UBL_TILT_ON_MESH_POINTS UBL_TILT_ON_MESH_POINTS_3POINT \
4848
RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT \
4949
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN \
50-
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE QUICK_HOME \
50+
NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE CLASSIC_JERK LIN_ADVANCE QUICK_HOME \
5151
NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL \
5252
SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \
53-
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_HOTEND_Z_OFFSET BABYSTEP_DISPLAY_TOTAL
53+
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_DISPLAY_TOTAL
5454
opt_disable SEGMENT_LEVELED_MOVES
55-
exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE | Sled Probe | Skew | JP-Kana | Babystep offsets ..." "$3"
55+
exec_test $1 $2 "Azteeg X3 Pro | Chameleon (x8) | RRDFGSC | UBL | LIN_ADVANCE | Sled Probe | Skew | JP-Kana | Babystep offsets ..." "$3"
5656

5757
#
5858
# 5 runout sensors with distinct states

0 commit comments

Comments
 (0)