Close

[A][T] Improved start-gcode. Marlin AutoMix colours?

A project log for Coaxial8or [gd0144]

Full-colour FFF? Multi-materials with unparalleled interlayer bond strength? Abrasives without abrasion?

kelvinakelvinA 10/04/2024 at 19:210 Comments

I've been able to improve the start gcode and figure out how to get the filament colours to display. The code...

M140 S[first_layer_bed_temperature] ; Start preheating the bed
M104 S[first_layer_temperature]     ; Start heating nozzle

G28                                 ; Home
G0   Z15 F1200

M190 S[first_layer_bed_temperature] ; Wait for bed to reach temp
M109 S[first_layer_temperature]     ; Wait for nozzle to reach temp

G28  Z                              ; Home Z axis

; Virtual Tool Setup
T0

; Filament: [filament_preset_15]
[filament_notes_15]
M164 S15

; Filament: [filament_preset_14]
[filament_notes_14]
M164 S14

; Filament: [filament_preset_13]
[filament_notes_13]
M164 S13

; Filament: [filament_preset_12]
[filament_notes_12]
M164 S12

; Filament: [filament_preset_11]
[filament_notes_11]
M164 S11

; Filament: [filament_preset_10]
[filament_notes_10]
M164 S10

; Filament: [filament_preset_9]
[filament_notes_9]
M164 S9

; Filament: [filament_preset_8]
[filament_notes_8]
M164 S8

; Filament: [filament_preset_7]
M165 O1
M164 S7

; Filament: [filament_preset_6]
M165 N1
M164 S6

; Filament: [filament_preset_5]
M165 M1
M164 S5

; Filament: [filament_preset_4]
M165 L1
M164 S4

; Filament: [filament_preset_3]
M165 D1
M164 S3

; Filament: [filament_preset_2]
M165 C1
M164 S2

; Filament: [filament_preset_1]
M165 B1
M164 S1

; Filament: [filament_preset_0]
M165 A1
M164 S0 

; Extruder Priming Setup
T[current_extruder]
G0 X0 Y0 Z0.5 F9000
M83 ; Extruder Relative mode
G1 Y305 E48 F600
G0 X0.5
G1 Y0 E48
G1 E-2 ; Retract
G92 E0 ; 
;Prime Finished

M204 P2400

...produces:

[...]
; Filament: cr600s.All
M165 A1 B1 C1 D1 L1 M1 N1 O1
M164 S9

; Filament: tmp.magentaBlack
M165 L1 N1
M164 S8

; Filament: petg.Transparent
M165 O1
M164 S7

; Filament: petg.Black
M165 N1
M164 S6

; Filament: petg.Copper
M165 M1
M164 S5

; Filament: petg.Magenta
M165 L1
M164 S4

; Filament: petg.TransBlue
M165 D1
M164 S3

; Filament: petg.Mint
M165 C1
M164 S2

; Filament: petg.Yellow
M165 B1
M164 S1

; Filament: petg.White
M165 A1
M164 S0 

; Extruder Priming Setup
T8
; Priming nozzle
G0 X0 Y0 Z0.5 F9000
M83 ; Extruder Relative mode
G1 Y305 E48 F600
G0 X0.5
M73 P1 R31
G1 Y0 E48
G1 E-2 ; Retract
M73 P3 R31
G92 E0 ; 
;Prime Finished

M204 P2400
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
; Filament: tmp.magentaBlack
T8
[...]

 This utilises the filament_notes field to store the mixes, and uses the toolchange-gcode to make filament name comments:

; Filament: [filament_preset_[next_extruder]]

 With this, PushPull should work correctly. Before, the mix was changed only after the tool was, so the first change to a new virtual tool would have an incorrect PushPull event. Additionally, a user wouldn't be able to change the mixes during the print.

Marlin feature idea - AutoMix

While my gcode changes hopefully reduce my issue list, it likely isn't sustainable for more than a handful of virtual filaments and it would be more ideal for the slicer to just tell the firmware what colour and transparency is desired. For this, it would need to know:

With this feature, the firmware can be the one to worry what channel white filament is in and the ratios needed to produce "#9A9F". This would also open the realm to automatic backup channels, such as loading 3 half-spools of black filament for a large print. 

Understandably, the order of filaments is still important for the end result to look correct. Perhaps there should be a warning if one of the Automix colours has notably higher luminosity than a channel that's further into the extruded material.

Discussions