Skip to content

Commit a8749f2

Browse files
committed
Chameleon multi-extruder
1 parent bf45436 commit a8749f2

File tree

12 files changed

+229
-12
lines changed

12 files changed

+229
-12
lines changed

Marlin/Configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
254254
* EXTENDABLE_EMU_MMU2 : MMU with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
255255
* EXTENDABLE_EMU_MMU2S : MMUS with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
256+
* CHAMELEON : Chameleon with up to 4 switchable filaments
256257
*
257258
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
258259
* 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
@@ -4265,7 +4265,25 @@
42654265

42664266
//#define MMU2_DEBUG // Write debug info to serial output
42674267

4268-
#endif // HAS_PRUSA_MMU2
4268+
#elif HAS_CHAMELEON
4269+
// Initial location of the button, minus 3mm for the axis (e.g., if the button is at X225 use X222 here
4270+
#define CHAMELEON_BUTTON_X X_MAX_POS
4271+
#define CHAMELEON_HOLDING_X (CHAMELEON_BUTTON_X - 3)
4272+
#define CHAMELEON_TOOLCHANGE_Y Y_CENTER
4273+
#define CHAMELEON_RAMMING_SEQUENCE \
4274+
{ -50, 2000 }, \
4275+
{ -80, 600 }, \
4276+
{ 1, 2000 }, \
4277+
{ -50, 2000 }, \
4278+
{ -80, 600 }, \
4279+
{ 1, 2000 }, \
4280+
{ -10, 2000 }, \
4281+
{ 1, 2000 }, \
4282+
{ -10, 2000 }, \
4283+
{ 1, 2000 }, \
4284+
{ -50, 2000 }, \
4285+
{ -80, 100 }
4286+
#endif
42694287

42704288
/**
42714289
* Advanced Print Counter settings

Marlin/src/core/macros.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,18 @@
338338
#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)
339339

340340
// Macros for initializing arrays
341+
#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
342+
#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
343+
#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
344+
#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
345+
#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
346+
#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
347+
#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
348+
#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
349+
#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
350+
#define LIST_23(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W
351+
#define LIST_22(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V
352+
#define LIST_21(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U
341353
#define LIST_20(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T
342354
#define LIST_19(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S
343355
#define LIST_18(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R
@@ -563,6 +575,17 @@
563575
#define INC_18 19
564576
#define INC_19 20
565577
#define INC_20 21
578+
#define INC_21 22
579+
#define INC_22 23
580+
#define INC_23 24
581+
#define INC_24 25
582+
#define INC_25 26
583+
#define INC_26 27
584+
#define INC_27 28
585+
#define INC_28 29
586+
#define INC_29 30
587+
#define INC_30 31
588+
#define INC_31 32
566589
#define INCREMENT_(n) INC_##n
567590
#define INCREMENT(n) INCREMENT_(n)
568591

@@ -598,6 +621,23 @@
598621
#define DEC_13 12
599622
#define DEC_14 13
600623
#define DEC_15 14
624+
#define DEC_16 15
625+
#define DEC_17 16
626+
#define DEC_18 17
627+
#define DEC_19 18
628+
#define DEC_20 19
629+
#define DEC_21 20
630+
#define DEC_22 21
631+
#define DEC_23 22
632+
#define DEC_24 23
633+
#define DEC_25 24
634+
#define DEC_26 25
635+
#define DEC_27 26
636+
#define DEC_28 27
637+
#define DEC_29 28
638+
#define DEC_30 29
639+
#define DEC_31 30
640+
#define DEC_32 31
601641
#define DECREMENT_(n) DEC_##n
602642
#define DECREMENT(n) DECREMENT_(n)
603643

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) 2022 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) 2022 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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@
548548
#define PRUSA_MMU1 1
549549
#define PRUSA_MMU2 2
550550
#define PRUSA_MMU2S 3
551+
#define CHAMELEON 4
551552
#define EXTENDABLE_EMU_MMU2 12
552553
#define EXTENDABLE_EMU_MMU2S 13
553554

@@ -560,6 +561,8 @@
560561
#elif MMU_MODEL % 10 == PRUSA_MMU2S
561562
#define HAS_PRUSA_MMU2 1
562563
#define HAS_PRUSA_MMU2S 1
564+
#elif MMU_MODEL == CHAMELEON
565+
#define HAS_CHAMELEON 1
563566
#endif
564567
#if MMU_MODEL >= EXTENDABLE_EMU_MMU2
565568
#define HAS_EXTENDABLE_MMU 1
@@ -569,6 +572,7 @@
569572
#undef PRUSA_MMU1
570573
#undef PRUSA_MMU2
571574
#undef PRUSA_MMU2S
575+
#undef CHAMELEON
572576
#undef EXTENDABLE_EMU_MMU2
573577
#undef EXTENDABLE_EMU_MMU2S
574578

@@ -635,7 +639,7 @@
635639
#define E_STEPPERS EXTRUDERS
636640
#define E_MANUAL EXTRUDERS
637641

638-
#elif HAS_PRUSA_MMU2 // Průša Multi-Material Unit v2
642+
#elif HAS_PRUSA_MMU2 || HAS_CHAMELEON // Multi-Material Unit
639643

640644
#define E_STEPPERS 1
641645
#define E_MANUAL 1
@@ -647,7 +651,7 @@
647651
#undef DISABLE_INACTIVE_EXTRUDER
648652
#endif
649653

650-
// Průša MMU1, MMU(S) 2.0 and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE
654+
// Chameleon, Průša MMU1, MMU(S) 2.0, and EXTENDABLE_EMU_MMU2(S) force SINGLENOZZLE
651655
#if HAS_MMU
652656
#define SINGLENOZZLE
653657
#endif

Marlin/src/inc/SanityCheck.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,12 +1159,21 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
11591159
#endif
11601160
#endif
11611161

1162+
#if HAS_CHAMELEON
1163+
#if EXTRUDERS > 32
1164+
#undef SINGLENOZZLE
1165+
#error "CHAMELEON only supports up to 32 EXTRUDERS. Please update your Configuration."
1166+
#endif
1167+
#endif
1168+
11621169
/**
11631170
* Options only for EXTRUDERS > 1
11641171
*/
11651172
#if HAS_MULTI_EXTRUDER
11661173

1167-
#if HAS_EXTENDABLE_MMU
1174+
#if HAS_CHAMELEON
1175+
#define MAX_EXTRUDERS 32
1176+
#elif HAS_EXTENDABLE_MMU
11681177
#define MAX_EXTRUDERS 15
11691178
#else
11701179
#define MAX_EXTRUDERS 8
@@ -2427,6 +2436,24 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
24272436
#endif // HOTENDS > 2
24282437
#endif // HAS_MULTI_HOTEND
24292438

2439+
#if HOTENDS < 8 && TEMP_SENSOR_7 != 0
2440+
#error "TEMP_SENSOR_7 shouldn't be set with less than 8 hotends."
2441+
#elif HOTENDS < 7 && TEMP_SENSOR_6 != 0
2442+
#error "TEMP_SENSOR_6 shouldn't be set with less than 7 hotends."
2443+
#elif HOTENDS < 6 && TEMP_SENSOR_5 != 0
2444+
#error "TEMP_SENSOR_5 shouldn't be set with less than 6 hotends."
2445+
#elif HOTENDS < 5 && TEMP_SENSOR_4 != 0
2446+
#error "TEMP_SENSOR_4 shouldn't be set with less than 5 hotends."
2447+
#elif HOTENDS < 4 && TEMP_SENSOR_3 != 0
2448+
#error "TEMP_SENSOR_3 shouldn't be set with less than 4 hotends."
2449+
#elif HOTENDS < 3 && TEMP_SENSOR_2 != 0
2450+
#error "TEMP_SENSOR_2 shouldn't be set with less than 3 hotends."
2451+
#elif HOTENDS < 2 && TEMP_SENSOR_1 != 0
2452+
#error "TEMP_SENSOR_1 shouldn't be set with less than 2 hotends."
2453+
#elif HOTENDS < 1 && TEMP_SENSOR_0 != 0
2454+
#error "TEMP_SENSOR_0 shouldn't be set with no hotends."
2455+
#endif
2456+
24302457
/**
24312458
* Pins must be set for temp sensors, with some other feature requirements.
24322459
*/

Marlin/src/module/stepper/indirection.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
544544
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? DISABLED(INVERT_E0_DIR): ENABLED(INVERT_E0_DIR)); }while(0)
545545
#define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? ENABLED(INVERT_E0_DIR): DISABLED(INVERT_E0_DIR)); }while(0)
546546

547+
#elif ENABLED(CHAMELEON) // One multiplexed stepper driver, reversed on T2/T3, T6/T7, T10/T11, etc.
548+
549+
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
550+
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 1) ? !INVERT_E0_DIR: INVERT_E0_DIR); }while(0)
551+
#define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 1) ? INVERT_E0_DIR: !INVERT_E0_DIR); }while(0)
552+
547553
#elif E_STEPPERS > 1
548554

549555
#if E_STEPPERS > 7

Marlin/src/module/tool_change.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
#include "../feature/mmu/mmu.h"
8888
#elif HAS_PRUSA_MMU2
8989
#include "../feature/mmu/mmu2.h"
90+
#elif HAS_CHAMELEON
91+
#include "../feature/mmu/chameleon.h"
9092
#endif
9193

9294
#if HAS_MARLINUI_MENU
@@ -1111,6 +1113,12 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
11111113
mixer.T(new_tool);
11121114
#endif
11131115

1116+
#elif HAS_CHAMELEON
1117+
1118+
UNUSED(no_move);
1119+
1120+
chameleon.tool_change(new_tool);
1121+
11141122
#elif HAS_PRUSA_MMU2
11151123

11161124
UNUSED(no_move);

buildroot/tests/mega2560

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,19 @@ 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
LCD_SET_PROGRESS_MANUALLY 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 RESTORE_LEVELING_AFTER_G28 DEBUG_LEVELING_FEATURE G26_MESH_VALIDATION ENABLE_LEVELING_FADE_HEIGHT \
4848
EEPROM_SETTINGS EEPROM_CHITCHAT GCODE_MACROS CUSTOM_MENU_MAIN \
49-
MULTI_NOZZLE_DUPLICATION CLASSIC_JERK LIN_ADVANCE QUICK_HOME \
49+
NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE CLASSIC_JERK LIN_ADVANCE QUICK_HOME \
5050
NANODLP_Z_SYNC I2C_POSITION_ENCODERS M114_DETAIL \
5151
SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \
52-
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_HOTEND_Z_OFFSET BABYSTEP_DISPLAY_TOTAL
52+
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_DISPLAY_TOTAL
5353
opt_disable SEGMENT_LEVELED_MOVES
54-
exec_test $1 $2 "Azteeg X3 Pro | EXTRUDERS 5 | RRDFGSC | UBL | LIN_ADVANCE | Sled Probe | Skew | JP-Kana | Babystep offsets ..." "$3"
55-
54+
exec_test $1 $2 "Azteeg X3 Pro | Chameleon (x8) | RRDFGSC | UBL | LIN_ADVANCE | Sled Probe | Skew | JP-Kana | Babystep offsets ..." "$3"
5655

5756
#
5857
# 5 runout sensors with distinct states

0 commit comments

Comments
 (0)