marlin固件sd卡最大支持

时间:2021-11-10 13:22:21 意向书

篇一:《Marlin 固件配置》

Marlin 固件配置

So,让我们开始吧。首先在Arduino IDE中打开Configuration.h,注意做好源文件的备份工作!!!

波特率 - 20行

#define BAUDRATE 250000

//#define BAUDRATE 115200

该行是用来决定主控板使用何种波特率来与电脑上的控制软件进行通信的。通常是用250K和115.2K两种波特率选择,要选择何种波特率,只要将该行前面的”//” 删除,不选择何种波特率只需要在该行前添加“//” (注意:不包括“”)。默认设置250K在Printrun/Pronterface 和 RepSnapper 里面运行都不错。(我用lubuntu + Pronterface 250K 连接不上的,115.2K 倒没有问题)。

主控板 – 49行

#ifndef MOTHERBOARD

#define MOTHERBOARD 33

#endif

你可以在注释里可以看到Marlin固件支持的主控板清单,通过修改#define MOTHERBOARD 这行的数字,选择对应的主板编号即可。上面这行是选择RAMPS 1.3 的意思,你可以按自己实际情况修改该项。Marlin 固件会根据主板信息定义主控板引脚布局。具体各种主控板的引脚布局可以在pin.h中看到。

Marlin 固件温控设置

现在我来看看温控方面的设置,温控设置有点复杂,但是我们不需要考虑那些复杂的PID计算设置问题。基本上我们需要做的是选择3D打印机机温度传感器的类型,如果不是你自己安装的温度传感器,你可以在RepRap wiki中了解温度传感器的类型。

热电调节器(热敏电阻) – 78 行

#define TEMP_SENSOR_0 1

#define TEMP_SENSOR_1 0

#define TEMP_SENSOR_2 0

#define TEMP_SENSOR_BED 1

如果你仔细阅读Marlin固件的配置文件,你会发现支持的固件所支持的温控传感器的类型对应的编号。TEMP_SENSOR_0是喷嘴的温控传感器类型、TEMP_SENSOR_BED是加热床的温控传感器类型,一般来说都是100K 热敏电阻。

如果你是用RAMPS 1.3 主控板和pin.h中使用默认布局的话,你可以在主控板的T0和T1 接口分别对应TEMP_SENSOR_0 和TEMP_SENSOR_BED。选择0即关闭该接口。请选择合适你打印机的温控传感器吧。

温度限制(最大值) – 99 行

#define HEATER_0_MAXTEMP 275

#define HEATER_1_MAXTEMP 275

#define HEATER_2_MAXTEMP 275

#define BED_MAXTEMP 120

有些喷嘴和加热床的最大工作温度会低于Marlin固件的默认最大温度,为了减少对喷嘴和加热床的损害,可以设置最高温度限制。

Marlin 固件的机械设定

机械设定部分包括限位开关、步进电机、最大制造范围和运动位移值。

限位开关和上拉电阻 这一节将教你配置3D 打印机每个轴中的限位开关。用G28

命令会让3D 打印机的3个轴回零方向运动直到碰到限位开关。限位开关如果没有5V 电源作为产生信号源的话,配置ENDSTOPPULLUPS 会确保让固件产生一个信号、当限位开关接通时才会产生明确的数字信号0。

如需了解更多请参考RepRap wiki 的(机械限位开关)Mechanical Endstop,OptoEndstop 2.1(光学限位开关) and Gen7 Endstop 1.3.1。(最好就是按机械开关的原理图来制作限位开关,这样的效果最好。)

限位开关上拉电阻总体控制–194行

// corse Endstop Settings

#define ENDSTOPPULLUPS //Comment this out (using // at the start of the line) to disable the endstoppullup resistors

Marlin固件默认是需要限位开关的上拉电阻的。从207行开始固件为每个限位开关分配独立一个上拉电阻,如果194行被取消则从197行开始的上拉电阻控制都会一并取消。这样方便你自己的3d 打印机采用不同类型的限位开关。一般来说X轴和Y 轴采用机械限位开关,可以不需要制作3线的数据口,而Z轴的光学开关默认为3线的数据口。这是光学开关就不需要使用到ENDSTOPPULLUPS注释。

限位开关上拉电阻细分控制 – 196行

#ifndef ENDSTOPPULLUPS

// fine Enstop settings: Individual Pullups.will be ignord if ENDSTOPPULLUPS is defined #define ENDSTOPPULLUP_XMAX

#define ENDSTOPPULLUP_YMAX

#define ENDSTOPPULLUP_ZMAX

#define ENDSTOPPULLUP_XMIN

#define ENDSTOPPULLUP_YMIN

//#define ENDSTOPPULLUP_ZMIN

#endif

如果Configuration.h194行被注释掉的话,则196行的语句将会被执行。你可以独立控制每个限位开关的上拉电阻,当然这个是要根据你3D 打印机的限位开关类型来确定. 限位开关方向控制 - 216 行

// The pullups are needed if you directlyconnect a mechanical endswitch between the signal and ground pins.

// set to true to invert the logic of theendstops.

const bool X_ENDSTOPS_INVERTING = false;

const bool Y_ENDSTOPS_INVERTING = false;

const bool Z_ENDSTOPS_INVERTING = false;

机械限位开关通常会把连线连在常通(NC) 端,这就会有个一个数字信号1输入到主控中。如果你的机械限位开关的连线是连在常关(NO)端,这就需要在ENDSTOPS_INVERTING采用 ture 从而是数字信号0反向变为1.对于光学开关来说,则一般不用进行调整。

你应该在电脑控制软件中实际试验一下限位开关的方向是否与你的预期相符,如果轴运动时触动限位开关就停止则说明,该项设置正常。注意!!!在做此测试时,应该给各个轴留出足够的运动反应空间。以免损坏机器。

关闭最大限位开关– 219 行

//#define DISABLE_MAX_ENDSTOPS

上述这行代码在marlin 固件Configuration.h(219行),通常情况下是被注释掉的。如果你的打印机的原点开关安装在X、Y、Z轴最大位置的话,这个就需要去掉注释符号。

通常情况下Z轴的限位开关是放在Z轴最大限位,这样可以使hot end 可以免受挤压。为了达到这个目的,这样就需要去掉注释。但是这行对于那些没有最大限位开关的主控板是没有用的哦!

关闭轴 – 228 行

// Disables axis when it’s not being used.

#define DISABLE_X false

#define DISABLE_Y false

#define DISABLE_Z true

#define DISABLE_E false // For all extruders

通常情况下上面的代码是不改动的,所有轴都是选择 false 的。然而,如果你的3D打印机z轴有手动调整的部件,可以在#define DISABLE_Z 行选 true ,这样在打印机打印时,可以手动调整z轴。

步进电机

我们已经来到了设置步进电机部分,这部分主要设置步进电机运行方向、限位开关逻辑、行程、步进长度单位。前面部分的限位开关已经测试好了,所以这部分的测试就相对简单很多了。

步进电机运转方向– 233行

#define INVERT_X_DIR true

#define INVERT_Y_DIR true

#define INVERT_Z_DIR true

#define INVERT_E0_DIR true

#define INVERT_E1_DIR false

#define INVERT_E2_DIR false

这部分是决定3d打印机各个轴的运行方向的,默认的选项不一定适合每一种打印机,所以我个人建议是先测试其他项目,最后才测试这部分。

这是当我们经过接口软件控制 3D立体打印机,我们哪里决定哪一个方向每个轴将会去。当我们将一个指令送到的时候驱使 +10 毫米前进一个轴,我们期待轴移动被期望的方向的 10 毫米。开始的高抬腿运步的马马达方向能难以没有打开打印机而且表演一个测试预测。因此我会建议离开这些设定直到最后的而且在以测试着手进行之前完成马林鱼固件结构的其它部分。

一经马林鱼固件结构文件被配置充足操作 3D立体打印机,你能运行一个测试检查每个轴搬进正确的方向。设定他们的完整旅行距离的每个轴中点然后打开打印机。在经过接口软件,像是 Printrun/pronterface 对 3D立体打印机连接之后,藉由慢跑他们积极的方向的10 毫米测试每个轴。对于每个轴的高抬腿运步的马马达旋转方向能藉由变更逻辑在马林鱼固件结构中从第233 行被改正。

你会需要也测试挤压机高抬腿运步的马马达方向。这能没有细丝被做装载而且带来热的达175 度的结束温度因此马林鱼固件将会允许挤出。送一经过 3D立体打印机接口软件挤出指令而且观察方向细丝驾驶齿轮滑车旋转。对于挤压机的旋转方向能藉由变更逻辑从第236 行被改正。

当第一次表演轴归巢和轴慢跑的时候,准备好按重新设定按钮或者准备好关掉电源避免撞碎的轴很重要。分开地回家每个轴确定轴正在向结束停止回家。如果你能达成结束停止容易地,在轴已经完成它之前,你能早引起他们为一个安全的测试是旅行。

结束停止家方向 - 第 242 行

// 设定 endstops 的方向当归巢; 1=最大, -1=最小

#定义 X_HOME_DIR-1

#定义 Y_HOME_DIR-1

#定义 Z_HOME_DIR 1

End Stop Home Direction – line 242

// Sets direction of endstops when homing; 1=MAX, -1=MIN{marlin固件sd卡最大支持}.

#define X_HOME_DIR -1

#define Y_HOME_DIR -1

#define Z_HOME_DIR 1

基本上你告诉结束停止开关被位于的轴结束的马林鱼固件。它是通常的对X 和 Y 轴到家至最大的积极位置的零位置和 Z 轴结束停止家的热结束。在上面的代码片断和对权利的图像表示结构。

像斜坡 1.3 的一些主板为每个轴的每个结束有一个联编者,总计六个联编者。你将会需要确定在比赛上面的设定结束停止和主板的关联。

Travel Limits – line 249 旅行极限 - 第 249 行

#define X_MAX_POS 130

#defineX_MIN_POS 0

#defineY_MAX_POS 130

#defineY_MIN_POS 0

#defineZ_MAX_POS 107

#defineZ_MIN_POS 0

上述者定义归巢后的 3D立体打印机的可印刷区域。对于 X 和 Y轴,你仅仅测量来自家位置的喷嘴的旅行长度。最大的旅行长度将会或被大小限制那建立月台或藉着轴的最大旅行距离。

当第一次建立 Z 轴的时候,设定 Z 轴旅行长度短于被测量的一点点最好,直到一个软件和3D立体打印机的硬件测试被完成。这将会帮助避免偶然地撞碎那在开始的测试期间把床加入热的结束。 Z 轴旅行长度可能是罚款调谐的比较迟的在测试已经被满意之后。

测量单位在毫米中而且为在马林鱼固件结构文件中的最大位置从第 249行被定义。最小的位置能被为这一个结构留在假设值 0 。

Steps Per Unit – line 275 步骤每一单位 - 第 275 行

#define DEFAULT_AXIS_STEPS_PER_UNIT {106.76, 106.76, 800, 48.14} 每一单位配置步骤将会是在你开始第一次印刷之前,你做的最后一点点之一的微调。有心机的步骤每一单位正确地将会给 3D立体印刷的分开最好的开始可能的。然而,如果你正在仅仅升级马林鱼固件或者正在从任何其他的固件升级,如果你仍然有它,你能每一来自旧的结构文件的单位身材得到步骤。

每一单位的步骤意谓数字行走一个高抬腿运步的马马达必须准备等于 1 毫米轴旅行。 单位在马林鱼固件 configuration.h 文件的第 275 行在 X 、 Y 的次序中,Z 和每一来自相同的设计的另一台打印机的单位得到步骤的 E. 会到你需要的非常接近, 而且将会帮助你进行一些高抬腿运步的马马达测试在你之前认真开始每一单位计算正确的步骤为马林鱼固件结构文件。

步骤每一单位计算

为了要每一单位 (毫米) 计算步骤提出马林鱼固件结构文件,你需要找一个好方法正确地测量轴旅行距离。你可能对暂时的距离有热的结束,以便细丝能被挤出为了要制造测量。代替热的结束和被以带子绑起到床的一个尺使用一个刻度盘指示器能对标准的到处旅行的距离提供一个好正确的方法。得到最好的准确性你应该抽取样品至少 100 毫米的轴旅行。 你命令打印机使用接口软件,像是 Pronterface 移动被选择的轴100 毫米。你然后测量真实的距离轴到处旅行的。在你下面使用公式能每一单位计算新的步骤。

teps 每一单位公式

NewStepsPerUnit=SampleTravelDist/ ActualTravelDist x OldStepsPerUnit

你然后重复上述的公式同样地许多次当做必需的直到被命令的旅行距离相配真实的距离到处旅行的,每次以 NewStepsPerUnit 作为 OldStepsPerUnit。

Adding LCD Support – line 303 增加 LCD 支持 - 第 303 行

#define ULTRA_LCD

要定义的 ULTRA_LCD 需要中使任何类型的 LCD 支持能够。为了要增加对 16 × 2个 LCD 展览的支持,第 303 行需要在上面像代码片断被不批评,藉由除去前述的向前斜线。 预先设定地,马林鱼固件没有LCD 或者按编码器控制嵌板使。能够 促成第 303 行和无别的将会给你为被连接到主板大头针如 pins.h 文件所分配的 16 × 2个 LCD 荧屏支援。大头针任务在被支援主板类型的在每个下面的固件pins.h 文件中被发现。

增加点击编码器支持

有能为斜坡 1.3 会被能够的二流行点击编码器控制嵌板的类型。第一个类型是Ultipanel,能在 Thingiverse 上被发现,而且另一个类型是 RepRapDiscount 的控制器。对于这一个引导者,我仅仅正在去为Ultipanel 增加笔记因为另一个类型为固件被 RepRapDiscount RepRap wiki 支援。

EnablingULTIPANEL – line 307 促成 ULTIPANEL- 第 307 行

#defineULTIPANEL

EnablingNEWPANEL – line 331 促成 NEWPANEL- 第 331 行

#define NEWPANEL

两者的第 307 和 331 行不预先设定地被能够。为了要使 20 × 4个 LCD 展览和点击编码器能够, 不批评两者线藉由除去向前的斜线。这也也会使 SD 卡片支持能够, 一个将会在另外的一个引导者被复盖的特征。如果第 307 行藉由不批评被能够,不批评第 303 行将不会是必需的。当 ULTIPANEL 被定义的时候, ULTRA_LCD 将会自动地被定义。

篇二:《Marlin固件全中文解析》

3D打印机——Marlin固件全中文解析 #ifndef CONFIGURATION_H #define CONFIGURATION_H // This configuration file contains the basic settings. // Advanced settings can be found in Configuration_adv.h // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration

//////////基本设置包括:主板类型,温度传感器类型,轴设置,限位开关配置 //=========================================================================== //============================= DELTA Printer =============================== //=========================================================================== // For a Delta printer replace the configuration files with the files in the // example_configurations/delta directory. //

//////////对于三角洲并联打印机,请找到固件里“example_configurations”文件夹下的“delta”子文件夹,并将其中的Configuration.h和Configuration_adv.h两个头文件拷贝到固件文件夹下,替换原先固件里的这两个头文件,并针对delta打印机作相应参数配置。 // User-specified version info of this build to display in [Pronterface, etc] terminal window during // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // build by the user have been successfully uploaded into firmware. #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. // Serial port 0 is still used by the Arduino bootloader regardless of this setting. #define SERIAL_PORT 0

//////////选择用于和上位机通讯的串口,该值请保持0不动

// This determines the communication speed of the printer

// This determines the communication speed of the printer #define BAUDRATE 250000

//////////波特率配置,该值必须和你的上位机波特率相匹配,否则无法通讯。常用波特率有115200和250000

// This enables the serial port associated to the Bluetooth interface //#define BTENABLED // Enable BT interface on AT90USB devices //// The following define selects which electronics board you have. Please choose the

one that matches your setup // 10 = Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics" // 11 = Gen7 v1.1, v1.2 = 11 // 12 = Gen7 v1.3 // 13 = Gen7 v1.4 // 2 = Cheaptronic v1.0 // 20 = Sethi 3D_1 // 3 = MEGA/RAMPS up to 1.2 = 3 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed) // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed) // 35 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan) // 4 = Duemilanove w/ ATMega328P pin assignment // 5 = Gen6 // 51 = Gen6 deluxe // 6 = Sanguinololu < 1.2 // 62 = Sanguinololu 1.2 and above // 63 = Melzi // 64 = STB V1.1 // 65 = Azteeg X1 // 66 = Melzi with ATmega1284 (MaKr3d version) // 67 = Azteeg X3 // 68 = Azteeg X3 Pro // 7 = Ultimaker // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare) // 72 = Ultimainboard 2.x (Uses TEMP_SENSOR 20) // 77 = 3Drag Controller // 8 = Teensylu // 80 = Rumba // 81 = Printrboard (AT90USB1286) // 82 = Brainwave (AT90USB646) // 83 = SAV Mk-I (AT90USB1286) // 9 = Gen3+ // 70 = Megatronics // 701= Megatronics v2.0 // 702= Minitronics v1.0 // 90 = Alpha OMCA board // 91 = Final OMCA board // 301= Rambo // 21 = Elefu Ra Board (v3) // 88 = 5DPrint D8 Driver Board #ifndef MOTHERBOARD #define MOTHERBOARD 33

//////////主板类型选择,请按以上各主板相应代号选择你个人的主板类型。33是

ramps1.3/1.4(一个挤出机),34是ramps1.3/1.4(两个挤出机)

#endif // Define this to set a custom name for your generic Mendel, // #define CUSTOM_MENDEL_NAME "This Mendel" // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) // You can use an online service to generate a random UUID.

(eg ) // #define MACHINE_UUID "00000000-0000-0000-0000-000000000000" // This defines the number of extruders #define EXTRUDERS 1 //// The following define selects which power supply you have. Please choose the one that matches your setup // 1 = ATX // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC) #define POWER_SUPPLY 1 // Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it. // #define PS_DEFAULT_OFF //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== // //--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table // //// Temperature sensor settings: // -2 is thermocouple with MAX6675 (only for sensor 0) // -1 is thermocouple with AD595 // 0 is not used // 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) // 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) // 3 is Mendel-parts thermistor (4.7k pullup) // 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! // 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) // 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) // 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) // 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) // 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) // 10 is 100k RS thermistor 198-961 (4.7k pullup) // 11 is 100k beta 3950 1% thermistor (4.7k pullup) // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) // 20 is the PT100 circuit found in the Ultimainboard V2.x // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 // // 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k // (but gives greater accuracy and more stable PID) // 51 is 100k thermistor - EPCOS (1k pullup) // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)

// // 1047 is Pt1000 with 4k7 pullup // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup // 110 is Pt100 with 1k pullup (non standard) #define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 #define TEMP_SENSOR_BED 1

//////////上面这些值是温度传感器类型配置,是能否正常读取温度的重要参数。

TEMP_SENSOR_0是喷嘴温度传感器,TEMP_SENSOR_BED是热床温度传感器,配置为1说明两个都是100K ntc热敏电阻。如果你使用了其它温度传感器需要根据情况自行更改。如果没有,配置为0

// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted. //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 // Actual temperature must be close to target for this long before M109 returns success #define TEMP_RESIDENCY_TIME 10 // (seconds) #define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one

//////////这个值决定当实际温度在正负3度时被认为接近设定的目标温度。适当加大该值可以减少等待升温的时间,过大则对出丝不利,建议该值保持默认

#define TEMP_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 BED_MINTEMP 5

//////////以上几个配置是喷嘴和热床在温度低于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 BED_MAXTEMP 150

//////////以上是喷嘴和热床的最高温度配置,防止烧坏主板

// If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to

reduce the // average current. The value should be an integer and the heat bed will be turned on for 1 interval of // HEATER_BED_DUTY_CYCLE_DIVIDER intervals. //#define HEATER_BED_DUTY_CYCLE_DIVIDER 4

//////////该配置是为了防止热床电阻太小,长时间加热容易烧mos管,增加这个数字,可以防止mos管过热,但加热时间会增长 // If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS //#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=I^2/R //#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R

//////////如果你希望用M105命令实时查看挤出机和热床功率,请将这两行取消注释(即去掉代码前的//)

//////////PID温控配置,PID参数设置,需要根据系统情况设置,可以通过 M303 代码调用PID_autotune函数获得基本PID参数,然后参照修改下面的DEFAULT_Kp、DEFAULT_Ki、DEFAULT_Kd,例如:M303 E0 C8 S190,表示获取打印头0(第一个打印头)、目标温度190度、循环调用PID_autotune8次后的相应的PID参数。系统自动生成的PID参数相当不错,可保持默认。当然机器不同,也不一定都有效

// PID settings: // Comment the following line to disable PID and enable bang-bang. #define PIDTEMP #define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current #define PID_MAX 255 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #ifdef PIDTEMP //#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 PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term #define K1 0.95 //smoothing factor within the PID #define PID_dT ((OVERSAMPLENR * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // Ultimaker #define DEFAULT_Kp 22.2 #define DEFAULT_Ki 1.08 #define DEFAULT_Kd 114

篇三:《基于Marlin固件的3D打印机支持的G、M代码》

// 看这里的G代码描述:

//

//已被实施的代码

//-------------------

// G0 -> G1

// G1 - 协调运动 X Y Z E

// G2 - 顺时针旋转 ARC

// G3 - 逆时针旋转 ARC

// G4 - 暂停 S<seconds> or P<milliseconds>

// G10 - 按照M207的设置退丝

// G11 - retract recover filament according to settings of M208

// G28 - 所有轴归零

// G29 - 带着z轴的探针,进行复杂的归零。(按照在Auto bed leveling中的配置)要在G28之后执行才有效

// G30 - Single Z Probe, probes bed at current XY location.

// G90 - 使用绝对坐标系

// G91 - 使用相对坐标系

// G92 - 将当前位置设为给定值(例如:G92 X0 Y0 Z0,即可把当前位置强制设置为零点)

// M 代码

// M0 - 无条件停止 - 等待用户按LCD面板上的按钮(只有当ULTRA_LCD被使能的时候)

// M1 - 和M0相同

// M17 - 使能(锁死)所有的步进电机

// M18 - 取消使能(释放)所有的步进电机;与M84相同

// M20 - 列出SD卡的内容,通过串口发回

// M21 - 初始化SD卡

// M22 - 弹出SD卡

// M23 - 选择SD卡文件(M23 filename.g)

// M24 - 启动/恢复SD卡打印

// M25 - 暂停SD卡打印

// M26 - Set SD position in bytes (M26 S12345)

// M27 - 报告SD卡打印状态

// M28 - Start SD write (M28 filename.g)

// M29 - Stop SD write

// M30 - 删除SD卡文件 (M30 filename.g)

// M31 - Output time since last M109 or SD card start to serial

// M32 - Select file and start SD print (Can be used _while_ printing from SD card files): // syntax "M32 /path/filename#", or "M32 S<startpos bytes> !filename#"

// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).

// The '#' is necessary when calling from within sd files, as it stops buffer prereading // M42 - 通过指令M42 Px Sy来设置引脚x的值(0或1),省略参数Px的话,会默认为

配置led引脚。

// M80 - 开启电源供电

// M81 - 关闭电源供电

// M82 - 设定 E轴(挤丝量) 为绝对模式 (默认)

// M83 - 设定 E轴(挤丝量) 为相对模式 (G90)

// M84 - Disable steppers until next move,

// or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.

// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default) // M92 - Set axis_steps_per_unit - same syntax as G92

// M104 - 设置挤出头目标温度(开始加热到目标温度,但是不会等待,区别M109) // M105 - 读取当前温度{marlin固件sd卡最大支持}.

// M106 - 开启风扇

// M107 - 关闭风扇

// M109 - Sxxx 等待挤出头加热到目标温度. 只有在加热的时候才会等待

// Rxxx 等待挤出头加热到目标温度. 加热和冷却时都会等待

// M114 - 串口输出当前位置坐标

// M115 - 串口输出功能性字符串(该数据位于language.h 宏MSG_M115_REPORT下定义) // M117 - 显示信息到LCD面板

// M119 - 串口输出限位开关状态

// M126 - Solenoid Air Valve Open (BariCUDA support by jmil)

// M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil) // M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)

// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil) // M140 - 设置热床到默认温度

// M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.

// M190 - Sxxx 等待挤出头加热到目标温度. 只有在加热的时候才会等待

// Rxxx 等待挤出头加热到目标温度. 加热和冷却时都会等待

// M200 D<millimeters>- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).

// M201 - 设定最大打印加速度,单位units/s^2 (M201 X1000 Y1000)

// M202 - 设定最大空载加速度,单位units/s^2 (M202 X1000 Y1000) Marlin中没用!!

// M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec

// M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) in mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate

// M205 - 高级设置: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk

// M206 - 设定额外的归零偏移量

// M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting

// M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]

// M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.

// M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y> // M220 S<factor in percent>- 设定当前三轴移动速度的百分比数值(例如:M220 S50,则打印速度会降低一半。与M221类似,改指令即刻生效,但是要等到缓冲区内的动作执行完才会看到效果)

// M221 S<factor in percent>- 设定当前挤丝速度的百分数比值

// M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required // M240 - 触发相机拍照

// M250 - 设置LCD对比度 C<contrast value> (value 0..63)

// M280 - 设置舵机绝对位置. P: 舵机序号, S: 角度 或 占空比毫秒数

// M300 - 播放蜂鸣器 S<frequency Hz> P<duration ms>

// M301 - 设定PID的三个参数 P I 与 D

// M302 - 允许制冷挤出头, or 设置最小挤出温度 S<temperature>.

// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)

// M304 - 设置热床 PID 参数 P I 与 D

// M400 - Finish all moves

// M401 - 放下Z轴探针(若存在)

// M402 - 升起z轴探针(若存在)

// M500 - 存储参数到EEPROM

// M501 - 从EEPROM读取参数 (if you need reset them after you changed them temporarily). // M502 - 恢复出厂设置. You still need to store them in EEPROM afterwards if you want to. // M503 - 串口输出当前配置 (内存中的,而不是EEPROM)

// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)

// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]

// M665 - 配置 delta 参数

// M666 - set delta endstop adjustment

// M605 - Set dual