Loading... Marlin支持一个非常棒的GCode那就是*M600*,这是一个指示打印机更换打印耗材的半自动化功能。 但如果要打开这个功能就需要在固件中更改不少的地方,首先要找到`FILAMENT_RUNOUT_SENSOR`的定义并取消注释,使耗材检测传感器处于可用状态。然后要将`FIL_RUNOUT_INVERTING`设置为`true`,具体代码如下: ```c /** * Filament Runout Sensor * A mechanical or opto endstop is used to check for the presence of filament. * * RAMPS-based boards use SERVO3_PIN. * For other boards you may need to define FIL_RUNOUT_PIN. * By default the firmware assumes HIGH = has filament, LOW = ran out */ #define FILAMENT_RUNOUT_SENSOR #if ENABLED(FILAMENT_RUNOUT_SENSOR) #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor. #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined. #define FILAMENT_RUNOUT_SCRIPT "M600" #endif ``` 此时需要在将的 `pins_RAMP.h` 文件中的`FIL_RUNOUT_PIN`指向当前使用的跳线,如果采用Y-MIN则要改成以下的设定 ```c #define FIL_RUNOUT_PIN 14 // 现在采用 Y-Min // 4 ``` 如果不清楚传感器的状态可以输入`M119`来查看断料传感器的状态,插入耗材后`filament`的状态应该为`Tiggered`, 在Pronterface的输出如下所示: ```kotlin >>> M119 SENDING:M119 Reporting endstop status x_max: open y_max: open z_min: open z_max: open filament: TRIGGERED ``` 当然此时你还没有上传固件,因为现在的状态是不能成功进行编译的`FILAMENT_RUNOUT_SENSOR`是需要在`Configuration_adv.h`文件中启用`ADVANCED_PAUSE_FEATURE`才能成功编译。打开`Configuration_adv.h`文件找到以下的代码行: ```c /** * Advanced Pause * Experimental feature for filament change support and for parking the nozzle when paused. * Adds the GCode M600 for initiating filament change. * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. * * Requires an LCD display. * Requires NOZZLE_PARK_FEATURE. * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. */ #define ADVANCED_PAUSE_FEATURE ``` 这个选项实际的意义就是让3d打印机可以暂停打印并进行停靠,当然你还得在`Configuration.h` 文件中将`NOZZLE_PARK_FEATURE`启用起来: ```c /** * Nozzle Park * * Park the nozzle at the given XYZ position on idle or G27. * * The "P" parameter controls the action applied to the Z axis: * * P0 (Default) If Z is below park Z raise the nozzle. * P1 Raise the nozzle always to Z-park height. * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. */ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) // Specify a park position as { X, Y, Z } #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } #define NOZZLE_PARK_XY_FEEDRATE 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) #define NOZZLE_PARK_Z_FEEDRATE 5 // Z axis feedrate in mm/s (not used for delta printers) #endif ``` 其中的三个变量的定义的意思如下: * `NOZZLE_PARK_POINT` - 指定效应器的停靠位置 * `NOZZLE_PARK_XY_FEEDRATE` - 指定效应器在停靠时XY轴方向(水平)运行速度 * `NOZZLE_PARK_Z_FEEDRATE` - 指定效应器在停靠时Z轴方向(垂直)运行速度 然后回到 `Configuration_adv.h` 文件中,还需要对 `ADVANCED_PAUSE_FEATURE`内的具体选项进行修改,否则在更换耗材时耗材只会被拖出一点点或者送进一点点,因为Marlin是对近程挤出机进行设置的所以出料与入料都设得很短,因此我们得将`FILAMENT_CHANGE_UNLOAD_LENGTH`和`FILAMENT_CHANGE_LOAD_LENGTH`设置得长一些,我这里是设置成为500,也就是50CM,代码如下所示: ```c #if ENABLED(ADVANCED_PAUSE_FEATURE) // ... 省略 #define FILAMENT_CHANGE_UNLOAD_LENGTH 500 // Unload filament length from hotend in mm #define FILAMENT_CHANGE_LOAD_LENGTH 500 // Load filament length over hotend in mm // Longer length for bowden printers to fast load filament into whole bowden tube over the hotend, // ... #endif ``` 上传,然后运行。成功? 不好意思,你的打印机一定只会不停地出现要你插入耗材的提示而且根本没有按照我们所想那样退料50cm或者进料50cm,这是什么鬼?如果打开Pronterfont来观察打印机的日志输出你会发现这么一行: ```bash echo: too long extrusion prevented ``` 然后打印机的LCD控制面板就会提示你插入耗材(即使现在已经插入了耗材)。这是由于被`EXTRUDE_MAXLENGTH`这个选项给限制了,它是阻止挤出过多地挤出耗材设定的,默认值只有200,对于远程挤出机来说根本不够,那就将它改成600吧,在`Configuration.h`你可以找到它,代码如下所示: ```c #define PREVENT_LENGTHY_EXTRUDE #define EXTRUDE_MAXLENGTH 600 ``` 上传固件,大功告成! > 注意 : 如果你没有将挤出头的温度加热到170度以上,LCD中是不会出现更换耗材菜单的,记得想更换耗材之前要预热哦。 > 引用自:「简书-[梁睿坤](https://www.jianshu.com/p/22b3d6430d74)」 Last modification:November 5, 2020 © Allow specification reprint Support Appreciate the author WeChat Like 0 如果觉得我的文章对你有用,请帮忙点一下上面的广告