admin 本站



* Select the serial port on the board to use for communication with the host.

 * This allows the connection of wireless adapters (for instance) to non-default port pins.

 * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader.


 * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] 



#define SERIAL_PORT 0



 * Select a secondary serial port on the board to use for communication with the host.

 * This allows the connection of wireless adapters (for instance) to non-default port pins.

 * Serial port -1 is the USB emulated serial port, if available.


 * :[-1, 0, 1, 2, 3, 4, 5, 6, 7]



//#define SERIAL_PORT_2 -1



 * This setting determines the communication speed of the printer.


 * 250000 works in most cases, but you might try a lower speed if

 * you commonly experience drop-outs during host printing.

 * You may try up to 1000000 to speed up SD file transfer.


 * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]





#define BAUDRATE 250000


// Enable the Bluetooth serial interface on AT90USB devices

//蓝牙模块,如果可以去掉 //,打开此功能

//#define BLUETOOTH


// The following define selects which electronics board you have.

// Please choose the name from boards.h that matches your setup

//主板选择,在Marlin2.0固件文件夹根目录 Marlin\src\pins,文件名pins_MKS_BASE填入下方 BOARD_xxx_xxx。不同主板pins_文件名不一样。





// Optional custom name for your RepStrap or other custom machine

// Displayed in the LCD "Ready" message

//可以在“ ”内填入打印机的品牌。但只会在机械按键的(LCD)屏,开机才能显示。

//#define CUSTOM_MACHINE_NAME "STJ-3dprinter"


//可以在“ ”内填入打印机的ID

//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"


// This defines the number of extruders

// :[1, 2, 3, 4, 5, 6]




#define EXTRUDERS 1


// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc.





// For Cyclops or any "multi-extruder" that shares a single nozzle.


//举例:2进1出非混色机型,3进1出非混色机型,5进1出非混色机型,6进1出非混色机型,去掉前面 //

//#define SINGLENOZzlE




 * "Mixing Extruder"  虚拟挤出机


需去掉 #define MIXING_EXTRUDER 前面的 //

 *   - Adds G-codes M163 and M164 to set and "commit" the current mix factors.

 *   - Extends the stepping routines to move multiple steppers in proportion to the mix.

 *   - Optional support for Repetier Firmware's 'M164 S<index>' supporting virtual tools.

 *   - This implementation supports up to two mixing extruders.

通过M163 设定混合比例,M164 保存到指定虚拟挤出机。



M163 S0 P6  

M163 S1 P4

M164 S0 

// M163 S0 P6   指虚拟挤出机S0  挤出率为60%

// M163 S1 P4   指虚拟挤出机S1  挤出率为40%

// M164 S0  以上两个虚拟挤出机 S0+S1=100% ,定义为挤出机1 并保存

M163 S0 P9

M163 S1 P1

M164 S1 

// M163 S0 P9   指虚拟挤出机S0  挤出率为90%

// M163 S1 P1   指虚拟挤出机S1  挤出率为10%

// M164 S1  以上两个虚拟挤出机 S0+S1=100% ,定义为挤出机2 并保存


 在Simplify3d的切片软件中,最多支持6个挤出机,即 M164 S0(S1、S2、S3、S4、S5)


M166 是marlin2.0新增的梯度渐变混色指令,通常与 M163、M164 配合使用。

举例:已知一个模型的高度为100mm, 开始渐变高度0mm, 结束渐变高度100mm.

M166 A0 Z100 I0 J1 S1

A0  指在0mm高度开启渐变混色

Z100 指在100mm高度结束渐变混色

I0 指调用M164 S0 的混色配比

J1 指调用M164 S1 的混色配比

S1 指开启梯度渐变功能 / S0禁用梯度渐变功能

M165 为专色混色配比指令(不与M163 M164一起使用),最多支持6个虚拟挤出机


6个颜色混合  M165 A1 B1 C1 D1 H1 I1 (各挤出机挤出率:1/6)

5个颜色混合  M165 A1 B1 C1 D1 H1 (各挤出机挤出率:1/5)

3个颜色混合  M165 A1 B1 C1  (各挤出机挤出率:1/3)

2个颜色混合  M165 A1 B1  (各挤出机挤出率:1/2)

 *   - Enable DIRECT_MIXING_IN_G1 for M165 and mixing in G1 (from Pia Taubert's reference implementation).




  #define MIXING_STEPPERS 2        // 设定虚拟挤出数量,最多6个

  #define MIXING_VIRTUAL_TOOLS 16  //  M163 and M164 混合工具数16个

  //#define DIRECT_MIXING_IN_G1    //  去掉 // 开启M165混色功能 ABCDHI

  //#define GRADIENT_MIX           // 去掉 // 开启M166梯度混色功能


    //#define GRADIENT_VTOOL       // 去掉 // 开启M166梯度混色,调用多个虚拟挤出机功能




//温度选择 0为禁用,1选用100K热敏电阻

#define TEMP_SENSOR_0 1  //开启挤出机1加热功能,热敏电阻100k

#define TEMP_SENSOR_1 0  //开启挤出机2加热功能(适用2进2出机型),热敏电阻100k

#define TEMP_SENSOR_2 0  //开启挤出机3加热功能(适用3进3出机型),热敏电阻100k

#define TEMP_SENSOR_3 0  //开启挤出机4加热功能(适用4进4出机型),热敏电阻100k

#define TEMP_SENSOR_4 0  //开启挤出机5加热功能(适用5进5出机型),热敏电阻100k

#define TEMP_SENSOR_5 0  //开启挤出机6加热功能(适用6进6出机型),热敏电阻100k

#define TEMP_SENSOR_BED 1  //开启热床加热功能,热敏电阻100k



// Extruder temperature must be close to target for this long before M109 returns success

//   加热挤出头并接近M109 S(温度设定值)时的延时动作。

#define TEMP_RESIDENCY_TIME 10  // 单位秒,延时10秒钟

#define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one

#define TEMP_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.


// Bed temperature must be close to target for this long before M190 returns success

// 加热热床并接近M190 S(温度设定值)时的延时动作。

#define TEMP_BED_RESIDENCY_TIME 10  // 单位秒,延时10秒钟

#define TEMP_BED_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one

#define TEMP_BED_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.


// The minimal temperature defines the temperature below which the heater will not be enabled It is used

// to check that the wiring to the thermistor is not broken.

// Otherwise this would lead to the heater being powered on all the time.


#define HEATER_0_MINTEMP 5

#define HEATER_1_MINTEMP 5

#define HEATER_2_MINTEMP 5

#define HEATER_3_MINTEMP 5

#define HEATER_4_MINTEMP 5

#define HEATER_5_MINTEMP 5

#define BED_MINTEMP 5


// When temperature exceeds max temp, your heater will be switched off.

// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!

// You should use MINTEMP for thermistor short/failure protection.


#define HEATER_0_MAXTEMP 275

#define HEATER_1_MAXTEMP 275

#define HEATER_2_MAXTEMP 275

#define HEATER_3_MAXTEMP 275

#define HEATER_4_MAXTEMP 275

#define HEATER_5_MAXTEMP 275

#define BED_MAXTEMP 150


//========================== PID Settings ================================


// PID Tuning Guide here:

// Comment the following line to disable PID and enable bang-bang.


#define PIDTEMP

#define BANG_MAX 255     // MOS管输出电流阈值0~255

#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current

#define PID_K1 0.95      // Smoothing factor within any PID loop


  //#define PID_EDIT_MENU         // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)

  //#define PID_AUTOTUNE_MENU     // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)

  //#define PID_DEBUG             // Sends debug data to the serial port.

  //#define PID_OPENLOOP 1        // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX

  //#define SLOW_PWM_HEATERS      // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay

  //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)

                                  // Set/get with gcode: M301 E[extruder number, 0-2]

  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature

                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.


  // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it



//40W加热棒:Kp 20.78  Ki 1.57  Kd 68.94

//50W加热棒:Kp 14.63  Ki 0.98  Kd 54.53

//24v40w加热棒电阻:14.4 Ω

//24v50w加热棒电阻:11.52 Ω

//12v40w加热棒电阻:3.6 Ω

//12v50w加热棒电阻:2.88 Ω


  // Ultimaker


  #define DEFAULT_Kp 22.2

  #define DEFAULT_Ki 1.08

  #define DEFAULT_Kd 114


  // MakerGear

  //#define DEFAULT_Kp 7.0

  //#define DEFAULT_Ki 0.1

  //#define DEFAULT_Kd 12


  // Mendel Parts V9 on 12V

  //#define DEFAULT_Kp 63.0

  //#define DEFAULT_Ki 2.25

  //#define DEFAULT_Kd 440


#endif // PIDTEMP



//============================= PID > Bed Temperature Control ===============




 * PID Bed Heating


 * If this option is enabled set PID constants below.

 * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis.


 * The PID frequency will be the same as the extruder PWM.

 * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz,

 * which is fine for driving a square wave into a resistive load and does not significantly

 * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W

 * heater. If your configuration is significantly different than this and you don't understand

 * the issues involved, don't use bed PID until someone else verifies that your hardware works.



//#define PIDTEMPBED





 * Max Bed Power

 * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis).

 * When set to any value below 255, enables a form of PWM to the bed that acts like a divider

 * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED)


#define MAX_BED_POWER 255 // 最大电流输出阈值; 255=全功率输出




  //#define PID_BED_DEBUG // Sends debug data to the serial port.


  //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)

  //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)

  #define DEFAULT_bedKp 10.00

  #define DEFAULT_bedKi .023

  #define DEFAULT_bedKd 305.4


  //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)

  //from pidautotune

  //#define DEFAULT_bedKp 97.1

  //#define DEFAULT_bedKi 1.41

  //#define DEFAULT_bedKd 1675.16


  // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.

#endif // PIDTEMPBED


// @section extruder



 * Prevent extrusion if the temperature is below EXTRUDE_MINTEMP.

 * Add M302 to set the minimum extrusion temperature and/or turn

 * cold extrusion prevention on and off.





//如果前方加上// ,则在不加热的情况下也可以激活挤出机,让其转动





 * Prevent a single extrusion longer than EXTRUDE_MAXLENGTH.

 * Note: For Bowden Extruders make this large enough to allow load/unload.







//======================== Thermal Runaway Protection ======================




 * Thermal Protection provides additional protection to your printer from damage

 * and fire. Marlin always includes safe min and max temperature ranges which

 * protect against a broken or disconnected thermistor wire.


 * The issue: If a thermistor falls out, it will report the much lower

 * temperature of the air in the room, and the the firmware will keep

 * the heater on.


 * If you get "Thermal Runaway" or "Heating failed" errors the

 * details can be tuned in Configuration_adv.h






#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders

#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed


// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics

// either in the usual order or reversed

//#define COREXY  //如果是corexy机型,可删除前面的 //

//#define COREXZ

//#define COREYZ

//#define COREYX

//#define COREZX

//#define COREZY


//============================ Endstop Settings ===========================



// @section homing


// Specify here all the endstop connectors that are connected to any endstop or probe.

// Almost all printers will be using one per axis. Probes will use one or more of the

// extra connectors. Leave undefined any used for non-endstop and non-probe purposes.







//#define USE_XMAX_PLUG

//#define USE_YMAX_PLUG

//#define USE_ZMAX_PLUG


// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).

// false值限位开关电位选择:限位开关的C,接主板的S;限位开关的NC,接主板的5V。

// true值限位开关电位选择:限位开关的C,接主板的S;限位开关的NO,接主板的G。

#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.

#define Y_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.

#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.

#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.

#define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.

#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.

#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe.



 * With this option each E stepper can have its own factors for the

 * following movement settings. If fewer factors are given than the

 * total number of extruders, the last value applies to the rest.






 * Default Axis Steps Per Unit (steps/mm)

 * Override with M92

 *                                      X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]



#define DEFAULT_AXIS_STEPS_PER_UNIT   { 80, 80, 400, 95 }



#define DEFAULT_MAX_FEEDRATE          { 300, 300, 5, 25 }



 * Default Max Acceleration (change/s) change = mm/s

 * (Maximum start speed for accelerated moves)

 * Override with M201

 *                                      X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]



#define DEFAULT_MAX_ACCELERATION      { 3000, 3000, 100, 10000 }



#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E 打印时的最大加速度

#define DEFAULT_RETRACT_ACCELERATION  3000    // E 回抽时的最大加速度

#define DEFAULT_TRAVEL_ACCELERATION   3000    // X, Y, Z  空架移动时的最大加速度



 * Default Jerk (mm/s)

 * Override with M205 X Y Z E


 * "Jerk" specifies the minimum speed change that requires acceleration.

 * When changing speed and direction, if the difference is less than the

 * value set here, it may happen instantaneously.




  #define DEFAULT_XJERK 10.0

  #define DEFAULT_YJERK 10.0

  #define DEFAULT_ZJERK  0.3



// @section machine


// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.

// 此项可改变XYZ电机的转向,false 改 true , 电机发生反转。反之也一样。

#define INVERT_X_DIR false

#define INVERT_Y_DIR true

#define INVERT_Z_DIR false


// @section extruder


// For direct drive extruder v9 set to true, for geared extruder set to false.

// 此项可改变E电机的转向,false 改 true , 电机发生反转。反之也一样。

#define INVERT_E0_DIR false

#define INVERT_E1_DIR false

#define INVERT_E2_DIR false

#define INVERT_E3_DIR false

#define INVERT_E4_DIR false

#define INVERT_E5_DIR false


// Direction of endstops when homing; 1=MAX, -1=MIN

// :[-1,1]


#define X_HOME_DIR -1

#define Y_HOME_DIR -1

#define Z_HOME_DIR -1


// The size of the print bed


#define X_BED_SIZE 200

#define Y_BED_SIZE 200


// Travel limits (mm) after homing, corresponding to endstop positions.


#define X_MIN_POS 0

#define Y_MIN_POS 0

#define Z_MIN_POS 0



#define Z_MAX_POS 200





 * Select the language to display on the LCD. These languages are available:


 *    en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it,

 *    jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test


 * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' }



#define LCD_LANGUAGE en





 * SD Card support is disabled by default. If your controller has an SD slot,

 * you must uncomment the following option or it won't work.




//#define SDSUPPORT


//=======================   LCD / Controller Selection  =======================

//=========================      (Graphical LCDs)      ========================




// CONTROLLER TYPE: Graphical 128x64 (DOGM)

// IMPORTANT: The U8glib library is required for Graphical Display!



// RepRapDiscount FULL GRAPHIC Smart Controller



C:\Program Files (x86)\Arduino\libraries\U8G文件夹内。



//============================ Extra Features ===========================



 * RGB LED / LED Strip Control


 * Enable support for an RGB LED connected to 5V digital pins, or

 * an RGB Strip connected to MOSFETs controlled by digital pins.


 * Adds the M150 command to set the LED (or LED strip) color.

 * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of

 * luminance values can be set from 0 to 255.

 * For Neopixel LED an overall brightness parameter is also available.


 * *** CAUTION ***

 *  LED Strips require a MOSFET Chip between PWM lines and LEDs,

 *  as the Arduino cannot handle the current the LEDs will require.

 *  Failure to follow this precaution can destroy your Arduino!

 *  NOTE: A separate 5V power supply is required! The Neopixel LED needs

 *  more current than the Arduino 5V linear regulator can produce.

 * *** CAUTION ***


 * LED Type. Enable only one of the following two options.



//RGBW 四色可控LED输出,指令M150

//M150 R  ,0-255(红色灯)

//M150 U  ,0-255(绿色灯)

//M150 B  ,0-255(蓝色灯)

//M150 W  ,0-255(白色灯)

//#define RGB_LED

//#define RGBW_LED



  #define RGB_LED_R_PIN 34

  #define RGB_LED_G_PIN 43

  #define RGB_LED_B_PIN 35

  #define RGB_LED_W_PIN -1




 * R/C SERVO support


 * Sponsored by TrinityLabs, Reworked by codexmas



 * Number of servos


 * For some servo-related options NUM_SERVOS will be set automatically.

 * Set this manually if there are extra servos needing manual control.

 * Leave undefined or set to 0 to entirely disable the servo subsystem.


//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command


// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.

// 300ms is a good value but you can try less delay.

// If the servo can't reach the requested position, increase it.

#define SERVO_DELAY { 300 }


// Only power servos during movement, otherwise leave off to prevent jitter



// Allow servo angle to be edited and saved to EEPROM







交流群QQ:460937369 进群验证码:STJ