Marlin X2 firmware

From RepRap
Revision as of 07:24, 18 July 2015 by Glenn (talk | contribs) (wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Crystal Clear action run.png
Marlin X2

Release status: active

No image available.png
Description
A Marlin-based firmware with advanced features for multiple extruder machines
License
GPL
Author
Contributors
Based-on
[[ Marlin]]
Categories
CAD Models
External Link


This firmware was created to develop advanced features for multiple extruder machines. Some of the changes have already been merged to mainstream Marlin others will hopefully make it there in the future. The latest version of the Marlin X2 firmware is available on Github: http://github.com/dob71/MarlinX2
It is based on Marlin mod for RepRap X2. As of Marlin X2 v1.1.0 the mainstream (RC2) changes up to March 2013 were merged in, then on top of that the following features were implemented:

  • Dual X or Y drive machines support;
  • M322 the "follow me" mode command;
  • M331/M332 (position save/restore commands);
  • M340 (filament compression compensation) command;
  • All setup commands take 'T' parameter;
  • Acceleration and retract_acceleration are now saved in EEPROM;
  • Failsafe for M109, M104 H and L options;
  • Introduced new optional output format for M105, M109 and M190;
  • Added option to disable human readable output during printing.


The history of changes from original Marlin repository is preserved, therefore merges back and forth can be performed. The default configuration file is for RepRap X2V3, but there are example configuration files for standard single extruder printers and RepRap X2 machines on branches "one_e" and "x2".

Majority of the features introduced in older versions of Marlin X2 firmware are already either merged or implemented in the mainstream, but some are still only available in Marlin X2. Examples of such features are:

  • storing extruder offsets in EEPROM;
  • configuring MAX_E_JERK, steps/mm, acceleration individually for each extruder;
  • M109 option to wait for all hotends to reach target temperature;

and probably more...

Dual X/Y drive machines support
That feature was introduced to support machines like RepRap X2V3 that have independently moving carriages for hotends on X or Y axis. The feature can be enabled by uncommenting DUAL_X_DRIVE or DUAL_Y_DRIVE defines in Configuration.h. If other than RepRap X2V3 electronics modifications are used the pins for controlling the secondary extruder carriage motor driver and its hotend fan have to be specified (in the pins.h file). Several defines that previously were "one-per-axis" have to be commented out and their dual axis equivalent used if the feature is enabled. For example, X0_HOME_DIR and X1_HOME_DIR are to be used instead of X_HOME_DIR when DUAL_X_DRIVE support is on. The default configuration is for the RepRap X2V3 machines. The detailed explanation for all the related configuration defines is available in the configuration files ( Configuration.h and " Configuration_adv.h ).

M322 the "follow me" mode command
The "follow me" mode command, turns the "follow me" mode on or off for extruders (T<extruder> S<1-on/0-off>). The feature is designed for simultaneous printing from multiple identical extruders. The mode has to be "off" (0) for the active extruder. The extruders that have the mode set to "on" (1) repeat moves of the active extruder. The command also has H, F and M options for turning on/off "follow me heater" (H), "follow-me fan" (F) and "reverse" (R) modes. When the former 2 modes are "on" the temperature and fan setting changes of the active extruder are applied to the followers too. When the "reverse" mode is "on" the follower's carriage inverses the direction of the replicated moves on the shared axis. That results in printing of a mirror copy of the object. For example, that can be used to print left and right extruder parts for the printer simultaneously. Note, that "follow me" works by repeating the steps, therefore it requires identical extruders and filament. In the case of the dual drive machine identical pulleys and timing belts for both hotend carriages are to be used.

Position save/restore commands
M331 command saves current position coordinates (all axes including E, of the active extruder). It takes option S<SLOT> that specifies 0-based memory slot number to save into (defaults to 0).
M332 command restores the saved by M331 coordinates to the currently active extruder (not necessarily the same the coordinates were saved for). The options X<0|1>, Y<0|1>, Z<0|1> and E<0|1> can be used to ignore some of the axis (ignore by setting the option value to 0). The option F<SPEED> tells the command to make a move to the restored position at the speed specified. If 'F' is not used the restored coordinates set as current position and no move is made. The option S<SLOT> specifies memory slot to restore from.
The number of slots available is configured by NUM_POSITION_SLOTS define in Configuration_adv.h.

Compression compensation

X2 ccomp.jpg

M340 allows to set up the filament compression compensation table. The table used by the firmware to approximate how much filament is going to be squeezed in the filament drive tube when machine is printing at the specific speed. The faster the printing speed the harder it is to push the filament through the hotend and more of it is compressed inside the tube. The default configuration acceleration and speed are tuned for very fast acceleration and relatively low maximum printing speed (40-50mm/sec). Because of that the acceleration phase is extremely short and the printing speed stays relatively stable during the moves. However, the speed has to be slowed down a lot when "cooling" is activated or the configuration is changed to slower the acceleration in order to achieve faster maximum printing speed. That's when the feature can help to improve the print quality. It is however quite hard to configure properly and it is often simply physically impossible for the hardware to adjust the filament position fast enough.
Here is an example of the filament compression compensation table:

#define C_COMPENSATION  {{0.1, 0.3}, {0.1, 0.3}}, \
                        {{0.5, 0.9}, {0.5, 0.9}}, \
                        {{1.0, 1.2}, {1.0, 1.2}}, \
                        {{3.0, 2.0}, {3.0, 2.0}}

Both extruders are configured identically. For the speed 0.1mm/sec extra 0.3mm of the filament should be pushed into the tube, for 0.5mm/sec that extra filament length should be 0.9mm and so on. The effect one can see is shown in the picture on the right. The normal printing speed there is slowed down for cooling when the vertical columns are to be printed. There is visible excess of plastic extruded printing the first layer of the 2 smallest columns without filament compression compensation (1). That excess amount of plastic is noticeably smaller when the feature is enabled (2).
At the moment of this writing the filament compression compensation code is still in the experimental stage. There are several additional (that can potentially be eliminated in the future) configuration options for the feature in the Configuration.h and Configuration_adv.h). For example it can be configured to adjust the extra filament pushed to the guiding tube basing only on the nominal speed of the moves, or it can continuously do it during the acceleration/deceleration phase of each move. Additional details about all related configuration options can be found in the configuration files.


Various command changes
Some of the configuration commands used to require changing the active extruder to modify its settings. Starting with the version 1.1.0 all the commands that can change extruder specific settings can take 'T' parameter for choosing the extruder the setting applies to. For example:

    M92 T0 E661.78
    M203 T0 E23.00
    M201 T1 E5000
    M204 T0 S3000.00 R60000.00
    M205 T1 E17.00
    M218 T1 X0.00 Y-0.05

All the above examples apply setting to the specified extruder, but the active extruder stays unchanged. As of this writing the complete list of commands accepting 'T' parameter for choosing extruder includes:

    M92  - Set axis_steps_per_unit.
    M104 - Set extruder target temp (use T# to explicitly specify extruder, 
           H<deg> and L<deg> can be used to increase/decrease the target temperature).
           Note: increase/decrease is allowed only once unless opposite operation is 
                 performed before more attempts are made.
    M105 - Read current temp (use A1 to read for all extruders, T# for specific one).
    M106 - Fan on (use T# for dual drive machines to tun the fan on/off for specific 
           extruder, A1 for all).
    M107 - Fan off (use T# for dual drive machines to tun the fan on/off for specific 
           extruder, A1 for all).
    M109 - Wait for extruder to reach target temp (use A1 to wait for all extruders, 
           W<sec> to change dwell time).
    M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000).
    M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 
           E10000) in mm/sec.
    M204 - Set default acceleration: S normal moves, R filament only moves (M204 S3000 R7000) 
           im mm/sec^2, also sets minimum segment time in ms (B20000) to prevent buffer 
           underruns and minimum feedrate (M20), T sets the extruder R applies to.
    M205 - Advanced settings: minimum travel speed S=while printing V=travel only,  
           B=minimum segment time X=maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk 
           (for retracts), T=extruder option E applies to
    M206 - Set additional homeing offset.
    M218 - Set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>.
    M322 - Turn the "follow me" mode on or off for an extruder (parameters: T<extruder>  S<1-on/0-off>), 
           it's automatically off for the active extruder. If used without S parameter prints current 
           settings. If used without T parameter applies to all extruders.
    M340 - Set filament compression (bowden filament drive) compensation table parameters. P<0-N> - table 
           entry position, S<speed> - E speed in mm/sec, C<compensation> - length (in mm) 
           of the filament compressed in the guiding tube when extruding at the given speed. The table 
           entries should be ordered by E speed value. Set E speed to 0 for the last entry if need 
           less that max size entries.

Note that the above modifications required changing the options that previously used 'T' for other purposes. M205 now uses 'V' for minimum travel feedrate and M204 now uses 'R' for the retract acceleration.

The retract acceleration ('R' option of the M204 command) settings are now stored in EEPROM.

The option 'R' of M301 command sets the range (off of the target temperature) where the PID algorithm is to be used. Outside of that range the temperature control is done with simple ON/OFF logic.

The option A can be used to turn on multiple extruder output format for commands M105, M109 and M190 (can be useful for the host software). When it is enabled (A1), the active extruder is always listed first. The current and target temperatures are displayed for all the extruders and the heated bed. Example:

    SENDING:M105 A1
    ok T0:19/0 T1:19/0  B:19/0

The human readable (those pre-pended by "echo:") printouts can now be disabled during printing (see NO_ECHO_WHILE_PRINTING define in Configuration.h). The debug flags (changed by "M504" command") can be used to re-enable them without re-compiling the firmware.