; - 3D Chameleon Mk4 Tool T{next_extruder} -
;begin switch from extruder {previous_extruder} to extruder #{next_extruder}
M117 Unloading Tool T[previous_extruder]
M83 ; turn relative distances for the extruder
; unload extruder {previous_extruder}
G92 E0
; go to holding position to unload the stock extruder
{buttonLocation} ; <<----- EDIT THIS LINE TO SET THE INITIAL LOCATION OF THE BUTTON
; if this is the first load, then don't unload
G91 ; move to relative mode
M83
; load extruder #{next_extruder}
M117 Loading Tool T{next_extruder}
{if previous_extruder>-1}
; back out the filament for cutting
G0 E-20 F500 ; retract a bit, adjust this to tune waste
; <<<< insert mechanical cutter code here! >>>>
;<<< Start Of Tip Shaping- Remove If No Cutter! >>>
M109 R180; cool down to prevent swelling
M302 S0 ; enable cold extrusion
M106 S255
G0 E20 F1500 ;
G0 E-5 F500 ;
M109 R165; cool down to prevent swelling
G0 E5 F1500 ;
G0 E-1 F500 ;
M109 R155; cool down to prevent swelling
G0 E1 F1500 ;
G0 E-25 F500 ;
M109 R150; cool down to prevent swelling
G0 E24 F1500 ; last tip dip with cold tip
G0 E-24 ; last tip dip with cold tip
M109 R180; ok... go back up in temp so we can move the extruder
G0 E-80 F500 ; back out of the extruder
G92 E0
M104 S[temperature];
;<<< End Of Tip Shaping >>>
; we skipped to here if it was extruder -1
{endif}
{if previous_extruder>-1}
; retract it back out of the extruder
{unloadGCode}
G0 E-30 F2000 ; <<<---- if mechanical cutter, change to a positive value of at least 5mm
G92 E0
; ok - out of extruder - press button to remove it all the way
G91 ; move to relative mode
M82
; we skipped to here if it was extruder -1
{endif}
; press the button to select the new extruder
{buttonPressCode}
{if next_extruder==0}
G4 P500 ; dwell for .5 seconds - adjust this to match your machines single pulse time
{endif}
{if next_extruder==1}
G4 P1000 ; dwell for 1.0 seconds - adjust this to match your machines two pulse time
{endif}
{if next_extruder==2}
G4 P1500 ; dwell for 1.5 seconds - adjust this to match your machines three pulse time
{endif}
{if next_extruder==3}
G4 P2000 ; dwell for 2.0 seconds - adjust this to match your machines four pulse time
{endif}
{buttonUnpressCode}
G4 P2000 ; wait for cutter to work
; ok command selected - back out filament if needed after cut
{if previous_extruder>-1}
{unloadFilament}
{endif}
{loadFilament}
G92 E0
G90 ; move back to absolute mode
M83 ; but make sure the extruder stays in relative
; reload filament all the way into extruder
{loadGCode}
M83 ; turn relative distances for the extruder
M302 S180 ; prevent cold extrusion
M117 3D Chameleon Tool T{next_extruder}
Mk4 GCode Generator
Button Axis (X, Y or Z)
Button Location (mm)
Extruder to Hotend (mm)
Mk4 Theory of Operation
Once generated, copy and paste this code into your slicer's Tool Change GCode block.
The Mk4 Firmware uses a new method to allow color changing with a single button press to select a color, and then up to two additional buttons presses to move the filament. The 3D Chameleon is used in conjunction with your stock extruder, and allows for the Y adapter to be placed any distance from the hotend. This is the most flexible installation as it allows both an infinite number of 3DChameleons to be used, but also allows them to be placed anywhere away from the printer.
The first button press works by timing (with vibration feedback every .5 seconds) to allow you to "count" the command.
Filament changing always works the same in any mode. To select an extruder, simply press the button for a total time of .5 seconds per extruder number. (For example, to select Extruder 3, multiply 3 times .5 seconds = 1.5 seconds.) So, pressing the button for .5 seconds selects the first extruder, 1 second selects the second extruder, 1.5 seconds selects the 3rd extruder and 2 seconds selects the 4th extruder.
To actually move the filament once a color is selected, the 3DChamelon needs an additional button press for some number of seconds, where that number is 1" (or 2.5cm) per second, to unload the previous filament... and a third button press to load the filament, one second for each 1" of movement required to load it into the extruder. For example, to unload extruder 1 (T0) by 15 inches and load extruder 4 (T3) by 16 inches, you should press for 2 seconds, let off, then press for 15 seconds to unload extruder 1 (T0), and finally press for 16 seconds to load extruder 4 (T3). (Note: On the very first filament load after homing, becuase the extruder isn't already loaded, the unloading button press is not needed and is skipped. The tool change gcode automatically handles that starting condition.)
While the button is pressed, each half of a second, the selector motor will vibrate, indicating the pointer to the next command.
​
The commands are as follows.
1st Pulse - Switch to tool T0 (filament 1), unloads previous filament if necessary
2nd Pulse - Switch to tool T1 (filament 2), unloads previous filament if necessary
3rd Pulse - Switch to tool T2 (filament 3), unloads previous filament if necessary
4th Pulse - Switch to tool T3 (filament 4), unloads previous filament if necessary
5th Pulse - Home and load T0 - can be used in Start GCode to load the first filament
6th Pulse - Unload current filament - can be used in the End GCode to unload the last used filament
7th Pulse - Home Only (no filament movements)
8th Pulse - Move to "Next" Filament
9th Pulse - Move to "Random" Filament
No additional commands are supported. Commands 1 through 5 can be either two or three button presses, depending on if they need to unload the previous filament first. The first press is the command itself, which will pulse to indicate the command, the optional 2nd press is to unload the filament if needed, and the final required press is to load the filament. The 6 pulse command always take two presses to complete, the first to select the command and the second to unload the filament. The Mk4 also supports the Auto 3DClippy servo filament cutter and will automatically be initiated if it is present. Because of the cutter code being present in the firmware, there will always be a 2 second delay between a command and the unloading of any filament. This 2 seconds pause is when the Servo is actuated for the filament cutter. In addition, and optional OLED display can be plugged into the main board to display the current status of the 3DChameleon.